Merge jdk8-b18
authorigor
Mon, 19 Dec 2011 10:06:23 -0800
changeset 4871334bd51fb3f3
parent 4870 526e99f06a59
parent 4866 e55ac966ed95
child 4872 c6fab5332075
child 4882 94d7051cca13
Merge
make/sun/motif12/reorder-i586
make/sun/motif12/reorder-sparc
make/sun/motif12/reorder-sparcv9
src/share/native/java/util/zip/zlib-1.2.3/ChangeLog
src/share/native/java/util/zip/zlib-1.2.3/README
src/share/native/java/util/zip/zlib-1.2.3/compress.c
src/share/native/java/util/zip/zlib-1.2.3/crc32.h
src/share/native/java/util/zip/zlib-1.2.3/deflate.c
src/share/native/java/util/zip/zlib-1.2.3/deflate.h
src/share/native/java/util/zip/zlib-1.2.3/gzio.c
src/share/native/java/util/zip/zlib-1.2.3/infback.c
src/share/native/java/util/zip/zlib-1.2.3/inffast.c
src/share/native/java/util/zip/zlib-1.2.3/inffast.h
src/share/native/java/util/zip/zlib-1.2.3/inffixed.h
src/share/native/java/util/zip/zlib-1.2.3/inflate.c
src/share/native/java/util/zip/zlib-1.2.3/inflate.h
src/share/native/java/util/zip/zlib-1.2.3/inftrees.c
src/share/native/java/util/zip/zlib-1.2.3/inftrees.h
src/share/native/java/util/zip/zlib-1.2.3/patches/ChangeLog_java
src/share/native/java/util/zip/zlib-1.2.3/patches/crc32.c.diff
src/share/native/java/util/zip/zlib-1.2.3/patches/inflate.c.diff
src/share/native/java/util/zip/zlib-1.2.3/patches/zconf.h.diff
src/share/native/java/util/zip/zlib-1.2.3/patches/zlib.h.diff
src/share/native/java/util/zip/zlib-1.2.3/trees.c
src/share/native/java/util/zip/zlib-1.2.3/trees.h
src/share/native/java/util/zip/zlib-1.2.3/uncompr.c
src/share/native/java/util/zip/zlib-1.2.3/zadler32.c
src/share/native/java/util/zip/zlib-1.2.3/zconf.h
src/share/native/java/util/zip/zlib-1.2.3/zcrc32.c
src/share/native/java/util/zip/zlib-1.2.3/zlib.h
src/share/native/java/util/zip/zlib-1.2.3/zutil.c
src/share/native/java/util/zip/zlib-1.2.3/zutil.h
src/solaris/classes/sun/awt/motif/AWTLockAccess.java
src/solaris/classes/sun/awt/motif/MFontPeer.java
src/solaris/classes/sun/awt/motif/MToolkit.java
src/solaris/classes/sun/awt/motif/MToolkitThreadBlockedHandler.java
src/solaris/classes/sun/awt/motif/MWindowAttributes.java
src/solaris/classes/sun/awt/motif/X11FontMetrics.java
src/solaris/native/sun/awt/MouseInfo.c
src/solaris/native/sun/awt/XDrawingArea.c
src/solaris/native/sun/awt/XDrawingArea.h
src/solaris/native/sun/awt/XDrawingAreaP.h
src/solaris/native/sun/awt/awt_Cursor.h
src/solaris/native/sun/awt/awt_KeyboardFocusManager.h
src/solaris/native/sun/awt/awt_MToolkit.c
src/solaris/native/sun/awt/awt_MToolkit.h
src/solaris/native/sun/awt/awt_MenuItem.h
src/solaris/native/sun/awt/awt_PopupMenu.h
src/solaris/native/sun/awt/awt_TopLevel.h
src/solaris/native/sun/awt/awt_Window.h
src/solaris/native/sun/awt/awt_mgrsel.c
src/solaris/native/sun/awt/awt_mgrsel.h
src/solaris/native/sun/awt/awt_motif.h
src/solaris/native/sun/awt/awt_wm.c
src/solaris/native/sun/awt/awt_wm.h
src/solaris/native/sun/awt/awt_xembed.h
src/solaris/native/sun/awt/awt_xembed_server.c
src/solaris/native/sun/awt/awt_xembed_server.h
test/java/util/ResourceBundle/Control/ExpirationTest.java
test/java/util/ResourceBundle/Control/ExpirationTest.sh
     1.1 --- a/.hgtags	Tue Dec 06 16:31:58 2011 -0800
     1.2 +++ b/.hgtags	Mon Dec 19 10:06:23 2011 -0800
     1.3 @@ -137,3 +137,5 @@
     1.4  4cb2e8679b27432854690cb688ea06d3b2d8e008 jdk8-b13
     1.5  99632935785e2038b2fc836da9f2ede69dea294b jdk8-b14
     1.6  3c248d0e2c486624cc0d7aba1e4df45ae5774ff7 jdk8-b15
     1.7 +b71d1acfae5240d8c1359443cd02b5ddb587231c jdk8-b17
     1.8 +929597c6e777f742ad252660045ebaa4a3ea4772 jdk8-b16
     2.1 --- a/make/common/Defs-embedded.gmk	Tue Dec 06 16:31:58 2011 -0800
     2.2 +++ b/make/common/Defs-embedded.gmk	Mon Dec 19 10:06:23 2011 -0800
     2.3 @@ -65,5 +65,12 @@
     2.4    NIO_PLATFORM_CLASSES_ROOT_DIR = $(CLOSED_PLATFORM_SRC)/classes/
     2.5  endif
     2.6  
     2.7 +# For ARM sflt we need to link to a library with improved FP accuracy
     2.8 +# and it must be linked after fdlibm - this places it at the end after libc
     2.9 +# -z muldefs avoids linker errors for duplicate symbols.
    2.10 +ifeq ($(CROSS_COMPILE_ARCH), arm)
    2.11 +  EXTRA_LIBS +=  $(EXT_LIBS_PATH)/sflt_glibc_jdk.a -Xlinker -z -Xlinker muldefs
    2.12 +endif
    2.13 +
    2.14  endif # JAVASE_EMBEDDED
    2.15  
     3.1 --- a/make/common/Defs.gmk	Tue Dec 06 16:31:58 2011 -0800
     3.2 +++ b/make/common/Defs.gmk	Mon Dec 19 10:06:23 2011 -0800
     3.3 @@ -202,7 +202,7 @@
     3.4  #
     3.5  # zlib version
     3.6  #
     3.7 -ZLIB_VERSION = 1.2.3
     3.8 +ZLIB_VERSION = 1.2.5
     3.9  
    3.10  
    3.11  #
     4.1 --- a/make/common/Rules.gmk	Tue Dec 06 16:31:58 2011 -0800
     4.2 +++ b/make/common/Rules.gmk	Mon Dec 19 10:06:23 2011 -0800
     4.3 @@ -233,13 +233,15 @@
     4.4  	@$(MKDIR) -p $(CLASSDESTDIR)
     4.5  	@$(RM) $<.filtered
     4.6  	@$(CAT) $< | $(NAWK) 'length>0' | $(SORT) -u > $<.filtered
     4.7 -	@if [ `$(CAT) $<.filtered | $(WC) -l` -ge 1 ] ; then \
     4.8 -	  $(ECHO) "# Java sources to be compiled: (listed in file $<)"; \
     4.9 -	  $(CAT) $<.filtered; \
    4.10 -	  $(ECHO) "# Running javac:"; \
    4.11 -	  $(ECHO) $(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$<.filtered; \
    4.12 -	  $(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$<.filtered; \
    4.13 -	fi
    4.14 +	@numfiles=`$(WC) -l < $<.filtered` ; \
    4.15 +	  if [ $$numfiles -ge 1 ] ; then \
    4.16 +	    $(ECHO) "# Java sources to be compiled: (listed in file $<)"; \
    4.17 +	    $(CAT) $<.filtered; \
    4.18 +	    $(ECHO) "# Running javac: $$numfiles files; in $(CURDIR)"; \
    4.19 +	    $(ECHO) $(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$<.filtered; \
    4.20 +	    $(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$<.filtered; \
    4.21 +	    $(ECHO) "# javac finished"; \
    4.22 +	  fi
    4.23  	@$(java-vm-cleanup)
    4.24  
    4.25  clobber clean::
     5.1 --- a/make/java/zip/FILES_c.gmk	Tue Dec 06 16:31:58 2011 -0800
     5.2 +++ b/make/java/zip/FILES_c.gmk	Mon Dec 19 10:06:23 2011 -0800
     5.3 @@ -32,7 +32,10 @@
     5.4  	zip_util.c \
     5.5  	compress.c \
     5.6  	deflate.c \
     5.7 -	gzio.c \
     5.8 +	gzclose.c \
     5.9 +	gzlib.c \
    5.10 +	gzread.c \
    5.11 +	gzwrite.c \
    5.12  	infback.c \
    5.13  	inffast.c \
    5.14  	inflate.c \
     6.1 --- a/make/java/zip/mapfile-vers	Tue Dec 06 16:31:58 2011 -0800
     6.2 +++ b/make/java/zip/mapfile-vers	Mon Dec 19 10:06:23 2011 -0800
     6.3 @@ -30,8 +30,10 @@
     6.4  		Java_java_util_jar_JarFile_getMetaInfEntryNames;
     6.5  		Java_java_util_zip_Adler32_update;
     6.6  		Java_java_util_zip_Adler32_updateBytes;
     6.7 +		Java_java_util_zip_Adler32_updateByteBuffer;
     6.8  		Java_java_util_zip_CRC32_update;
     6.9  		Java_java_util_zip_CRC32_updateBytes;
    6.10 +		Java_java_util_zip_CRC32_updateByteBuffer;
    6.11  		Java_java_util_zip_Deflater_deflateBytes;
    6.12  		Java_java_util_zip_Deflater_end;
    6.13  		Java_java_util_zip_Deflater_getAdler;
     7.1 --- a/make/sun/awt/FILES_c_unix.gmk	Tue Dec 06 16:31:58 2011 -0800
     7.2 +++ b/make/sun/awt/FILES_c_unix.gmk	Mon Dec 19 10:06:23 2011 -0800
     7.3 @@ -140,71 +140,13 @@
     7.4  	debug_trace.c \
     7.5  	debug_util.c
     7.6  
     7.7 -# These files rely on motif to be built, and should not be included
     7.8 -# in a headless build.
     7.9 -
    7.10 -#FILES_MOTIF_c = \
    7.11 -#keep	awt_AWTEvent.c \
    7.12 -#	awt_Button.c \
    7.13 -#	awt_Canvas.c \
    7.14 -#	awt_Checkbox.c \
    7.15 -#keep .h	awt_Component.c \
    7.16 -#keep .h	awt_Cursor.c \
    7.17 -#	awt_DataTransferer.c \
    7.18 -#	awt_DrawingSurface.c \
    7.19 -#	awt_Event.c \
    7.20 -#	awt_FileDialog.c \
    7.21 -#	awt_GlobalCursorManager.c \
    7.22 -#	awt_GraphicsEnv.c \
    7.23 -#	awt_InputMethod.c \
    7.24 -#keep	awt_Insets.c \
    7.25 -#	awt_KeyboardFocusManager.c \
    7.26 -#	awt_Label.c \
    7.27 -#	awt_List.c \
    7.28 -#	awt_Menu.c \
    7.29 -#	awt_MenuBar.c \
    7.30 -#	awt_MenuComponent.c \
    7.31 -#	awt_MenuItem.c \
    7.32 -#	awt_motif.c \
    7.33 -#	awt_Plugin.c \
    7.34 -#	awt_PopupMenu.c \
    7.35 -#	awt_Robot.c \
    7.36 -#	awt_Scrollbar.c \
    7.37 -#	awt_ScrollPane.c \
    7.38 -#	awt_Selection.c \
    7.39 -#	awt_UNIXToolkit.c \
    7.40 -#	awt_TextArea.c \
    7.41 -#	awt_TextField.c \
    7.42 -#	awt_TopLevel.c \
    7.43 -#	awt_mgrsel.c \
    7.44 -#	awt_util.c \
    7.45 -#	awt_wm.c \
    7.46 -#	awt_XmDnD.c \
    7.47 -#	awt_dnd.c \
    7.48 -#	awt_dnd_ds.c \
    7.49 -#	awt_dnd_dt.c \
    7.50 -#	canvas.c \
    7.51 -#	cursor.c \
    7.52 -#	multi_font.c \
    7.53 -#	robot_common.c \
    7.54 -#        list.c \
    7.55 -#        multiVis.c \
    7.56 -#	XDrawingArea.c \
    7.57 -#	MouseInfo.c \
    7.58 -#	awt_xembed.c \
    7.59 -#	awt_xembed_server.c \
    7.60 -#        gtk2_interface.c \
    7.61 -#        swing_GTKEngine.c \
    7.62 -#        swing_GTKStyle.c
    7.63 -
    7.64 -
    7.65  # These files are required to be built, with or without motif.  Some of
    7.66  # these are only dependent on X11, and some contain native source that
    7.67  # is required, even in a headless build.
    7.68  
    7.69  FILES_NO_MOTIF_c = \
    7.70  	awt_Font.c \
    7.71 -	awt_MToolkit.c \
    7.72 +	HeadlessToolkit.c \
    7.73  	fontpath.c \
    7.74  	VDrawingArea.c \
    7.75  	X11Color.c \
     8.1 --- a/make/sun/awt/FILES_export_unix.gmk	Tue Dec 06 16:31:58 2011 -0800
     8.2 +++ b/make/sun/awt/FILES_export_unix.gmk	Mon Dec 19 10:06:23 2011 -0800
     8.3 @@ -61,11 +61,8 @@
     8.4  	sun/awt/image/BufImgSurfaceData.java \
     8.5  	sun/awt/image/DataBufferNative.java \
     8.6  	\
     8.7 -	sun/awt/motif/X11FontMetrics.java \
     8.8  	sun/awt/X11InputMethod.java \
     8.9  	sun/awt/motif/MFontConfiguration.java \
    8.10 -	sun/awt/motif/MFontPeer.java \
    8.11 -	sun/awt/motif/MToolkit.java \
    8.12          sun/awt/DebugSettings.java \
    8.13  	sun/awt/EmbeddedFrame.java \
    8.14  	sun/awt/PlatformFont.java \
    8.15 @@ -93,7 +90,6 @@
    8.16          sun/java2d/cmm/ColorTransform.java \
    8.17          sun/awt/datatransfer/DataTransferer.java \
    8.18  	sun/awt/dnd/SunDragSourceContextPeer.java \
    8.19 -	sun/awt/motif/MToolkitThreadBlockedHandler.java \
    8.20  	sun/java2d/opengl/OGLBlitLoops.java \
    8.21  	sun/java2d/opengl/OGLContext.java \
    8.22  	sun/java2d/opengl/OGLMaskFill.java \
     9.1 --- a/make/sun/awt/mapfile-mawt-vers	Tue Dec 06 16:31:58 2011 -0800
     9.2 +++ b/make/sun/awt/mapfile-mawt-vers	Mon Dec 19 10:06:23 2011 -0800
     9.3 @@ -31,7 +31,6 @@
     9.4  	global:
     9.5  		JNI_OnLoad;
     9.6  
     9.7 -                #Java_sun_awt_motif_MComponentPeer_restoreFocus;
     9.8  		Java_sun_awt_DefaultMouseInfoPeer_fillPointWithCoords;
     9.9  		Java_sun_awt_DefaultMouseInfoPeer_isWindowUnderMouse;
    9.10  		Java_java_awt_AWTEvent_nativeSetSource;
    9.11 @@ -56,230 +55,11 @@
    9.12                  Java_sun_awt_UNIXToolkit_load_1stock_1icon;
    9.13                  Java_sun_awt_UNIXToolkit_load_1gtk_1icon;
    9.14  		Java_sun_awt_UNIXToolkit_nativeSync;
    9.15 -		#Java_sun_awt_motif_MButtonPeer_create;
    9.16 -		#Java_sun_awt_motif_MButtonPeer_setLabel;
    9.17 -                #Java_sun_awt_motif_MPanelPeer_pEnsureIndex;
    9.18 -                #Java_sun_awt_motif_MPanelPeer_pRestack;
    9.19 -		#Java_sun_awt_motif_MCanvasPeer_create;
    9.20 -		#Java_sun_awt_motif_MCanvasPeer_initIDs;
    9.21 -		#Java_sun_awt_motif_MCanvasPeer_resetTargetGC;
    9.22 -		#Java_sun_awt_motif_MCheckboxMenuItemPeer_pSetState;
    9.23 -		#Java_sun_awt_motif_MCheckboxPeer_create;
    9.24 -		#Java_sun_awt_motif_MCheckboxPeer_setCheckboxGroup;
    9.25 -		#Java_sun_awt_motif_MCheckboxPeer_setLabel;
    9.26 -		#Java_sun_awt_motif_MCheckboxPeer_pSetState;
    9.27 -		#Java_sun_awt_motif_MCheckboxPeer_pGetState;
    9.28 -		#Java_sun_awt_motif_MChoicePeer_addItem;
    9.29 -		#Java_sun_awt_motif_MChoicePeer_appendItems;
    9.30 -		#Java_sun_awt_motif_MChoicePeer_create;
    9.31 -		#Java_sun_awt_motif_MChoicePeer_pReshape;
    9.32 -		#Java_sun_awt_motif_MChoicePeer_remove;
    9.33 -		#Java_sun_awt_motif_MChoicePeer_removeAll;
    9.34 -		#Java_sun_awt_motif_MChoicePeer_setBackground;
    9.35 -		#Java_sun_awt_motif_MChoicePeer_pSelect;
    9.36 -		#Java_sun_awt_motif_MChoicePeer_setFont;
    9.37 -		#Java_sun_awt_motif_MChoicePeer_setForeground;
    9.38 -		#Java_sun_awt_motif_MComponentPeer_addNativeDropTarget;
    9.39 -		#Java_sun_awt_motif_MComponentPeer_getNativeColor;
    9.40 -		#Java_sun_awt_motif_MComponentPeer_getWindow;
    9.41 -		#Java_sun_awt_motif_MComponentPeer_pDisable;
    9.42 -		#Java_sun_awt_motif_MComponentPeer_pDispose;
    9.43 -		#Java_sun_awt_motif_MComponentPeer_pEnable;
    9.44 -		#Java_sun_awt_motif_MComponentPeer_pGetLocationOnScreen;
    9.45 -		#Java_sun_awt_motif_MComponentPeer_pGetLocationOnScreen2;
    9.46 -		#Java_sun_awt_motif_MComponentPeer_pHide;
    9.47 -		#Java_sun_awt_motif_MComponentPeer_pInitialize;
    9.48 -		#Java_sun_awt_motif_MComponentPeer_pMakeCursorVisible;
    9.49 -		#Java_sun_awt_motif_MComponentPeer_pReshape;
    9.50 -		#Java_sun_awt_motif_MComponentPeer_pShow;
    9.51 -		#Java_sun_awt_motif_MComponentPeer_removeNativeDropTarget;
    9.52 -		#Java_sun_awt_motif_MComponentPeer_pSetBackground;
    9.53 -		#Java_sun_awt_motif_MComponentPeer_pSetFont;
    9.54 -                #Java_sun_awt_motif_MComponentPeer_processSynchronousLightweightTransfer;
    9.55 -                #Java_sun_awt_motif_MComponentPeer__1requestFocus;
    9.56 -                #Java_sun_awt_motif_MComponentPeer_getNativeFocusedWindow;
    9.57 -		#Java_sun_awt_motif_MCheckboxMenuItemPeer_getState;
    9.58 -		#Java_sun_awt_motif_MComponentPeer_pSetForeground;
    9.59 -		#Java_sun_awt_motif_MDragSourceContextPeer_startDrag;
    9.60 -		#Java_sun_awt_motif_MDragSourceContextPeer_setNativeCursor;
    9.61 -		#Java_sun_awt_motif_MDropTargetContextPeer_addTransfer;
    9.62 -		#Java_sun_awt_motif_MDropTargetContextPeer_dropDone;
    9.63 -		#Java_sun_awt_motif_MDropTargetContextPeer_startTransfer;
    9.64 -		#Java_sun_awt_motif_X11DragSourceContextPeer_startDrag;
    9.65 -		#Java_sun_awt_motif_X11DragSourceContextPeer_setNativeCursor;
    9.66 -		#Java_sun_awt_motif_X11DropTargetContextPeer_sendResponse;
    9.67 -		#Java_sun_awt_motif_X11DropTargetContextPeer_dropDone;
    9.68 -		#Java_sun_awt_motif_X11DropTargetContextPeer_getData;
    9.69 -		#Java_sun_awt_motif_MEmbeddedFramePeer_NEFcreate;
    9.70 -		#Java_sun_awt_motif_MEmbeddedFramePeer_pShowImpl;
    9.71 -		#Java_sun_awt_motif_MEmbeddedFramePeer_requestXEmbedFocus;
    9.72 -		#Java_sun_awt_motif_MEmbeddedFramePeer_isXEmbedApplicationActive;
    9.73 -		#Java_sun_awt_motif_MEmbeddedFramePeer_isXEmbedActive;
    9.74 -                #Java_sun_awt_motif_MEmbeddedFramePeer_synthesizeFocusInOut;
    9.75 -		#Java_sun_awt_motif_MEmbeddedFramePeer_pReshapePrivate;
    9.76 -		#Java_sun_awt_motif_MEmbeddedFramePeer_getBoundsPrivate;
    9.77 -		#Java_sun_awt_motif_MEmbeddedFrame_getWidget;
    9.78 -		#Java_sun_awt_motif_MEmbeddedFrame_mapWidget;
    9.79 -                #Java_sun_awt_motif_MEmbedCanvasPeer_forwardEventToEmbedded;       
    9.80 -		#Java_sun_awt_motif_MFramePeer_pSetIconImage___3B_3I_3SII;
    9.81 -		#Java_sun_awt_motif_MFileDialogPeer_create;
    9.82 -		#Java_sun_awt_motif_MFileDialogPeer_pDispose;
    9.83 -		#Java_sun_awt_motif_MFileDialogPeer_pHide;
    9.84 -		#Java_sun_awt_motif_MFileDialogPeer_pReshape;
    9.85 -		#Java_sun_awt_motif_MFileDialogPeer_pShow;
    9.86 -		#Java_sun_awt_motif_MFileDialogPeer_setFileEntry;
    9.87 -		#Java_sun_awt_motif_MFileDialogPeer_setFont;
    9.88 -		#Java_sun_awt_motif_MFramePeer_pGetIconSize;
    9.89 -		#Java_sun_awt_motif_MGlobalCursorManager_cacheInit;
    9.90 -		#Java_sun_awt_motif_MGlobalCursorManager_findComponentAt;
    9.91 -		#Java_sun_awt_motif_MGlobalCursorManager_findHeavyweightUnderCursor;
    9.92 -		#Java_sun_awt_motif_MGlobalCursorManager_getCursorPos;
    9.93 -		#Java_sun_awt_motif_MGlobalCursorManager_getLocationOnScreen;
    9.94 -		#Java_sun_awt_motif_MLabelPeer_create;
    9.95 -		#Java_sun_awt_motif_MLabelPeer_setAlignment;
    9.96 -		#Java_sun_awt_motif_MLabelPeer_setText;
    9.97 -		#Java_sun_awt_motif_MListPeer_addItem;
    9.98 -		#Java_sun_awt_motif_MListPeer_create;
    9.99 -		#Java_sun_awt_motif_MListPeer_delItems;
   9.100 -		#Java_sun_awt_motif_MListPeer_deselect;
   9.101 -		#Java_sun_awt_motif_MListPeer_isSelected;
   9.102 -		#Java_sun_awt_motif_MListPeer_makeVisible;
   9.103 -		#Java_sun_awt_motif_MListPeer_nativeHandleMouseWheel;
   9.104 -		#Java_sun_awt_motif_MListPeer_select;
   9.105 -		#Java_sun_awt_motif_MListPeer_setMultipleSelections;
   9.106 -		#Java_sun_awt_motif_MMenuBarPeer_create;
   9.107 -		#Java_sun_awt_motif_MMenuItemPeer_createMenuItem;
   9.108 -		#Java_sun_awt_motif_MMenuItemPeer_pDisable;
   9.109 -		#Java_sun_awt_motif_MMenuItemPeer_pDispose;
   9.110 -		#Java_sun_awt_motif_MMenuItemPeer_pEnable;
   9.111 -		#Java_sun_awt_motif_MMenuItemPeer_pSetLabel;
   9.112 -		#Java_sun_awt_motif_MMenuPeer_createMenu;
   9.113 -		#Java_sun_awt_motif_MMenuPeer_createSubMenu;
   9.114 -		#Java_sun_awt_motif_MMenuPeer_pDispose;
   9.115 -		#Java_sun_awt_motif_MPopupMenuPeer_createMenu;
   9.116 -		#Java_sun_awt_motif_MPopupMenuPeer_pDispose;
   9.117 -		#Java_sun_awt_motif_MPopupMenuPeer_pShow;
   9.118 -		#Java_sun_awt_motif_MRobotPeer_getRGBPixelsImpl;
   9.119 -		#Java_sun_awt_motif_MRobotPeer_keyPressImpl;
   9.120 -		#Java_sun_awt_motif_MRobotPeer_keyReleaseImpl;
   9.121 -		#Java_sun_awt_motif_MRobotPeer_mouseMoveImpl;
   9.122 -		#Java_sun_awt_motif_MRobotPeer_mousePressImpl;
   9.123 -		#Java_sun_awt_motif_MRobotPeer_mouseReleaseImpl;
   9.124 -		#Java_sun_awt_motif_MRobotPeer_mouseWheelImpl;
   9.125 -		#Java_sun_awt_motif_MRobotPeer_setup;
   9.126 -		#Java_sun_awt_motif_MScrollbarPeer_create;
   9.127 -		#Java_sun_awt_motif_MScrollbarPeer_setLineIncrement;
   9.128 -		#Java_sun_awt_motif_MScrollbarPeer_setPageIncrement;
   9.129 -		#Java_sun_awt_motif_MScrollbarPeer_pSetValues;
   9.130 -		#Java_sun_awt_motif_MScrollPanePeer_create;
   9.131 -		#Java_sun_awt_motif_MScrollPanePeer_pGetBlockIncrement;
   9.132 -		#Java_sun_awt_motif_MScrollPanePeer_pGetScrollbarSpace;
   9.133 -		#Java_sun_awt_motif_MScrollPanePeer_pGetShadow;
   9.134 -		#Java_sun_awt_motif_MScrollPanePeer_pInsets;
   9.135 -		#Java_sun_awt_motif_MScrollPanePeer_pSetIncrement;
   9.136 -		#Java_sun_awt_motif_MScrollPanePeer_pSetScrollChild;
   9.137 -		#Java_sun_awt_motif_MScrollPanePeer_setScrollPosition;
   9.138 -		#Java_sun_awt_motif_MScrollPanePeer_setTypedValue;
   9.139 -		#Java_sun_awt_motif_MTextAreaPeer_initIDs;
   9.140 -		#Java_sun_awt_motif_MTextAreaPeer_pCreate;
   9.141 -		#Java_sun_awt_motif_MTextAreaPeer_getCaretPosition;
   9.142 -		#Java_sun_awt_motif_MTextAreaPeer_getExtraHeight;
   9.143 -		#Java_sun_awt_motif_MTextAreaPeer_getExtraWidth;
   9.144 -		#Java_sun_awt_motif_MTextAreaPeer_getSelectionEnd;
   9.145 -		#Java_sun_awt_motif_MTextAreaPeer_getSelectionStart;
   9.146 -		#Java_sun_awt_motif_MTextAreaPeer_getText;
   9.147 -		#Java_sun_awt_motif_MTextAreaPeer_insert;
   9.148 -		#Java_sun_awt_motif_MTextAreaPeer_nativeHandleMouseWheel;
   9.149 -		#Java_sun_awt_motif_MTextAreaPeer_pMakeCursorVisible;
   9.150 -		#Java_sun_awt_motif_MTextAreaPeer_pSetEditable;
   9.151 -		#Java_sun_awt_motif_MTextAreaPeer_pShow2;
   9.152 -		#Java_sun_awt_motif_MTextAreaPeer_replaceRange;
   9.153 -		#Java_sun_awt_motif_MTextAreaPeer_select;
   9.154 -                #Java_sun_awt_motif_MTextAreaPeer_setCaretPosition;
   9.155 -		#Java_sun_awt_motif_MTextAreaPeer_setFont;
   9.156 -		#Java_sun_awt_motif_MTextAreaPeer_setText;
   9.157 -		#Java_sun_awt_motif_MTextAreaPeer_setTextBackground;
   9.158 -		#Java_sun_awt_motif_MTextFieldPeer_initIDs;
   9.159 -		#Java_sun_awt_motif_MTextFieldPeer_pCreate;
   9.160 -		#Java_sun_awt_motif_MTextFieldPeer_getCaretPosition;
   9.161 -		#Java_sun_awt_motif_MTextFieldPeer_getSelectionEnd;
   9.162 -		#Java_sun_awt_motif_MTextFieldPeer_getSelectionStart;
   9.163 -		#Java_sun_awt_motif_MTextFieldPeer_getText;
   9.164 -		#Java_sun_awt_motif_MTextFieldPeer_insertReplaceText;
   9.165 -		#Java_sun_awt_motif_MTextFieldPeer_preDispose;
   9.166 -		#Java_sun_awt_motif_MTextFieldPeer_pSetEditable;
   9.167 -		#Java_sun_awt_motif_MTextFieldPeer_select;
   9.168 -		#Java_sun_awt_motif_MTextFieldPeer_setCaretPosition;
   9.169 -		#Java_sun_awt_motif_MTextFieldPeer_setEchoChar;
   9.170 -		#Java_sun_awt_motif_MTextFieldPeer_setFont;
   9.171 -		#Java_sun_awt_motif_MTextFieldPeer_setText;
   9.172 -		Java_sun_awt_motif_MToolkit_beep;
   9.173 -		Java_sun_awt_motif_MToolkit_getLockingKeyStateNative;
   9.174 -		Java_sun_awt_motif_MToolkit_getMulticlickTime;
   9.175 -		Java_sun_awt_motif_MToolkit_getNumMouseButtons;
   9.176 -		Java_sun_awt_motif_MToolkit_loadXSettings;
   9.177 -		Java_sun_awt_motif_MToolkit_getScreenHeight;
   9.178 -		Java_sun_awt_motif_MToolkit_getScreenResolution;
   9.179 -		Java_sun_awt_motif_MToolkit_getScreenWidth;
   9.180 -		Java_sun_awt_motif_MToolkit_init;
   9.181 -		Java_sun_awt_motif_MToolkit_isDynamicLayoutSupportedNative;
   9.182 -		Java_sun_awt_motif_MToolkit_isFrameStateSupported;
   9.183 -		Java_sun_awt_motif_MToolkit_loadSystemColors;
   9.184 -		Java_sun_awt_motif_MToolkit_makeColorModel;
   9.185 -		Java_sun_awt_motif_MToolkit_run;
   9.186 -                Java_sun_awt_motif_MToolkit_isAlwaysOnTopSupported;
   9.187 -                Java_sun_awt_motif_MToolkit_getEventNumber;
   9.188 -                Java_sun_awt_motif_MToolkit_updateSyncSelection;
   9.189 -                Java_sun_awt_motif_MToolkit_isSyncUpdated;
   9.190 -                Java_sun_awt_motif_MToolkit_isSyncFailed;
   9.191 -                Java_sun_awt_motif_MToolkit_nativeUnGrab;
   9.192 -                Java_sun_awt_motif_MToolkit_nativeGrab;
   9.193 -                Java_sun_awt_motif_MToolkit_getWMName;
   9.194 -		Java_sun_awt_motif_MWindowAttributes_initIDs;
   9.195 -		#Java_sun_awt_motif_MWindowPeer_pDispose;
   9.196 -		#Java_sun_awt_motif_MWindowPeer_pHide;
   9.197 -		#Java_sun_awt_motif_MWindowPeer_pReshape;
   9.198 -		#Java_sun_awt_motif_MWindowPeer_pSetTitle;
   9.199 -		#Java_sun_awt_motif_MWindowPeer_pShow;
   9.200 -		#Java_sun_awt_motif_MWindowPeer_setResizable;
   9.201 -		#Java_sun_awt_motif_MWindowPeer_toBack;
   9.202 -		#Java_sun_awt_motif_MWindowPeer_addTextComponentNative;
   9.203 -		#Java_sun_awt_motif_MWindowPeer_getState;
   9.204 -		#Java_sun_awt_motif_MWindowPeer_pSetIMMOption;
   9.205 -		#Java_sun_awt_motif_MWindowPeer_pSetMenuBar;
   9.206 -		#Java_sun_awt_motif_MWindowPeer_pShowModal;
   9.207 -		#Java_sun_awt_motif_MWindowPeer_removeTextComponentNative;
   9.208 -		#Java_sun_awt_motif_MWindowPeer_setSaveUnder;
   9.209 -		#Java_sun_awt_motif_MWindowPeer_setState;
   9.210 -		#Java_sun_awt_motif_MWindowPeer_resetTargetGC;
   9.211 -		#Java_sun_awt_motif_MWindowPeer_registerX11DropTarget;
   9.212 -		#Java_sun_awt_motif_MWindowPeer_unregisterX11DropTarget;
   9.213 -		#Java_sun_awt_motif_MWindowPeer_updateAlwaysOnTop;
   9.214 -                #Java_sun_awt_motif_MWindowPeer_setFocusableWindow;
   9.215 -                #Java_sun_awt_motif_MWindowPeer_pToFront;
   9.216 -		#Java_sun_awt_motif_MCustomCursor_cacheInit;
   9.217 -		#Java_sun_awt_motif_MCustomCursor_createCursor;
   9.218 -		#Java_sun_awt_motif_MCustomCursor_queryBestCursor;
   9.219 -		Java_sun_awt_motif_X11FontMetrics_bytesWidth;
   9.220 -		Java_sun_awt_motif_X11FontMetrics_getMFCharsWidth;
   9.221 -		Java_sun_awt_motif_X11FontMetrics_init;
   9.222  		Java_sun_awt_X11InputMethod_disposeXIC;
   9.223  		Java_sun_awt_X11InputMethod_isCompositionEnabledNative;
   9.224  		Java_sun_awt_X11InputMethod_resetXIC;
   9.225  		Java_sun_awt_X11InputMethod_setCompositionEnabledNative;
   9.226  		Java_sun_awt_X11InputMethod_turnoffStatusWindow;
   9.227 -		#Java_sun_awt_motif_MInputMethod_openXIMNative;
   9.228 -		#Java_sun_awt_motif_MInputMethod_configureStatusAreaNative;
   9.229 -		#Java_sun_awt_motif_MInputMethod_createXICNative;
   9.230 -		#Java_sun_awt_motif_MInputMethod_reconfigureXICNative;
   9.231 -		#Java_sun_awt_motif_MInputMethod_setXICFocusNative;
   9.232 -		#Java_sun_awt_motif_X11Clipboard_getClipboardData;
   9.233 -		#Java_sun_awt_motif_X11Clipboard_getClipboardFormats;
   9.234 -		#Java_sun_awt_motif_X11Clipboard_registerClipboardViewer;
   9.235 -		#Java_sun_awt_motif_X11Clipboard_unregisterClipboardViewer;
   9.236 -		#Java_sun_awt_motif_X11Selection_init;
   9.237 -		#Java_sun_awt_motif_X11Selection_pGetSelectionOwnership;
   9.238 -		#Java_sun_awt_motif_X11Selection_clearNativeContext;
   9.239  		Java_sun_awt_SunToolkit_closeSplashScreen;
   9.240  		Java_sun_awt_PlatformFont_initIDs;
   9.241  		Java_sun_awt_X11GraphicsConfig_init;
   9.242 @@ -313,25 +93,6 @@
   9.243  		Java_sun_awt_X11GraphicsEnvironment_pRunningXinerama;
   9.244  		Java_sun_awt_X11GraphicsEnvironment_getXineramaCenterPoint;
   9.245  		Java_sun_awt_X11GraphicsEnvironment_initXRender;
   9.246 -                #Java_sun_awt_motif_MEmbedCanvasPeer_initXEmbedServer;
   9.247 -                #Java_sun_awt_motif_MEmbedCanvasPeer_destroyXEmbedServer;
   9.248 -                #Java_sun_awt_motif_MEmbedCanvasPeer_isXEmbedActive;
   9.249 -                #Java_sun_awt_motif_MEmbedCanvasPeer_initDispatching;
   9.250 -                #Java_sun_awt_motif_MEmbedCanvasPeer_endDispatching;
   9.251 -                #Java_sun_awt_motif_MEmbedCanvasPeer_embedChild;
   9.252 -                #Java_sun_awt_motif_MEmbedCanvasPeer_childDestroyed;
   9.253 -                #Java_sun_awt_motif_MEmbedCanvasPeer_getEmbedPreferredSize;
   9.254 -                #Java_sun_awt_motif_MEmbedCanvasPeer_getEmbedMinimumSize;
   9.255 -                #Java_sun_awt_motif_MEmbedCanvasPeer_getClientBounds;
   9.256 -                #Java_sun_awt_motif_MEmbedCanvasPeer_notifyChildEmbedded;
   9.257 -                #Java_sun_awt_motif_MEmbedCanvasPeer_detachChild;
   9.258 -                #Java_sun_awt_motif_MEmbedCanvasPeer_forwardKeyEvent;
   9.259 -                #Java_sun_awt_motif_MEmbedCanvasPeer_getAWTKeyCodeForKeySym;
   9.260 -                #Java_sun_awt_motif_MEmbedCanvasPeer_sendMessage__I;
   9.261 -                #Java_sun_awt_motif_MEmbedCanvasPeer_sendMessage__IJJJ;
   9.262 -                #Java_sun_awt_motif_MEmbedCanvasPeer_getWindow;       
   9.263 -                #Java_sun_awt_motif_GrabbedKey_initKeySymAndModifiers;
   9.264 -                #Java_sun_awt_motif_MEmbeddedFramePeer_traverseOut;
   9.265  		Java_java_awt_AWTEvent_initIDs;
   9.266  		Java_java_awt_Button_initIDs;
   9.267  		Java_java_awt_Container_initIDs;
   9.268 @@ -345,41 +106,6 @@
   9.269  		Java_java_awt_Insets_initIDs;
   9.270  		Java_java_awt_TextField_initIDs;
   9.271  		Java_java_awt_Window_initIDs;
   9.272 -		#Java_sun_awt_motif_MCheckboxPeer_getIndicatorSize;
   9.273 -		#Java_sun_awt_motif_MCheckboxPeer_getSpacing;
   9.274 -		#Java_sun_awt_motif_MChoicePeer_freeNativeData;
   9.275 -		#Java_sun_awt_motif_MComponentPeer_getComponents_1NoClientCode;
   9.276 -		#Java_sun_awt_motif_MComponentPeer_getParent_1NoClientCode;
   9.277 -		#Java_sun_awt_motif_MComponentPeer_initIDs;
   9.278 -		#Java_sun_awt_motif_MComponentPeer_nativeHandleEvent;
   9.279 -		#Java_sun_awt_motif_MComponentPeer_pSetCursor;
   9.280 -		#Java_sun_awt_motif_MComponentPeer_pSetInnerForeground;
   9.281 -		#Java_sun_awt_motif_MComponentPeer_pSetScrollbarBackground;
   9.282 -		#Java_sun_awt_motif_MComponentPeer_setTargetBackground;
   9.283 -		#Java_sun_awt_motif_MDataTransferer_dragQueryFile;
   9.284 -		#Java_sun_awt_motif_MDataTransferer_getAtomForTarget;
   9.285 -		#Java_sun_awt_motif_MDataTransferer_getTargetNameForAtom;
   9.286 -		#Java_sun_awt_motif_MFileDialogPeer_insertReplaceFileDialogText;
   9.287 -		Java_sun_awt_motif_MFontPeer_initIDs;
   9.288 -		#Java_sun_awt_motif_MListPeer_setBackground;
   9.289 -		#Java_sun_awt_motif_MMenuBarPeer_initIDs;
   9.290 -		#Java_sun_awt_motif_MMenuBarPeer_pDispose;
   9.291 -		#Java_sun_awt_motif_MMenuItemPeer_getParent_1NoClientCode;
   9.292 -		#Java_sun_awt_motif_MMenuItemPeer_initIDs;
   9.293 -		#Java_sun_awt_motif_MMenuItemPeer_pSetShortcut;
   9.294 -		#Java_sun_awt_motif_MPopupMenuPeer_initIDs;
   9.295 -		#Java_sun_awt_motif_MScrollbarPeer_initIDs;
   9.296 -		#Java_sun_awt_motif_MScrollPanePeer_initIDs;
   9.297 -		#Java_sun_awt_motif_MTextAreaPeer_pSetCursor;
   9.298 -		Java_sun_awt_motif_MToolkit_shutdown;
   9.299 -		#Java_sun_awt_motif_MWindowPeer_initIDs;
   9.300 -		#Java_sun_awt_motif_MWindowPeer_pCreate;
   9.301 -		#Java_sun_awt_motif_MWindowPeer_wrapInSequenced;
   9.302 -		Java_sun_awt_motif_X11FontMetrics_initIDs;
   9.303 -		#Java_sun_awt_X11InputMethod_initIDs;
   9.304 -		#Java_sun_awt_motif_X11Selection_initIDs;
   9.305 -		Java_sun_awt_motif_MToolkitThreadBlockedHandler_enter;
   9.306 -		Java_sun_awt_motif_MToolkitThreadBlockedHandler_exit;
   9.307  		Java_sun_awt_X11GraphicsConfig_init;
   9.308  		Java_sun_awt_X11GraphicsConfig_initIDs;
   9.309  		Java_sun_awt_X11GraphicsConfig_makeColorModel;
    10.1 --- a/make/sun/awt/mapfile-vers-linux	Tue Dec 06 16:31:58 2011 -0800
    10.2 +++ b/make/sun/awt/mapfile-vers-linux	Mon Dec 19 10:06:23 2011 -0800
    10.3 @@ -170,7 +170,6 @@
    10.4  		GrPrim_Sg2dGetPixel;
    10.5  		GrPrim_Sg2dGetLCDTextContrast;
    10.6  
    10.7 -		#Java_sun_awt_motif_MComponentPeer_restoreFocus;
    10.8  		Java_sun_awt_DefaultMouseInfoPeer_fillPointWithCoords;
    10.9  		Java_sun_awt_DefaultMouseInfoPeer_isWindowUnderMouse;
   10.10  		Java_java_awt_AWTEvent_nativeSetSource;
   10.11 @@ -189,216 +188,11 @@
   10.12  		Java_java_awt_ScrollPane_initIDs;
   10.13  		Java_java_awt_TextArea_initIDs;
   10.14  		Java_sun_awt_FontDescriptor_initIDs;
   10.15 -		#Java_sun_awt_motif_MButtonPeer_create;
   10.16 -		#Java_sun_awt_motif_MButtonPeer_setLabel;
   10.17 -		#Java_sun_awt_motif_MCanvasPeer_create;
   10.18 -		#Java_sun_awt_motif_MCanvasPeer_initIDs;
   10.19 -		#Java_sun_awt_motif_MCanvasPeer_resetTargetGC;
   10.20 -		#Java_sun_awt_motif_MCheckboxMenuItemPeer_pSetState;
   10.21 -		#Java_sun_awt_motif_MCheckboxPeer_create;
   10.22 -		#Java_sun_awt_motif_MCheckboxPeer_setCheckboxGroup;
   10.23 -		#Java_sun_awt_motif_MCheckboxPeer_setLabel;
   10.24 -		#Java_sun_awt_motif_MCheckboxPeer_pSetState;
   10.25 -		#Java_sun_awt_motif_MCheckboxPeer_pGetState;
   10.26 -		#Java_sun_awt_motif_MChoicePeer_addItem;
   10.27 -		#Java_sun_awt_motif_MChoicePeer_appendItems;
   10.28 -		#Java_sun_awt_motif_MChoicePeer_create;
   10.29 -		#Java_sun_awt_motif_MChoicePeer_pReshape;
   10.30 -		#Java_sun_awt_motif_MChoicePeer_remove;
   10.31 -		#Java_sun_awt_motif_MChoicePeer_removeAll;
   10.32 -		#Java_sun_awt_motif_MChoicePeer_setBackground;
   10.33 -		#Java_sun_awt_motif_MChoicePeer_pSelect;
   10.34 -		#Java_sun_awt_motif_MChoicePeer_setFont;
   10.35 -		#Java_sun_awt_motif_MChoicePeer_setForeground;
   10.36 -		#Java_sun_awt_motif_MComponentPeer_addNativeDropTarget;
   10.37 -		#Java_sun_awt_motif_MComponentPeer_createBackBuffer;
   10.38 -		#Java_sun_awt_motif_MComponentPeer_destroyBackBuffer;
   10.39 -		#Java_sun_awt_motif_MComponentPeer_getNativeColor;
   10.40 -		#Java_sun_awt_motif_MComponentPeer_getWindow;
   10.41 -		#Java_sun_awt_motif_MComponentPeer_pDisable;
   10.42 -		#Java_sun_awt_motif_MComponentPeer_pDispose;
   10.43 -		#Java_sun_awt_motif_MComponentPeer_pEnable;
   10.44 -		#Java_sun_awt_motif_MComponentPeer_pGetLocationOnScreen;
   10.45 -		#Java_sun_awt_motif_MComponentPeer_pGetLocationOnScreen2;
   10.46 -		#Java_sun_awt_motif_MComponentPeer_pHide;
   10.47 -		#Java_sun_awt_motif_MComponentPeer_pInitialize;
   10.48 -		#Java_sun_awt_motif_MComponentPeer_pMakeCursorVisible;
   10.49 -		#Java_sun_awt_motif_MComponentPeer_pReshape;
   10.50 -		#Java_sun_awt_motif_MComponentPeer_pShow;
   10.51 -		#Java_sun_awt_motif_MComponentPeer_removeNativeDropTarget;
   10.52 -		#Java_sun_awt_motif_MComponentPeer_swapBuffers;
   10.53 -		#Java_sun_awt_motif_MComponentPeer_pSetBackground;
   10.54 -		#Java_sun_awt_motif_MComponentPeer_pSetFont;
   10.55 -                #Java_sun_awt_motif_MComponentPeer_processSynchronousLightweightTransfer;
   10.56 -                #Java_sun_awt_motif_MComponentPeer__1requestFocus;
   10.57 -		#Java_sun_awt_motif_MCheckboxMenuItemPeer_getState;
   10.58 -		#Java_sun_awt_motif_MComponentPeer_pSetForeground;
   10.59 -		#Java_sun_awt_motif_MDragSourceContextPeer_startDrag;
   10.60 -		#Java_sun_awt_motif_MDragSourceContextPeer_setNativeCursor;
   10.61 -		#Java_sun_awt_motif_MDropTargetContextPeer_addTransfer;
   10.62 -		#Java_sun_awt_motif_MDropTargetContextPeer_dropDone;
   10.63 -		#Java_sun_awt_motif_MDropTargetContextPeer_startTransfer;
   10.64 -		#Java_sun_awt_motif_X11DragSourceContextPeer_startDrag;
   10.65 -		#Java_sun_awt_motif_X11DragSourceContextPeer_setNativeCursor;
   10.66 -		#Java_sun_awt_motif_X11DropTargetContextPeer_sendResponse;
   10.67 -		#Java_sun_awt_motif_X11DropTargetContextPeer_dropDone;
   10.68 -		#Java_sun_awt_motif_X11DropTargetContextPeer_getData;
   10.69 -		#Java_sun_awt_motif_MEmbeddedFramePeer_NEFcreate;
   10.70 -		#Java_sun_awt_motif_MEmbeddedFramePeer_pShowImpl;
   10.71 -		#Java_sun_awt_motif_MEmbeddedFramePeer_pReshapePrivate;
   10.72 -		#Java_sun_awt_motif_MEmbeddedFramePeer_getBoundsPrivate;
   10.73 -		#Java_sun_awt_motif_MFramePeer_pSetIconImage___3B_3I_3SII;
   10.74 -		#Java_sun_awt_motif_MEmbeddedFramePeer_requestXEmbedFocus;
   10.75 -		#Java_sun_awt_motif_MEmbeddedFramePeer_isXEmbedApplicationActive;
   10.76 -		#Java_sun_awt_motif_MEmbeddedFramePeer_isXEmbedActive;
   10.77 -		#Java_sun_awt_motif_MEmbeddedFrame_getWidget;
   10.78 -		#Java_sun_awt_motif_MEmbeddedFrame_mapWidget;
   10.79 -		#Java_sun_awt_motif_MFileDialogPeer_create;
   10.80 -		#Java_sun_awt_motif_MFileDialogPeer_pDispose;
   10.81 -		#Java_sun_awt_motif_MFileDialogPeer_pHide;
   10.82 -		#Java_sun_awt_motif_MFileDialogPeer_pReshape;
   10.83 -		#Java_sun_awt_motif_MFileDialogPeer_pShow;
   10.84 -		#Java_sun_awt_motif_MFileDialogPeer_setFileEntry;
   10.85 -		#Java_sun_awt_motif_MFileDialogPeer_setFont;
   10.86 -		#Java_sun_awt_motif_MFramePeer_pGetIconSize;
   10.87 -		#Java_sun_awt_motif_MGlobalCursorManager_cacheInit;
   10.88 -		#Java_sun_awt_motif_MGlobalCursorManager_findComponentAt;
   10.89 -		#Java_sun_awt_motif_MGlobalCursorManager_findHeavyweightUnderCursor;
   10.90 -		#Java_sun_awt_motif_MGlobalCursorManager_getCursorPos;
   10.91 -		#Java_sun_awt_motif_MGlobalCursorManager_getLocationOnScreen;
   10.92 -		#Java_sun_awt_motif_MLabelPeer_create;
   10.93 -		#Java_sun_awt_motif_MLabelPeer_setAlignment;
   10.94 -		#Java_sun_awt_motif_MLabelPeer_setText;
   10.95 -		#Java_sun_awt_motif_MListPeer_addItem;
   10.96 -		#Java_sun_awt_motif_MListPeer_create;
   10.97 -		#Java_sun_awt_motif_MListPeer_delItems;
   10.98 -		#Java_sun_awt_motif_MListPeer_deselect;
   10.99 -		#Java_sun_awt_motif_MListPeer_isSelected;
  10.100 -		#Java_sun_awt_motif_MListPeer_makeVisible;
  10.101 -		#Java_sun_awt_motif_MListPeer_select;
  10.102 -		#Java_sun_awt_motif_MListPeer_setMultipleSelections;
  10.103 -		#Java_sun_awt_motif_MMenuBarPeer_create;
  10.104 -		#Java_sun_awt_motif_MMenuItemPeer_createMenuItem;
  10.105 -		#Java_sun_awt_motif_MMenuItemPeer_pDisable;
  10.106 -		#Java_sun_awt_motif_MMenuItemPeer_pDispose;
  10.107 -		#Java_sun_awt_motif_MMenuItemPeer_pEnable;
  10.108 -		#Java_sun_awt_motif_MMenuItemPeer_pSetLabel;
  10.109 -		#Java_sun_awt_motif_MMenuPeer_createMenu;
  10.110 -		#Java_sun_awt_motif_MMenuPeer_createSubMenu;
  10.111 -		#Java_sun_awt_motif_MMenuPeer_pDispose;
  10.112 -		#Java_sun_awt_motif_MPopupMenuPeer_createMenu;
  10.113 -		#Java_sun_awt_motif_MPopupMenuPeer_pDispose;
  10.114 -		#Java_sun_awt_motif_MPopupMenuPeer_pShow;
  10.115 -		#Java_sun_awt_motif_MRobotPeer_getRGBPixelsImpl;
  10.116 -		#Java_sun_awt_motif_MRobotPeer_keyPressImpl;
  10.117 -		#Java_sun_awt_motif_MRobotPeer_keyReleaseImpl;
  10.118 -		#Java_sun_awt_motif_MRobotPeer_mouseMoveImpl;
  10.119 -		#Java_sun_awt_motif_MRobotPeer_mousePressImpl;
  10.120 -		#Java_sun_awt_motif_MRobotPeer_mouseReleaseImpl;
  10.121 -		#Java_sun_awt_motif_MRobotPeer_mouseWheelImpl;
  10.122 -		#Java_sun_awt_motif_MRobotPeer_setup;
  10.123 -		#Java_sun_awt_motif_MScrollbarPeer_create;
  10.124 -		#Java_sun_awt_motif_MScrollbarPeer_setLineIncrement;
  10.125 -		#Java_sun_awt_motif_MScrollbarPeer_setPageIncrement;
  10.126 -		#Java_sun_awt_motif_MScrollbarPeer_pSetValues;
  10.127 -		#Java_sun_awt_motif_MScrollPanePeer_create;
  10.128 -		#Java_sun_awt_motif_MScrollPanePeer_pGetBlockIncrement;
  10.129 -		#Java_sun_awt_motif_MScrollPanePeer_pGetScrollbarSpace;
  10.130 -		#Java_sun_awt_motif_MScrollPanePeer_pGetShadow;
  10.131 -		#Java_sun_awt_motif_MScrollPanePeer_pInsets;
  10.132 -		#Java_sun_awt_motif_MScrollPanePeer_pSetIncrement;
  10.133 -		#Java_sun_awt_motif_MScrollPanePeer_pSetScrollChild;
  10.134 -		#Java_sun_awt_motif_MScrollPanePeer_setScrollPosition;
  10.135 -		#Java_sun_awt_motif_MTextAreaPeer_initIDs;
  10.136 -		#Java_sun_awt_motif_MTextAreaPeer_pCreate;
  10.137 -		#Java_sun_awt_motif_MTextAreaPeer_getCaretPosition;
  10.138 -		#Java_sun_awt_motif_MTextAreaPeer_getExtraHeight;
  10.139 -		#Java_sun_awt_motif_MTextAreaPeer_getExtraWidth;
  10.140 -		#Java_sun_awt_motif_MTextAreaPeer_getSelectionEnd;
  10.141 -		#Java_sun_awt_motif_MTextAreaPeer_getSelectionStart;
  10.142 -		#Java_sun_awt_motif_MTextAreaPeer_getText;
  10.143 -		#Java_sun_awt_motif_MTextAreaPeer_insert;
  10.144 -		#Java_sun_awt_motif_MTextAreaPeer_pMakeCursorVisible;
  10.145 -		#Java_sun_awt_motif_MTextAreaPeer_pSetEditable;
  10.146 -		#Java_sun_awt_motif_MTextAreaPeer_pShow2;
  10.147 -		#Java_sun_awt_motif_MTextAreaPeer_replaceRange;
  10.148 -		#Java_sun_awt_motif_MTextAreaPeer_select;
  10.149 -		#Java_sun_awt_motif_MTextAreaPeer_setCaretPosition;
  10.150 -		#Java_sun_awt_motif_MTextAreaPeer_setFont;
  10.151 -		#Java_sun_awt_motif_MTextAreaPeer_setText;
  10.152 -		#Java_sun_awt_motif_MTextAreaPeer_setTextBackground;
  10.153 -		#Java_sun_awt_motif_MTextFieldPeer_initIDs;
  10.154 -		#Java_sun_awt_motif_MTextFieldPeer_pCreate;
  10.155 -		#Java_sun_awt_motif_MTextFieldPeer_getCaretPosition;
  10.156 -		#Java_sun_awt_motif_MTextFieldPeer_getSelectionEnd;
  10.157 -		#Java_sun_awt_motif_MTextFieldPeer_getSelectionStart;
  10.158 -		#Java_sun_awt_motif_MTextFieldPeer_getText;
  10.159 -		#Java_sun_awt_motif_MTextFieldPeer_insertReplaceText;
  10.160 -		#Java_sun_awt_motif_MTextFieldPeer_preDispose;
  10.161 -		#Java_sun_awt_motif_MTextFieldPeer_pSetEditable;
  10.162 -		#Java_sun_awt_motif_MTextFieldPeer_select;
  10.163 -		#Java_sun_awt_motif_MTextFieldPeer_setCaretPosition;
  10.164 -		#Java_sun_awt_motif_MTextFieldPeer_setEchoChar;
  10.165 -		#Java_sun_awt_motif_MTextFieldPeer_setFont;
  10.166 -		#Java_sun_awt_motif_MTextFieldPeer_setText;
  10.167 -		Java_sun_awt_motif_MToolkit_beep;
  10.168 -		Java_sun_awt_motif_MToolkit_getLockingKeyStateNative;
  10.169 -		Java_sun_awt_motif_MToolkit_getMulticlickTime;
  10.170 -                Java_sun_awt_motif_MToolkit_getNumMouseButtons;
  10.171 -		Java_sun_awt_motif_MToolkit_getScreenHeight;
  10.172 -		Java_sun_awt_motif_MToolkit_getScreenResolution;
  10.173 -		Java_sun_awt_motif_MToolkit_getScreenWidth;
  10.174 -		Java_sun_awt_motif_MToolkit_init;
  10.175 -		Java_sun_awt_motif_MToolkit_isDynamicLayoutSupportedNative;
  10.176 -		Java_sun_awt_motif_MToolkit_isFrameStateSupported;
  10.177 -		Java_sun_awt_motif_MToolkit_loadSystemColors;
  10.178 -		Java_sun_awt_motif_MToolkit_makeColorModel;
  10.179 -		Java_sun_awt_motif_MToolkit_run;
  10.180 -		Java_sun_awt_motif_MToolkit_sync;
  10.181 -                Java_sun_awt_motif_MToolkit_isAlwaysOnTopSupported;
  10.182 -		Java_sun_awt_motif_MWindowAttributes_initIDs;
  10.183 -		#Java_sun_awt_motif_MWindowPeer_pDispose;
  10.184 -		#Java_sun_awt_motif_MWindowPeer_pHide;
  10.185 -		#Java_sun_awt_motif_MWindowPeer_pReshape;
  10.186 -		#Java_sun_awt_motif_MWindowPeer_pSetTitle;
  10.187 -		#Java_sun_awt_motif_MWindowPeer_pShow;
  10.188 -		#Java_sun_awt_motif_MWindowPeer_setResizable;
  10.189 -		#Java_sun_awt_motif_MWindowPeer_toBack;
  10.190 -		#Java_sun_awt_motif_MWindowPeer_addTextComponentNative;
  10.191 -		#Java_sun_awt_motif_MWindowPeer_getState;
  10.192 -		#Java_sun_awt_motif_MWindowPeer_pSetIMMOption;
  10.193 -		#Java_sun_awt_motif_MWindowPeer_pSetMenuBar;
  10.194 -		#Java_sun_awt_motif_MWindowPeer_pShowModal;
  10.195 -		#Java_sun_awt_motif_MWindowPeer_removeTextComponentNative;
  10.196 -		#Java_sun_awt_motif_MWindowPeer_setSaveUnder;
  10.197 -		#Java_sun_awt_motif_MWindowPeer_setState;
  10.198 -		#Java_sun_awt_motif_MWindowPeer_resetTargetGC;
  10.199 -		#Java_sun_awt_motif_MWindowPeer_registerX11DropTarget;
  10.200 -		#Java_sun_awt_motif_MWindowPeer_unregisterX11DropTarget;
  10.201 -                #Java_sun_awt_motif_MWindowPeer_updateAlwaysOnTop;
  10.202 -		#Java_sun_awt_motif_X11CustomCursor_cacheInit;
  10.203 -		#Java_sun_awt_motif_X11CustomCursor_createCursor;
  10.204 -		#Java_sun_awt_motif_X11CustomCursor_queryBestCursor;
  10.205 -		Java_sun_awt_motif_X11FontMetrics_bytesWidth;
  10.206 -		Java_sun_awt_motif_X11FontMetrics_getMFCharsWidth;
  10.207 -		Java_sun_awt_motif_X11FontMetrics_init;
  10.208  		Java_sun_awt_X11InputMethod_disposeXIC;
  10.209  		Java_sun_awt_X11InputMethod_isCompositionEnabledNative;
  10.210  		Java_sun_awt_X11InputMethod_resetXIC;
  10.211  		Java_sun_awt_X11InputMethod_setCompositionEnabledNative;
  10.212  		Java_sun_awt_X11InputMethod_turnoffStatusWindow;
  10.213 -		#Java_sun_awt_motif_MInputMethod_openXIMNative;
  10.214 -		#Java_sun_awt_motif_MInputMethod_configureStatusAreaNative;
  10.215 -		#Java_sun_awt_motif_MInputMethod_createXICNative;
  10.216 -		#Java_sun_awt_motif_MInputMethod_reconfigureXICNative;
  10.217 -		#Java_sun_awt_motif_MInputMethod_setXICFocusNative;
  10.218 -		#Java_sun_awt_motif_X11Clipboard_getClipboardData;
  10.219 -		#Java_sun_awt_motif_X11Clipboard_getClipboardFormats;
  10.220 -		#Java_sun_awt_motif_X11Clipboard_registerClipboardViewer;
  10.221 -		#Java_sun_awt_motif_X11Clipboard_unregisterClipboardViewer;
  10.222 -		#Java_sun_awt_motif_X11Selection_init;
  10.223 -		#Java_sun_awt_motif_X11Selection_pGetSelectionOwnership;
  10.224 -		#Java_sun_awt_motif_X11Selection_clearNativeContext;
  10.225  		Java_sun_awt_SunToolkit_closeSplashScreen;
  10.226  		Java_sun_awt_PlatformFont_initIDs;
  10.227  		Java_sun_awt_X11GraphicsConfig_init;
  10.228 @@ -444,42 +238,7 @@
  10.229  		Java_java_awt_Insets_initIDs;
  10.230  		Java_java_awt_TextField_initIDs;
  10.231  		Java_java_awt_Window_initIDs;
  10.232 -		#Java_sun_awt_motif_MCheckboxPeer_getIndicatorSize;
  10.233 -		#Java_sun_awt_motif_MCheckboxPeer_getSpacing;
  10.234 -		#Java_sun_awt_motif_MChoicePeer_freeNativeData;
  10.235 -		#Java_sun_awt_motif_MComponentPeer_getComponents_1NoClientCode;
  10.236 -		#Java_sun_awt_motif_MComponentPeer_getParent_1NoClientCode;
  10.237 -		#Java_sun_awt_motif_MComponentPeer_initIDs;
  10.238 -		#Java_sun_awt_motif_MComponentPeer_nativeHandleEvent;
  10.239 -		#Java_sun_awt_motif_MComponentPeer_pSetCursor;
  10.240 -		#Java_sun_awt_motif_MComponentPeer_pSetInnerForeground;
  10.241 -		#Java_sun_awt_motif_MComponentPeer_pSetScrollbarBackground;
  10.242 -		#Java_sun_awt_motif_MComponentPeer_setTargetBackground;
  10.243 -		#Java_sun_awt_motif_MDataTransferer_dragQueryFile;
  10.244 -		#Java_sun_awt_motif_MDataTransferer_getAtomForTarget;
  10.245 -		#Java_sun_awt_motif_MDataTransferer_getTargetNameForAtom;
  10.246 -		#Java_sun_awt_motif_MFileDialogPeer_insertReplaceFileDialogText;
  10.247 -		Java_sun_awt_motif_MFontPeer_initIDs;
  10.248 -		#Java_sun_awt_motif_MListPeer_setBackground;
  10.249 -		#Java_sun_awt_motif_MMenuBarPeer_initIDs;
  10.250 -		#Java_sun_awt_motif_MMenuBarPeer_pDispose;
  10.251 -		#Java_sun_awt_motif_MMenuItemPeer_getParent_1NoClientCode;
  10.252 -		#Java_sun_awt_motif_MMenuItemPeer_initIDs;
  10.253 -		#Java_sun_awt_motif_MMenuItemPeer_pSetShortcut;
  10.254 -		#Java_sun_awt_motif_MPopupMenuPeer_initIDs;
  10.255 -		#Java_sun_awt_motif_MScrollbarPeer_initIDs;
  10.256 -		#Java_sun_awt_motif_MScrollPanePeer_initIDs;
  10.257 -		#Java_sun_awt_motif_MTextAreaPeer_pSetCursor;
  10.258 -		Java_sun_awt_motif_MToolkit_shutdown;
  10.259 -		#Java_sun_awt_motif_MWindowPeer_initIDs;
  10.260 -		#Java_sun_awt_motif_MWindowPeer_pCreate;
  10.261 -		#Java_sun_awt_motif_MWindowPeer_wrapInSequenced;
  10.262 -		Java_sun_awt_motif_X11FontMetrics_initIDs;
  10.263 -		#Java_sun_awt_X11InputMethod_initIDs;
  10.264  		Java_sun_awt_motif_X11OffScreenImage_updateBitmask;
  10.265 -		#Java_sun_awt_motif_X11Selection_initIDs;
  10.266 -		Java_sun_awt_motif_MToolkitThreadBlockedHandler_enter;
  10.267 -		Java_sun_awt_motif_MToolkitThreadBlockedHandler_exit;
  10.268  		Java_sun_awt_X11GraphicsConfig_init;
  10.269  		Java_sun_awt_X11GraphicsConfig_initIDs;
  10.270  		Java_sun_awt_X11GraphicsConfig_makeColorModel;
  10.271 @@ -505,26 +264,6 @@
  10.272  		Java_sun_awt_X11SurfaceData_isDgaAvailable;
  10.273  		Java_sun_awt_X11SurfaceData_setInvalid;
  10.274  		Java_sun_awt_X11SurfaceData_flushNativeSurface;
  10.275 -                #Java_sun_awt_motif_MEmbedCanvasPeer_initXEmbedServer;
  10.276 -                #Java_sun_awt_motif_MEmbedCanvasPeer_destroyXEmbedServer;
  10.277 -                #Java_sun_awt_motif_MEmbedCanvasPeer_isXEmbedActive;
  10.278 -                #Java_sun_awt_motif_MEmbedCanvasPeer_initDispatching;
  10.279 -                #Java_sun_awt_motif_MEmbedCanvasPeer_endDispatching;
  10.280 -                #Java_sun_awt_motif_MEmbedCanvasPeer_embedChild;
  10.281 -                #Java_sun_awt_motif_MEmbedCanvasPeer_childDestroyed;
  10.282 -                #Java_sun_awt_motif_MEmbedCanvasPeer_getEmbedPreferredSize;
  10.283 -                #Java_sun_awt_motif_MEmbedCanvasPeer_getEmbedMinimumSize;
  10.284 -                #Java_sun_awt_motif_MEmbedCanvasPeer_getClientBounds;
  10.285 -                #Java_sun_awt_motif_MEmbedCanvasPeer_notifyChildEmbedded;
  10.286 -                #Java_sun_awt_motif_MEmbedCanvasPeer_detachChild;
  10.287 -                #Java_sun_awt_motif_MEmbedCanvasPeer_forwardKeyEvent;
  10.288 -                #Java_sun_awt_motif_MEmbedCanvasPeer_getAWTKeyCodeForKeySym;
  10.289 -                #Java_sun_awt_motif_MEmbedCanvasPeer_sendMessage__I;
  10.290 -                #Java_sun_awt_motif_MEmbedCanvasPeer_sendMessage__IJJJ;
  10.291 -                #Java_sun_awt_motif_MEmbedCanvasPeer_getWindow;       
  10.292 -                #Java_sun_awt_motif_MEmbedCanvasPeer_forwardEventToEmbedded;       
  10.293 -                #Java_sun_awt_motif_GrabbedKey_initKeySymAndModifiers;
  10.294 -                #Java_sun_awt_motif_MEmbeddedFramePeer_traverseOut;
  10.295  		awt_display;
  10.296  		awt_lock;
  10.297  		awt_Lock;
    11.1 --- a/make/sun/awt/mawt.gmk	Tue Dec 06 16:31:58 2011 -0800
    11.2 +++ b/make/sun/awt/mawt.gmk	Mon Dec 19 10:06:23 2011 -0800
    11.3 @@ -41,13 +41,7 @@
    11.4  # Check which C files should be built.  Headless uses only
    11.5  # non-motif files.  Also, a version-specific motif file is
    11.6  # compiled based on the motif version.
    11.7 -ifdef HEADLESS
    11.8 -  FILES_c = $(FILES_NO_MOTIF_c)
    11.9 -else
   11.10 -#  FILES_c = $(FILES_MOTIF_c) $(FILES_NO_MOTIF_c)
   11.11 -#  XXX if in FILES_MOTIF_c there are unrelated to motif stuff, create a separate list!
   11.12 -  FILES_c = $(FILES_NO_MOTIF_c)
   11.13 -endif
   11.14 +FILES_c = $(FILES_NO_MOTIF_c)
   11.15  
   11.16  ifeq ($(PLATFORM), solaris)
   11.17    ifneq ($(ARCH), amd64)
   11.18 @@ -116,32 +110,6 @@
   11.19  CPPFLAGS += -DHEADLESS=$(HEADLESS)
   11.20  OTHER_LDLIBS =
   11.21  else
   11.22 -#CFLAGS += -DMOTIF_VERSION=$(MOTIF_VERSION)
   11.23 -
   11.24 -#ifeq ($(STATIC_MOTIF),true)
   11.25 -#    LIBXM = $(MOTIF_LIB)/libXm.a -lXp -lXmu
   11.26 -#    ifeq ($(PLATFORM), linux)
   11.27 -#	ifeq ($(ARCH_DATA_MODEL), 64)
   11.28 -#            LIBXT = -lXt
   11.29 -#        else
   11.30 -#        # Allows for builds on Debian GNU Linux, X11 is in a different place 
   11.31 -#	    LIBXT = $(firstword $(wildcard /usr/X11R6/lib/libXt.a) \
   11.32 -#                            $(wildcard /usr/lib/libXt.a))
   11.33 -#	    LIBSM = $(firstword $(wildcard /usr/X11R6/lib/libSM.a) \
   11.34 -#                            $(wildcard /usr/lib/libSM.a))
   11.35 -#	    LIBICE = $(firstword $(wildcard /usr/X11R6/lib/libICE.a) \
   11.36 -#                             $(wildcard /usr/lib/libICE.a))
   11.37 -#	endif
   11.38 -#    endif
   11.39 -#else
   11.40 -#    LIBXM = -L$(MOTIF_LIB) -lXm -lXp
   11.41 -#    ifeq ($(PLATFORM), linux)
   11.42 -#	LIBXT = -lXt
   11.43 -#	LIBSM = 
   11.44 -#	LIBICE = 
   11.45 -#    endif
   11.46 -#endif
   11.47 -
   11.48  LIBXTST = -lXtst
   11.49  ifeq ($(PLATFORM), linux)
   11.50     ifeq ($(ARCH_DATA_MODEL), 64)
    12.1 --- a/make/sun/motif12/reorder-i586	Tue Dec 06 16:31:58 2011 -0800
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,216 +0,0 @@
    12.4 -data = R0x2000;
    12.5 -text = LOAD ?RXO;
    12.6 -# Test Null
    12.7 -# Test Exit
    12.8 -# Test Hello
    12.9 -# Test Sleep
   12.10 -# Test IntToString
   12.11 -# Test LoadToolkit
   12.12 -text: .text%JNI_OnLoad;
   12.13 -text: .text%awt_util_debug_init;
   12.14 -text: .text%Java_sun_awt_X11GraphicsEnvironment_initDisplay;
   12.15 -text: .text%awt_init_Display;
   12.16 -text: .text%makeDefaultConfig: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_GraphicsEnv.o;
   12.17 -text: .text%awt_allocate_colors;
   12.18 -text: .text%alloc_col: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11Color.o;
   12.19 -text: .text%getVirtCubeSize;
   12.20 -text: .text%uname: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11Color.o;
   12.21 -text: .text%Java_sun_awt_font_NativeFontWrapper_getFontPath;
   12.22 -text: .text%getPlatformFontPathChars: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o;
   12.23 -text: .text%getSolarisFontLocations: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o;
   12.24 -text: .text%fstat: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o;
   12.25 -text: .text%AppendFont: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o;
   12.26 -text: .text%freePlatformFontPathChars: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o;
   12.27 -text: .text%checkFont: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_Font.o;
   12.28 -text: .text%Java_sun_awt_X11GraphicsEnvironment_getNativeFonts;
   12.29 -text: .text%Java_sun_awt_font_NativeFontWrapper_setNativeFontPath;
   12.30 -text: .text%isDisplayLocal;
   12.31 -text: .text%Java_sun_awt_X11GraphicsEnvironment_checkShmExt;
   12.32 -text: .text%TryInitMITShm: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_GraphicsEnv.o;
   12.33 -text: .text%awt_output_flush;
   12.34 -text: .text%awtJNI_TimeMillis: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
   12.35 -text: .text%AddFontsToX11FontPath: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o;
   12.36 -text: .text%Java_sun_awt_X11GraphicsEnvironment_getNumScreens;
   12.37 -text: .text%Java_sun_awt_X11GraphicsEnvironment_getDefaultScreenNum;
   12.38 -text: .text%Java_sun_awt_X11GraphicsDevice_getConfigVisualId;
   12.39 -text: .text%Java_sun_awt_X11GraphicsDevice_isDBESupported;
   12.40 -text: .text%Java_sun_awt_X11GraphicsDevice_getDoubleBufferVisuals;
   12.41 -text: .text%Java_sun_awt_X11GraphicsConfig_initIDs;
   12.42 -text: .text%Java_sun_awt_X11GraphicsConfig_init;
   12.43 -text: .text%getAllConfigs: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_GraphicsEnv.o;
   12.44 -text: .text%Java_sun_awt_motif_MToolkit_init;
   12.45 -text: .text%getDefaultConfig;
   12.46 -text: .text%getScreenData;
   12.47 -text: .text%Java_sun_awt_PlatformFont_initIDs;
   12.48 -text: .text%Java_sun_awt_motif_MFontPeer_initIDs;
   12.49 -text: .text%awt_wm_init;
   12.50 -text: .text%awt_wm_initAtoms: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
   12.51 -text: .text%awt_wm_getRunningWM;
   12.52 -text: .text%xerror_detect_wm: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
   12.53 -text: .text%awt_wm_prepareIsIceWM: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
   12.54 -text: .text%awt_wm_isNetSupporting: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
   12.55 -text: .text%awt_wm_checkAnchor: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
   12.56 -text: .text%awt_getProperty32: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
   12.57 -text: .text%awt_wm_isWinSupporting: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
   12.58 -text: .text%awt_wm_isIceWM: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
   12.59 -text: .text%awt_wm_isEnlightenment: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
   12.60 -text: .text%awt_getECommsWindowIDProperty: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
   12.61 -text: .text%awt_wm_isSawfish: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
   12.62 -text: .text%awt_wm_isNetWMName: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
   12.63 -text: .text%awt_wm_isKDE2: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
   12.64 -text: .text%awt_wm_isCDE: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
   12.65 -text: .text%awt_color_match;
   12.66 -text: .text%setup_modifier_map: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
   12.67 -text: .text%set_mod_mask: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
   12.68 -text: .text%awt_initialize_DataTransferer;
   12.69 -text: .text%awt_initialize_Xm_DnD;
   12.70 -text: .text%cacheDropDone: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_XmDnD.o;
   12.71 -text: .text%awt_motif_enableSingleDragInitiator;
   12.72 -text: .text%Java_java_awt_Cursor_initIDs;
   12.73 -text: .text%Java_sun_awt_motif_X11CustomCursor_cacheInit;
   12.74 -text: .text%Java_sun_awt_motif_MToolkit_run;
   12.75 -text: .text%awtJNI_GetCurrentThread;
   12.76 -text: .text%awt_MToolkit_loop: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
   12.77 -text: .text%awt_pipe_init: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
   12.78 -text: .text%awt_set_poll_timeout: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
   12.79 -text: .text%awt_events_pending: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
   12.80 -text: .text%processOneEvent: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
   12.81 -text: .text%set_toolkit_busy;
   12.82 -text: .text%waitForEvents;
   12.83 -text: .text%performPoll: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
   12.84 -text: .text%awt_get_poll_timeout: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
   12.85 -text: .text%awtJNI_CleanupGlobalRefs;
   12.86 -text: .text%Java_java_awt_AWTEvent_initIDs;
   12.87 -text: .text%Java_sun_awt_SunToolkit_wakeupEventQueue;
   12.88 -text: .text%Java_sun_awt_motif_MToolkit_shutdown;
   12.89 -text: .text%X11SD_LibDispose;
   12.90 -text: .text%LibDisposeStub: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
   12.91 -# Test LoadFrame
   12.92 -text: .text%Java_java_awt_Component_initIDs;
   12.93 -text: .text%Java_java_awt_Container_initIDs;
   12.94 -text: .text%Java_java_awt_Window_initIDs;
   12.95 -text: .text%Java_java_awt_Frame_initIDs;
   12.96 -text: .text%Java_sun_awt_SunToolkit_getPrivateKey;
   12.97 -text: .text%Java_java_awt_MenuComponent_initIDs;
   12.98 -text: .text%Java_sun_awt_X11GraphicsConfig_pGetBounds;
   12.99 -text: .text%Java_java_awt_Insets_initIDs;
  12.100 -text: .text%Java_sun_awt_motif_MComponentPeer_initIDs;
  12.101 -text: .text%Java_sun_awt_motif_MWindowPeer_initIDs;
  12.102 -text: .text%Java_sun_awt_motif_MWindowAttributes_initIDs;
  12.103 -text: .text%Java_sun_awt_motif_MWindowPeer_pCreate;
  12.104 -text: .text%awtJNI_CreateAndSetGlobalRef;
  12.105 -text: .text%copyGraphicsConfigToPeer;
  12.106 -text: .text%awt_Frame_guessInsets;
  12.107 -text: .text%awtJNI_ChangeInsets: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
  12.108 -text: .text%getMotifFontList;
  12.109 -text: .text%getMotifFontStruct;
  12.110 -text: .text%setDeleteCallback: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
  12.111 -text: .text%awt_canvas_create;
  12.112 -text: .text%awt_util_show;
  12.113 -text: .text%addTopLevel;
  12.114 -text: .text%Java_sun_awt_motif_MWindowPeer_pHide;
  12.115 -text: .text%Java_sun_awt_motif_MComponentPeer_pInitialize;
  12.116 -text: .text%awt_addWidget;
  12.117 -text: .text%Java_sun_awt_motif_MComponentPeer_pSetCursor;
  12.118 -text: .text%getCursor;
  12.119 -text: .text%awt_util_setCursor;
  12.120 -text: .text%Java_sun_awt_motif_MComponentPeer_getParent_1NoClientCode;
  12.121 -text: .text%Java_sun_awt_motif_MWindowPeer_pReshape;
  12.122 -text: .text%reshape: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
  12.123 -text: .text%awtJNI_setMbAndWwHeightAndOffsets: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
  12.124 -text: .text%awt_wm_configureGravityBuggy;
  12.125 -text: .text%Java_sun_awt_X11SurfaceData_initIDs;
  12.126 -text: .text%Java_sun_awt_motif_MToolkit_loadSystemColors;
  12.127 -text: .text%colorToRGB: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
  12.128 -text: .text%awt_allocate_systemcolors;
  12.129 -text: .text%Java_sun_awt_X11GraphicsConfig_makeColorModel;
  12.130 -text: .text%awtJNI_GetColorModel;
  12.131 -text: .text%Java_sun_awt_X11SurfaceData_initOps;
  12.132 -text: .text%Java_sun_awt_motif_MWindowPeer_pSetTitle;
  12.133 -text: .text%Java_sun_awt_motif_MWindowPeer_setResizable;
  12.134 -text: .text%Java_java_awt_Font_initIDs;
  12.135 -text: .text%Java_sun_awt_motif_MComponentPeer_pSetFont;
  12.136 -text: .text%awt_util_mapChildren;
  12.137 -text: .text%changeFont: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_Component.o;
  12.138 -text: .text%Java_sun_awt_motif_MComponentPeer_pSetBackground;
  12.139 -text: .text%getGraphicsConfigFromComponentPeer;
  12.140 -text: .text%awtJNI_GetColorForVis;
  12.141 -text: .text%ColorProc;
  12.142 -text: .text%Java_sun_awt_motif_MComponentPeer_pSetForeground;
  12.143 -text: .text%Java_sun_awt_motif_MWindowPeer_pShow;
  12.144 -text: .text%Java_sun_awt_motif_MWindowPeer_pShowModal;
  12.145 -text: .text%awt_wm_setExtendedState;
  12.146 -text: .text%awt_wm_doStateProtocolNet: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
  12.147 -text: .text%awt_wm_doStateProtocolWin: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
  12.148 -text: .text%awt_wm_setShellDecor;
  12.149 -text: .text%awt_wm_setMotifDecor: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
  12.150 -text: .text%awt_wm_setOLDecor: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
  12.151 -text: .text%awt_wm_normalizeMotifDecor: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
  12.152 -text: .text%awt_wm_removeSizeHints;
  12.153 -text: .text%shellEH: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
  12.154 -text: .text%awt_wm_isStateChange;
  12.155 -text: .text%awt_wm_getWMState;
  12.156 -text: .text%Java_sun_awt_motif_MGlobalCursorManager_cacheInit;
  12.157 -text: .text%innerCanvasEH: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
  12.158 -text: .text%reconfigureOuterCanvas: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
  12.159 -text: .text%outerCanvasResizeCB: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
  12.160 -text: .text%Java_sun_awt_motif_MGlobalCursorManager_findHeavyweightUnderCursor;
  12.161 -text: .text%awt_wm_getInsetsFromProp;
  12.162 -text: .text%syncTopLevelPos;
  12.163 -text: .text%raiseInputMethodWindow;
  12.164 -text: .text%awt_wm_getExtendedState: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
  12.165 -text: .text%awt_canvas_event_handler;
  12.166 -text: .text%awt_canvas_handleEvent;
  12.167 -text: .text%HandleExposeEvent: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/canvas.o;
  12.168 -text: .text%checkForExpose: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/canvas.o;
  12.169 -text: .text%expandDamageRect: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/canvas.o;
  12.170 -text: .text%getCurComponent;
  12.171 -text: .text%Java_java_awt_KeyboardFocusManager_initIDs;
  12.172 -text: .text%Java_java_awt_event_InputEvent_initIDs;
  12.173 -text: .text%Java_java_awt_event_KeyEvent_initIDs;
  12.174 -text: .text%Java_java_awt_AWTKeyStroke_allocateNewInstance;
  12.175 -text: .text%Java_sun_awt_motif_MComponentPeer_nativeHandleEvent;
  12.176 -text: .text%Java_java_awt_Event_initIDs;
  12.177 -# Test LoadJFrame
  12.178 -text: .text%Java_sun_awt_motif_MToolkit_getScreenWidth;
  12.179 -text: .text%Java_sun_awt_motif_MToolkit_getScreenHeight;
  12.180 -text: .text%X11SD_Lock: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
  12.181 -text: .text%X11SD_InitWindow: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
  12.182 -text: .text%GetLockStub: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
  12.183 -text: .text%X11SD_GetRasInfo: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
  12.184 -text: .text%X11SD_Unlock: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
  12.185 -text: .text%X11SD_InitClip: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
  12.186 -text: .text%XRequestSentStub: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
  12.187 -# Test JHello
  12.188 -text: .text%AWTLoadFont;
  12.189 -text: .text%AWTFontMaxByte1;
  12.190 -text: .text%AWTFontMaxCharOrByte2;
  12.191 -text: .text%AWTFontMaxBounds;
  12.192 -text: .text%AWTCharAscent;
  12.193 -text: .text%AWTCharDescent;
  12.194 -text: .text%AWTCharWidth;
  12.195 -text: .text%AWTFontMinByte1;
  12.196 -text: .text%AWTFontMinCharOrByte2;
  12.197 -text: .text%AWTFontPerChar;
  12.198 -text: .text%AWTCharRBearing;
  12.199 -text: .text%AWTCharLBearing;
  12.200 -text: .text%Java_sun_awt_X11SurfaceData_setInvalid;
  12.201 -text: .text%Java_sun_awt_X11SurfaceData_nativeDispose;
  12.202 -text: .text%X11SurfaceData_GetOps;
  12.203 -# SwingSet
  12.204 -text: .text%Java_sun_awt_motif_MWindowPeer_setSaveUnder;
  12.205 -text: .text%Java_sun_awt_motif_MCanvasPeer_create;
  12.206 -text: .text%awt_util_insertCallback;
  12.207 -text: .text%Java_sun_awt_motif_MComponentPeer_getComponents_1NoClientCode;
  12.208 -text: .text%Java_sun_awt_motif_MComponentPeer_pReshape;
  12.209 -text: .text%awt_util_reshape;
  12.210 -text: .text%Java_sun_awt_motif_MComponentPeer_pShow;
  12.211 -text: .text%Java_sun_awt_motif_MDataTransferer_getAtomForTarget;
  12.212 -text: .text%Java_sun_awt_motif_MComponentPeer_addNativeDropTarget;
  12.213 -text: .text%register_drop_site;
  12.214 -text: .text%update_drop_site_hierarchy: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_XmDnD.o;
  12.215 -text: .text%AWTFontDefaultChar;
  12.216 -text: .text%AWTFontGenerateImage;
  12.217 -text: .text%CreatePixmapAndGC;
  12.218 -text: .text%isAncestor;
  12.219 -text: .text%xerror_handler;
    13.1 --- a/make/sun/motif12/reorder-sparc	Tue Dec 06 16:31:58 2011 -0800
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,212 +0,0 @@
    13.4 -data = R0x2000;
    13.5 -text = LOAD ?RXO;
    13.6 -# Test Null
    13.7 -# Test Exit
    13.8 -# Test Hello
    13.9 -# Test Sleep
   13.10 -# Test IntToString
   13.11 -# Test LoadToolkit
   13.12 -text: .text%JNI_OnLoad;
   13.13 -text: .text%awt_util_debug_init;
   13.14 -text: .text%Java_sun_awt_X11GraphicsEnvironment_initDisplay;
   13.15 -text: .text%awt_init_Display;
   13.16 -text: .text%makeDefaultConfig: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_GraphicsEnv.o;
   13.17 -text: .text%awt_allocate_colors;
   13.18 -text: .text%Java_sun_awt_font_NativeFontWrapper_getFontPath;
   13.19 -text: .text%getPlatformFontPathChars: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o;
   13.20 -text: .text%getSolarisFontLocations: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o;
   13.21 -text: .text%AppendFont: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o;
   13.22 -text: .text%freePlatformFontPathChars: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o;
   13.23 -text: .text%checkFont: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_Font.o;
   13.24 -text: .text%Java_sun_awt_X11GraphicsEnvironment_getNativeFonts;
   13.25 -text: .text%Java_sun_awt_font_NativeFontWrapper_setNativeFontPath;
   13.26 -text: .text%isDisplayLocal;
   13.27 -text: .text%Java_sun_awt_X11GraphicsEnvironment_checkShmExt;
   13.28 -text: .text%TryInitMITShm: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_GraphicsEnv.o;
   13.29 -text: .text%awt_output_flush;
   13.30 -text: .text%awtJNI_TimeMillis: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
   13.31 -text: .text%AddFontsToX11FontPath: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/fontpath.o;
   13.32 -text: .text%Java_sun_awt_X11GraphicsEnvironment_getNumScreens;
   13.33 -text: .text%Java_sun_awt_X11GraphicsEnvironment_getDefaultScreenNum;
   13.34 -text: .text%Java_sun_awt_X11GraphicsDevice_getConfigVisualId;
   13.35 -text: .text%Java_sun_awt_X11GraphicsDevice_isDBESupported;
   13.36 -text: .text%Java_sun_awt_X11GraphicsDevice_getDoubleBufferVisuals;
   13.37 -text: .text%Java_sun_awt_X11GraphicsConfig_initIDs;
   13.38 -text: .text%Java_sun_awt_X11GraphicsConfig_init;
   13.39 -text: .text%getAllConfigs: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_GraphicsEnv.o;
   13.40 -text: .text%Java_sun_awt_motif_MToolkit_init;
   13.41 -text: .text%getDefaultConfig;
   13.42 -text: .text%getScreenData;
   13.43 -text: .text%Java_sun_awt_PlatformFont_initIDs;
   13.44 -text: .text%Java_sun_awt_motif_MFontPeer_initIDs;
   13.45 -text: .text%awt_wm_init;
   13.46 -text: .text%awt_wm_initAtoms: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
   13.47 -text: .text%awt_wm_getRunningWM;
   13.48 -text: .text%xerror_detect_wm: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
   13.49 -text: .text%awt_wm_prepareIsIceWM: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
   13.50 -text: .text%awt_wm_isNetSupporting: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
   13.51 -text: .text%awt_wm_checkAnchor: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
   13.52 -text: .text%awt_getProperty32: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
   13.53 -text: .text%awt_wm_isWinSupporting: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
   13.54 -text: .text%awt_wm_isIceWM: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
   13.55 -text: .text%awt_wm_isEnlightenment: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
   13.56 -text: .text%awt_getECommsWindowIDProperty: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
   13.57 -text: .text%awt_wm_isSawfish: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
   13.58 -text: .text%awt_wm_isNetWMName: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
   13.59 -text: .text%awt_wm_isKDE2: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
   13.60 -text: .text%awt_wm_isCDE: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
   13.61 -text: .text%awt_color_matchTC;
   13.62 -text: .text%setup_modifier_map: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
   13.63 -text: .text%set_mod_mask: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
   13.64 -text: .text%awt_initialize_DataTransferer;
   13.65 -text: .text%awt_initialize_Xm_DnD;
   13.66 -text: .text%cacheDropDone: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_XmDnD.o;
   13.67 -text: .text%awt_motif_enableSingleDragInitiator;
   13.68 -text: .text%Java_java_awt_Cursor_initIDs;
   13.69 -text: .text%Java_sun_awt_motif_X11CustomCursor_cacheInit;
   13.70 -text: .text%Java_sun_awt_motif_MToolkit_run;
   13.71 -text: .text%awtJNI_GetCurrentThread;
   13.72 -text: .text%awt_MToolkit_loop: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
   13.73 -text: .text%awt_pipe_init: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
   13.74 -text: .text%awt_set_poll_timeout: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
   13.75 -text: .text%awt_events_pending: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
   13.76 -text: .text%processOneEvent: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
   13.77 -text: .text%set_toolkit_busy;
   13.78 -text: .text%waitForEvents;
   13.79 -text: .text%performPoll: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
   13.80 -text: .text%awt_get_poll_timeout: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
   13.81 -text: .text%awtJNI_CleanupGlobalRefs;
   13.82 -text: .text%Java_java_awt_AWTEvent_initIDs;
   13.83 -text: .text%Java_sun_awt_SunToolkit_wakeupEventQueue;
   13.84 -text: .text%Java_sun_awt_motif_MToolkit_shutdown;
   13.85 -text: .text%X11SD_LibDispose;
   13.86 -text: .text%LibDisposeStub: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
   13.87 -# Test LoadFrame
   13.88 -text: .text%Java_java_awt_Component_initIDs;
   13.89 -text: .text%Java_java_awt_Container_initIDs;
   13.90 -text: .text%Java_java_awt_Window_initIDs;
   13.91 -text: .text%Java_java_awt_Frame_initIDs;
   13.92 -text: .text%Java_sun_awt_SunToolkit_getPrivateKey;
   13.93 -text: .text%Java_java_awt_MenuComponent_initIDs;
   13.94 -text: .text%Java_sun_awt_X11GraphicsConfig_pGetBounds;
   13.95 -text: .text%Java_java_awt_Insets_initIDs;
   13.96 -text: .text%Java_sun_awt_motif_MComponentPeer_initIDs;
   13.97 -text: .text%Java_sun_awt_motif_MWindowPeer_initIDs;
   13.98 -text: .text%Java_sun_awt_motif_MWindowAttributes_initIDs;
   13.99 -text: .text%Java_sun_awt_motif_MWindowPeer_pCreate;
  13.100 -text: .text%awtJNI_CreateAndSetGlobalRef;
  13.101 -text: .text%copyGraphicsConfigToPeer;
  13.102 -text: .text%awt_Frame_guessInsets;
  13.103 -text: .text%awtJNI_ChangeInsets: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
  13.104 -text: .text%getMotifFontList;
  13.105 -text: .text%getMotifFontStruct;
  13.106 -text: .text%setDeleteCallback: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
  13.107 -text: .text%ColorProc;
  13.108 -text: .text%awt_canvas_create;
  13.109 -text: .text%awt_util_show;
  13.110 -text: .text%addTopLevel;
  13.111 -text: .text%Java_sun_awt_motif_MWindowPeer_pHide;
  13.112 -text: .text%Java_sun_awt_motif_MComponentPeer_pInitialize;
  13.113 -text: .text%awt_addWidget;
  13.114 -text: .text%Java_sun_awt_motif_MComponentPeer_pSetCursor;
  13.115 -text: .text%getCursor;
  13.116 -text: .text%awt_util_setCursor;
  13.117 -text: .text%Java_sun_awt_motif_MComponentPeer_getParent_1NoClientCode;
  13.118 -text: .text%Java_sun_awt_motif_MWindowPeer_pReshape;
  13.119 -text: .text%reshape: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
  13.120 -text: .text%awtJNI_setMbAndWwHeightAndOffsets: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
  13.121 -text: .text%awt_wm_configureGravityBuggy;
  13.122 -text: .text%Java_sun_awt_X11SurfaceData_initIDs;
  13.123 -text: .text%Java_sun_awt_motif_MToolkit_loadSystemColors;
  13.124 -text: .text%colorToRGB: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_MToolkit.o;
  13.125 -text: .text%Java_sun_awt_X11GraphicsConfig_makeColorModel;
  13.126 -text: .text%awtJNI_GetColorModel;
  13.127 -text: .text%Java_sun_awt_X11SurfaceData_initOps;
  13.128 -text: .text%Java_sun_awt_motif_MWindowPeer_pSetTitle;
  13.129 -text: .text%Java_sun_awt_motif_MWindowPeer_setResizable;
  13.130 -text: .text%Java_java_awt_Font_initIDs;
  13.131 -text: .text%Java_sun_awt_motif_MComponentPeer_pSetFont;
  13.132 -text: .text%awt_util_mapChildren;
  13.133 -text: .text%changeFont: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_Component.o;
  13.134 -text: .text%Java_sun_awt_motif_MComponentPeer_pSetBackground;
  13.135 -text: .text%getGraphicsConfigFromComponentPeer;
  13.136 -text: .text%awtJNI_GetColorForVis;
  13.137 -text: .text%Java_sun_awt_motif_MComponentPeer_pSetForeground;
  13.138 -text: .text%Java_sun_awt_motif_MWindowPeer_pShow;
  13.139 -text: .text%Java_sun_awt_motif_MWindowPeer_pShowModal;
  13.140 -text: .text%awt_wm_setExtendedState;
  13.141 -text: .text%awt_wm_doStateProtocolNet: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
  13.142 -text: .text%awt_wm_doStateProtocolWin: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
  13.143 -text: .text%awt_wm_setShellDecor;
  13.144 -text: .text%awt_wm_setMotifDecor: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
  13.145 -text: .text%awt_wm_setOLDecor: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
  13.146 -text: .text%awt_wm_normalizeMotifDecor: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
  13.147 -text: .text%awt_wm_removeSizeHints;
  13.148 -text: .text%Java_sun_awt_motif_MGlobalCursorManager_cacheInit;
  13.149 -text: .text%Java_sun_awt_motif_MGlobalCursorManager_findHeavyweightUnderCursor;
  13.150 -text: .text%getCurComponent;
  13.151 -text: .text%shellEH: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
  13.152 -text: .text%awt_wm_isStateChange;
  13.153 -text: .text%awt_wm_getWMState;
  13.154 -text: .text%innerCanvasEH: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
  13.155 -text: .text%reconfigureOuterCanvas: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
  13.156 -text: .text%outerCanvasResizeCB: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_TopLevel.o;
  13.157 -text: .text%awt_wm_getInsetsFromProp;
  13.158 -text: .text%syncTopLevelPos;
  13.159 -text: .text%raiseInputMethodWindow;
  13.160 -text: .text%awt_canvas_event_handler;
  13.161 -text: .text%awt_canvas_handleEvent;
  13.162 -text: .text%HandleExposeEvent: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/canvas.o;
  13.163 -text: .text%checkForExpose: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/canvas.o;
  13.164 -text: .text%awt_wm_getExtendedState: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_wm.o;
  13.165 -text: .text%expandDamageRect: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/canvas.o;
  13.166 -text: .text%Java_java_awt_KeyboardFocusManager_initIDs;
  13.167 -text: .text%Java_java_awt_event_InputEvent_initIDs;
  13.168 -text: .text%Java_java_awt_event_KeyEvent_initIDs;
  13.169 -text: .text%Java_java_awt_AWTKeyStroke_allocateNewInstance;
  13.170 -text: .text%Java_sun_awt_motif_MComponentPeer_nativeHandleEvent;
  13.171 -text: .text%Java_java_awt_Event_initIDs;
  13.172 -# Test LoadJFrame
  13.173 -text: .text%awtJNI_ThreadYield;
  13.174 -text: .text%Java_sun_awt_motif_MToolkit_getScreenWidth;
  13.175 -text: .text%Java_sun_awt_motif_MToolkit_getScreenHeight;
  13.176 -text: .text%X11SD_Lock: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
  13.177 -text: .text%X11SD_InitWindow: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
  13.178 -text: .text%GetLockStub: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
  13.179 -text: .text%X11SD_GetRasInfo: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
  13.180 -text: .text%X11SD_Unlock: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
  13.181 -text: .text%X11SD_InitClip: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
  13.182 -text: .text%XRequestSentStub: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/X11SurfaceData.o;
  13.183 -# Test JHello
  13.184 -text: .text%AWTLoadFont;
  13.185 -text: .text%AWTFontMaxByte1;
  13.186 -text: .text%AWTFontMaxCharOrByte2;
  13.187 -text: .text%AWTFontMaxBounds;
  13.188 -text: .text%AWTCharAscent;
  13.189 -text: .text%AWTCharDescent;
  13.190 -text: .text%AWTCharWidth;
  13.191 -text: .text%AWTFontMinByte1;
  13.192 -text: .text%AWTFontMinCharOrByte2;
  13.193 -text: .text%AWTFontPerChar;
  13.194 -text: .text%AWTCharRBearing;
  13.195 -text: .text%AWTCharLBearing;
  13.196 -text: .text%Java_sun_awt_X11SurfaceData_setInvalid;
  13.197 -# SwingSet
  13.198 -text: .text%Java_sun_awt_motif_MWindowPeer_setSaveUnder;
  13.199 -text: .text%Java_sun_awt_X11SurfaceData_nativeDispose;
  13.200 -text: .text%X11SurfaceData_GetOps;
  13.201 -text: .text%Java_sun_awt_motif_MCanvasPeer_create;
  13.202 -text: .text%awt_util_insertCallback;
  13.203 -text: .text%Java_sun_awt_motif_MComponentPeer_getComponents_1NoClientCode;
  13.204 -text: .text%Java_sun_awt_motif_MComponentPeer_pReshape;
  13.205 -text: .text%awt_util_reshape;
  13.206 -text: .text%Java_sun_awt_motif_MComponentPeer_pShow;
  13.207 -text: .text%Java_sun_awt_motif_MDataTransferer_getAtomForTarget;
  13.208 -text: .text%Java_sun_awt_motif_MComponentPeer_addNativeDropTarget;
  13.209 -text: .text%register_drop_site;
  13.210 -text: .text%update_drop_site_hierarchy: OUTPUTDIR/tmp/sun/sun.awt/motif12/obj/awt_XmDnD.o;
  13.211 -text: .text%AWTFontDefaultChar;
  13.212 -text: .text%isAncestor;
  13.213 -text: .text%xerror_handler;
  13.214 -text: .text%AWTFontGenerateImage;
  13.215 -text: .text%CreatePixmapAndGC;
    14.1 --- a/make/sun/motif12/reorder-sparcv9	Tue Dec 06 16:31:58 2011 -0800
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,233 +0,0 @@
    14.4 -data = R0x2000;
    14.5 -text = LOAD ?RXO;
    14.6 -# Test Null
    14.7 -# Test Exit
    14.8 -# Test Hello
    14.9 -# Test Sleep
   14.10 -# Test IntToString
   14.11 -# Test LoadToolkit
   14.12 -text: .text%JNI_OnLoad;
   14.13 -text: .text%awt_util_debug_init;
   14.14 -text: .text%Java_java_awt_Toolkit_initIDs;
   14.15 -text: .text%Java_sun_awt_X11GraphicsEnvironment_initDisplay;
   14.16 -text: .text%awt_init_Display;
   14.17 -text: .text%makeDefaultConfig: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_GraphicsEnv.o;
   14.18 -text: .text%awt_allocate_colors;
   14.19 -text: .text%make_uns_ordered_dither_array;
   14.20 -text: .text%checkFont: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_Font.o;
   14.21 -text: .text%Java_sun_awt_X11GraphicsEnvironment_getNativeFonts;
   14.22 -text: .text%Java_sun_awt_X11GraphicsEnvironment_getNumScreens;
   14.23 -text: .text%Java_sun_awt_X11GraphicsEnvironment_getDefaultScreenNum;
   14.24 -text: .text%Java_sun_awt_X11GraphicsDevice_getConfigVisualId;
   14.25 -text: .text%Java_sun_awt_X11GraphicsConfig_initIDs;
   14.26 -text: .text%Java_sun_awt_X11GraphicsConfig_init;
   14.27 -text: .text%getAllConfigs: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_GraphicsEnv.o;
   14.28 -text: .text%awt_output_flush;
   14.29 -text: .text%awtJNI_TimeMillis: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
   14.30 -text: .text%Java_sun_awt_motif_MToolkit_init;
   14.31 -text: .text%getDefaultConfig;
   14.32 -text: .text%getScreenData;
   14.33 -text: .text%Java_sun_awt_PlatformFont_initIDs;
   14.34 -text: .text%Java_sun_awt_motif_MFontPeer_initIDs;
   14.35 -text: .text%awt_color_matchTC;
   14.36 -text: .text%setup_modifier_map: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
   14.37 -text: .text%set_mod_mask: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
   14.38 -text: .text%awt_initialize_Xm_DnD;
   14.39 -text: .text%Java_java_awt_Cursor_initIDs;
   14.40 -text: .text%Java_sun_awt_motif_X11CustomCursor_cacheInit;
   14.41 -text: .text%Java_java_awt_Dimension_initIDs;
   14.42 -text: .text%Java_sun_awt_motif_MToolkit_run;
   14.43 -text: .text%awtJNI_GetCurrentThread;
   14.44 -text: .text%awt_MToolkit_loop: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
   14.45 -text: .text%awt_pipe_init: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
   14.46 -text: .text%awt_set_poll_timeout: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
   14.47 -text: .text%awt_events_pending: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
   14.48 -text: .text%processOneEvent: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
   14.49 -text: .text%waitForEvents: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
   14.50 -text: .text%performPoll: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
   14.51 -text: .text%awt_get_poll_timeout: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
   14.52 -text: .text%awtJNI_CleanupGlobalRefs;
   14.53 -# Test LoadFrame
   14.54 -text: .text%Java_java_awt_Component_initIDs;
   14.55 -text: .text%Java_java_awt_Container_initIDs;
   14.56 -text: .text%Java_java_awt_Window_initIDs;
   14.57 -text: .text%Java_java_awt_Frame_initIDs;
   14.58 -text: .text%Java_sun_awt_SunToolkit_getPrivateKey;
   14.59 -text: .text%Java_java_awt_MenuComponent_initIDs;
   14.60 -text: .text%Java_sun_awt_X11GraphicsConfig_pGetBounds;
   14.61 -text: .text%Java_java_awt_Rectangle_initIDs;
   14.62 -text: .text%Java_sun_awt_motif_MComponentPeer_initIDs;
   14.63 -text: .text%Java_sun_awt_motif_MWindowPeer_initIDs;
   14.64 -text: .text%Java_java_awt_Insets_initIDs;
   14.65 -text: .text%Java_sun_awt_motif_MWindowAttributes_initIDs;
   14.66 -text: .text%Java_sun_awt_motif_MWindowPeer_create;
   14.67 -text: .text%awtJNI_CreateAndSetGlobalRef;
   14.68 -text: .text%copyGraphicsConfigToPeer;
   14.69 -text: .text%awt_Frame_guessInsets;
   14.70 -text: .text%awt_util_runningWindowManager;
   14.71 -text: .text%awt_winmgrerr: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_util.o;
   14.72 -text: .text%awtJNI_ChangeInsets: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o;
   14.73 -text: .text%getMotifFontList;
   14.74 -text: .text%getMotifFontStruct;
   14.75 -text: .text%setDeleteCallback: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o;
   14.76 -text: .text%ColorProc;
   14.77 -text: .text%awt_canvas_create;
   14.78 -text: .text%awt_util_show;
   14.79 -text: .text%addTopLevel;
   14.80 -text: .text%Java_sun_awt_motif_MWindowPeer_pHide;
   14.81 -text: .text%Java_sun_awt_motif_MComponentPeer_pInitialize;
   14.82 -text: .text%awt_addWidget;
   14.83 -text: .text%Java_sun_awt_motif_MComponentPeer_setCursor;
   14.84 -text: .text%getCursor;
   14.85 -text: .text%awt_util_setCursor;
   14.86 -text: .text%Java_sun_awt_motif_MComponentPeer_getParent_1NoClientCode;
   14.87 -text: .text%Java_sun_awt_motif_MWindowPeer_pReshape;
   14.88 -text: .text%reshape: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o;
   14.89 -text: .text%awtJNI_setMbAndWwHeightAndOffsets: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o;
   14.90 -text: .text%awt_util_wmPositionsShellXY;
   14.91 -text: .text%Java_sun_awt_motif_MWindowPeer_pSetTitle;
   14.92 -text: .text%Java_sun_awt_motif_MWindowPeer_setResizable;
   14.93 -text: .text%Java_java_awt_Font_initIDs;
   14.94 -text: .text%Java_sun_awt_motif_MComponentPeer_pSetFont;
   14.95 -text: .text%awt_util_mapChildren;
   14.96 -text: .text%changeFont: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_Component.o;
   14.97 -text: .text%Java_java_awt_Color_initIDs;
   14.98 -text: .text%Java_sun_awt_motif_MToolkit_loadSystemColors;
   14.99 -text: .text%colorToRGB: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
  14.100 -text: .text%Java_sun_awt_motif_MComponentPeer_pSetBackground;
  14.101 -text: .text%getGraphicsConfigFromComponentPeer;
  14.102 -text: .text%awtJNI_GetColorForVis;
  14.103 -text: .text%Java_sun_awt_motif_MComponentPeer_pSetForeground;
  14.104 -text: .text%Java_sun_awt_motif_MWindowPeer_pShow;
  14.105 -text: .text%Java_sun_awt_motif_MWindowPeer_pShowModal;
  14.106 -text: .text%setStateHints: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o;
  14.107 -text: .text%awt_util_setMinMaxSizeProps;
  14.108 -text: .text%innerCanvasEH: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o;
  14.109 -text: .text%reconfigureOuterCanvas: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o;
  14.110 -text: .text%Java_java_awt_AWTEvent_initIDs;
  14.111 -text: .text%outerCanvasResizeCB: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o;
  14.112 -text: .text%Java_sun_awt_motif_MGlobalCursorManager_cacheInit;
  14.113 -text: .text%shellEH: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o;
  14.114 -text: .text%Java_sun_awt_motif_MGlobalCursorManager_findHeavyweightUnderCursor;
  14.115 -text: .text%getCurComponent;
  14.116 -text: .text%get_awt_TopLevelInsetsProp;
  14.117 -text: .text%syncTopLevelPos;
  14.118 -text: .text%Java_sun_awt_motif_MComponentPeer_nativeHandleEvent;
  14.119 -text: .text%raiseInputMethodWindow;
  14.120 -text: .text%getWindowState: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o;
  14.121 -text: .text%awt_canvas_event_handler;
  14.122 -text: .text%awt_canvas_handleEvent;
  14.123 -text: .text%HandleExposeEvent: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/canvas.o;
  14.124 -text: .text%checkForExpose: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/canvas.o;
  14.125 -text: .text%Java_java_awt_Event_initIDs;
  14.126 -text: .text%Java_java_awt_image_ColorModel_initIDs;
  14.127 -text: .text%Java_sun_awt_motif_X11Graphics_cacheInit;
  14.128 -text: .text%InitMITShm: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_Graphics.o;
  14.129 -text: .text%Java_sun_java2d_loops_RasterOutputManager_getPlatformFontVar;
  14.130 -text: .text%Java_sun_awt_motif_X11Graphics_createFromComponent;
  14.131 -text: .text%Java_sun_awt_motif_X11Graphics_pSetForeground;
  14.132 -text: .text%awt_init_gc;
  14.133 -text: .text%Java_sun_awt_motif_X11Graphics_pSetFont;
  14.134 -text: .text%awtJNI_GetFontData;
  14.135 -text: .text%awtJNI_IsMultiFont;
  14.136 -text: .text%Java_sun_awt_FontDescriptor_initIDs;
  14.137 -text: .text%loadFont;
  14.138 -text: .text%Java_sun_awt_motif_X11Graphics_setOrigin;
  14.139 -text: .text%Java_sun_awt_motif_X11Graphics_setLineAttrs;
  14.140 -text: .text%Java_sun_awt_motif_X11Graphics_changeClip;
  14.141 -text: .text%Java_sun_awt_motif_X11Graphics_devClearRect;
  14.142 -text: .text%Java_sun_awt_motif_X11Graphics_disposeImpl;
  14.143 -# Test LoadJFrame
  14.144 -text: .text%Java_java_awt_event_InputEvent_initIDs;
  14.145 -text: .text%Java_java_awt_event_KeyEvent_initIDs;
  14.146 -text: .text%expandDamageRect: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/canvas.o;
  14.147 -text: .text%awtJNI_ThreadYield;
  14.148 -text: .text%Java_sun_awt_motif_X11Graphics_createFromGraphics;
  14.149 -text: .text%Java_sun_awt_motif_MToolkit_getScreenWidth;
  14.150 -text: .text%Java_sun_awt_motif_MToolkit_getScreenHeight;
  14.151 -text: .text%Java_sun_awt_X11GraphicsConfig_makeColorModel;
  14.152 -text: .text%awtJNI_GetColorModel;
  14.153 -text: .text%Java_java_awt_image_BufferedImage_initIDs;
  14.154 -text: .text%Java_java_awt_image_Raster_initIDs;
  14.155 -text: .text%Java_java_awt_image_SampleModel_initIDs;
  14.156 -text: .text%Java_java_awt_image_SinglePixelPackedSampleModel_initIDs;
  14.157 -text: .text%Java_sun_awt_image_IntegerComponentRaster_initIDs;
  14.158 -text: .text%Java_sun_java2d_loops_ImageData_initIDs;
  14.159 -text: .text%Java_sun_java2d_loops_IntDiscreteRenderer_devSetRect;
  14.160 -text: .text%Java_sun_awt_motif_X11Graphics_X11LockViewResources;
  14.161 -text: .text%X11DeferredLockViewResources: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_Graphics.o;
  14.162 -text: .text%getLockMethod: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_Graphics.o;
  14.163 -text: .text%DGA_DeferredLockViewResources;
  14.164 -text: .text%setLockMethod: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_Graphics.o;
  14.165 -text: .text%getPrimitiveType: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_Graphics.o;
  14.166 -text: .text%Java_sun_awt_motif_X11Graphics_X11UnLockViewResources;
  14.167 -text: .text%DGA_UnlockViewResources;
  14.168 -text: .text%Java_sun_java2d_loops_DefaultComponent_IntIsomorphicCopy;
  14.169 -text: .text%minImageWidths;
  14.170 -text: .text%minImageRows;
  14.171 -text: .text%getIntImageLockInfo;
  14.172 -text: .text%lockIntImageData;
  14.173 -text: .text%unlockIntImageData;
  14.174 -# Test JHello
  14.175 -text: .text%Java_java_awt_FontMetrics_initIDs;
  14.176 -# SwingSet
  14.177 -text: .text%Java_sun_awt_image_Image_initIDs;
  14.178 -text: .text%Java_sun_awt_image_ImageRepresentation_initIDs;
  14.179 -text: .text%Java_java_awt_image_IndexColorModel_initIDs;
  14.180 -text: .text%Java_sun_awt_motif_MWindowPeer_setSaveUnder;
  14.181 -text: .text%Java_java_awt_AWTEvent_freeNativeData;
  14.182 -text: .text%Java_sun_java2d_loops_DefaultComponent_IntRgbToXbgr;
  14.183 -text: .text%Java_sun_awt_motif_MCanvasPeer_create;
  14.184 -text: .text%awt_util_insertCallback;
  14.185 -text: .text%Java_sun_awt_motif_MComponentPeer_getComponents_1NoClientCode;
  14.186 -text: .text%Java_sun_awt_motif_MComponentPeer_pReshape;
  14.187 -text: .text%awt_util_reshape;
  14.188 -text: .text%Java_sun_awt_motif_MComponentPeer_pShow;
  14.189 -text: .text%Java_sun_java2d_loops_IntDiscreteRenderer_devDrawLine;
  14.190 -text: .text%doDrawLine: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/IntDiscreteRenderer.o;
  14.191 -text: .text%adjustLine: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/IntDiscreteRenderer.o;
  14.192 -text: .text%Java_sun_awt_image_GifImageDecoder_initIDs;
  14.193 -text: .text%Java_java_awt_image_ComponentSampleModel_initIDs;
  14.194 -text: .text%Java_sun_awt_image_ByteComponentRaster_initIDs;
  14.195 -text: .text%Java_sun_awt_image_GifImageDecoder_parseImage;
  14.196 -text: .text%Java_sun_awt_image_ImageRepresentation_setBytePixels;
  14.197 -text: .text%Java_sun_java2d_loops_IntDiscreteRenderer_devDrawRect;
  14.198 -text: .text%outcode: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/IntDiscreteRenderer.o;
  14.199 -text: .text%Java_sun_java2d_loops_ImageData_isAllOpaqueGrayICM;
  14.200 -text: .text%Java_sun_java2d_loops_GIFAcceleratorLoops_LUTcopyTo32BitXBgr;
  14.201 -text: .text%getByteIndexedImageLockInfo;
  14.202 -text: .text%lockByteIndexedImageData;
  14.203 -text: .text%unlockByteIndexedImageData;
  14.204 -text: .text%Java_sun_java2d_loops_GIFAcceleratorLoops_LUTxparTo32BitXBgr;
  14.205 -text: .text%shouldDispatchToWidget: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
  14.206 -text: .text%awtMenuIsActive;
  14.207 -text: .text%awt_util_focusIsOnMenu;
  14.208 -text: .text%awt_isModal;
  14.209 -text: .text%findWidgetInfo: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
  14.210 -text: .text%awt_copyXEvent;
  14.211 -text: .text%awt_post_java_mouse_event;
  14.212 -text: .text%Java_java_awt_event_MouseEvent_initIDs;
  14.213 -text: .text%sysTimeMillis;
  14.214 -text: .text%updateCursor;
  14.215 -text: .text%awt_setActivatedShell;
  14.216 -text: .text%handleFocusEvent;
  14.217 -text: .text%awt_post_java_focus_event;
  14.218 -text: .text%getModifiers;
  14.219 -text: .text%Java_java_awt_AWTEvent_copyDataFieldInto;
  14.220 -text: .text%Java_sun_awt_motif_X11InputMethod_initIDs;
  14.221 -text: .text%Java_sun_awt_motif_X11InputMethod_openXIM;
  14.222 -text: .text%awt_put_back_event;
  14.223 -text: .text%awt_get_next_put_back_event: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
  14.224 -text: .text%null_event_handler: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_MToolkit.o;
  14.225 -text: .text%Java_sun_awt_motif_MGlobalCursorManager_getCursorPos;
  14.226 -text: .text%Java_sun_awt_motif_MGlobalCursorManager_findComponentAt;
  14.227 -text: .text%Java_sun_awt_motif_MWindowPeer_hasTextComponents;
  14.228 -text: .text%Java_sun_awt_motif_X11InputMethod_createXICNative;
  14.229 -text: .text%findClass: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_InputMethod.o;
  14.230 -text: .text%createXIC: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_InputMethod.o;
  14.231 -text: .text%Java_sun_awt_motif_X11InputMethod_setXICFocus;
  14.232 -text: .text%setXICWindowFocus: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_InputMethod.o;
  14.233 -text: .text%setXICFocus: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_InputMethod.o;
  14.234 -text: .text%getAncestorShell;
  14.235 -text: .text%Java_sun_awt_motif_X11InputMethod_turnoffStatusWindow;
  14.236 -text: .text%Frame_quit: ../../../build/solaris-sparcv9/tmp/sun/sun.awt/motif12/obj64/awt_TopLevel.o;
    15.1 --- a/make/sun/splashscreen/FILES_c.gmk	Tue Dec 06 16:31:58 2011 -0800
    15.2 +++ b/make/sun/splashscreen/FILES_c.gmk	Mon Dec 19 10:06:23 2011 -0800
    15.3 @@ -51,7 +51,10 @@
    15.4  	gifalloc.c \
    15.5  	compress.c \
    15.6  	deflate.c \
    15.7 -	gzio.c \
    15.8 +	gzclose.c \
    15.9 +	gzlib.c \
   15.10 +	gzread.c \
   15.11 +	gzwrite.c \
   15.12  	infback.c \
   15.13  	inffast.c \
   15.14  	inflate.c \
    16.1 --- a/make/sun/xawt/mapfile-vers	Tue Dec 06 16:31:58 2011 -0800
    16.2 +++ b/make/sun/xawt/mapfile-vers	Mon Dec 19 10:06:23 2011 -0800
    16.3 @@ -256,8 +256,6 @@
    16.4  
    16.5          Java_sun_awt_X11_XToolkit_waitForEvents;
    16.6          Java_java_awt_Event_initIDs;
    16.7 -        Java_sun_awt_motif_X11FontMetrics_initIDs;
    16.8 -        Java_sun_awt_motif_X11FontMetrics_init;
    16.9          Java_sun_awt_X11_XWindow_x11inputMethodLookupString;
   16.10          Java_sun_awt_X11_XWindow_haveCurrentX11InputMethodInstance;
   16.11          Java_java_awt_AWTEvent_nativeSetSource;
   16.12 @@ -265,7 +263,6 @@
   16.13          Java_sun_awt_PlatformFont_initIDs;
   16.14          Java_sun_awt_FontDescriptor_initIDs;
   16.15          Java_sun_awt_X11_XFontPeer_initIDs;
   16.16 -        Java_sun_awt_motif_X11FontMetrics_getMFCharsWidth;
   16.17          Java_sun_awt_X11InputMethod_initIDs;
   16.18          Java_sun_awt_X11InputMethod_resetXIC;
   16.19          Java_sun_awt_X11InputMethod_disposeXIC;
   16.20 @@ -322,6 +319,8 @@
   16.21          Java_sun_awt_X11_XlibWrapper_XSynchronize;
   16.22          Java_java_awt_FileDialog_initIDs;
   16.23          Java_sun_awt_X11_XWindow_initIDs;
   16.24 +        Java_sun_awt_X11_XWindowPeer_getLocalHostname;
   16.25 +        Java_sun_awt_X11_XWindowPeer_getJvmPID;
   16.26  
   16.27          Java_sun_java2d_opengl_OGLContext_getOGLIdString;
   16.28          Java_sun_java2d_opengl_OGLMaskFill_maskFill;
    17.1 --- a/src/share/classes/com/sun/beans/finder/AbstractFinder.java	Tue Dec 06 16:31:58 2011 -0800
    17.2 +++ b/src/share/classes/com/sun/beans/finder/AbstractFinder.java	Mon Dec 19 10:06:23 2011 -0800
    17.3 @@ -1,5 +1,5 @@
    17.4  /*
    17.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
    17.6 + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
    17.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    17.8   *
    17.9   * This code is free software; you can redistribute it and/or modify it
   17.10 @@ -54,7 +54,7 @@
   17.11  
   17.12      /**
   17.13       * Returns an array of {@code Class} objects
   17.14 -     * that represent the formal parameter types of the method
   17.15 +     * that represent the formal parameter types of the method.
   17.16       * Returns an empty array if the method takes no parameters.
   17.17       *
   17.18       * @param method  the object that represents method
    18.1 --- a/src/share/classes/com/sun/beans/finder/ConstructorFinder.java	Tue Dec 06 16:31:58 2011 -0800
    18.2 +++ b/src/share/classes/com/sun/beans/finder/ConstructorFinder.java	Mon Dec 19 10:06:23 2011 -0800
    18.3 @@ -1,5 +1,5 @@
    18.4  /*
    18.5 - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
    18.6 + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
    18.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    18.8   *
    18.9   * This code is free software; you can redistribute it and/or modify it
   18.10 @@ -87,7 +87,7 @@
   18.11  
   18.12      /**
   18.13       * Returns an array of {@code Class} objects
   18.14 -     * that represent the formal parameter types of the constructor
   18.15 +     * that represent the formal parameter types of the constructor.
   18.16       * Returns an empty array if the constructor takes no parameters.
   18.17       *
   18.18       * @param constructor  the object that represents constructor
    19.1 --- a/src/share/classes/com/sun/beans/finder/MethodFinder.java	Tue Dec 06 16:31:58 2011 -0800
    19.2 +++ b/src/share/classes/com/sun/beans/finder/MethodFinder.java	Mon Dec 19 10:06:23 2011 -0800
    19.3 @@ -1,5 +1,5 @@
    19.4  /*
    19.5 - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
    19.6 + * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
    19.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    19.8   *
    19.9   * This code is free software; you can redistribute it and/or modify it
   19.10 @@ -190,7 +190,7 @@
   19.11  
   19.12      /**
   19.13       * Returns an array of {@code Class} objects
   19.14 -     * that represent the formal parameter types of the method
   19.15 +     * that represent the formal parameter types of the method.
   19.16       * Returns an empty array if the method takes no parameters.
   19.17       *
   19.18       * @param method  the object that represents method
   19.19 @@ -226,6 +226,6 @@
   19.20       */
   19.21      @Override
   19.22      protected boolean isValid(Method method) {
   19.23 -        return Modifier.isPublic(method.getModifiers()) && method.getName().equals(this.name);
   19.24 +        return !method.isBridge() && Modifier.isPublic(method.getModifiers()) && method.getName().equals(this.name);
   19.25      }
   19.26  }
    20.1 --- a/src/share/classes/com/sun/media/sound/JSSecurityManager.java	Tue Dec 06 16:31:58 2011 -0800
    20.2 +++ b/src/share/classes/com/sun/media/sound/JSSecurityManager.java	Mon Dec 19 10:06:23 2011 -0800
    20.3 @@ -34,15 +34,13 @@
    20.4  import java.util.Iterator;
    20.5  import java.util.List;
    20.6  import java.util.Properties;
    20.7 +import java.util.ServiceLoader;
    20.8  
    20.9  import java.security.AccessController;
   20.10  import java.security.PrivilegedAction;
   20.11  
   20.12  import javax.sound.sampled.AudioPermission;
   20.13  
   20.14 -import sun.misc.Service;
   20.15 -
   20.16 -
   20.17  /** Managing security in the Java Sound implementation.
   20.18   * This class contains all code that uses and is used by
   20.19   * SecurityManager.doPrivileged().
   20.20 @@ -80,8 +78,8 @@
   20.21          try {
   20.22              if (hasSecurityManager()) {
   20.23                  if(Printer.debug) Printer.debug("using security manager to load library");
   20.24 -                PrivilegedAction action = new PrivilegedAction() {
   20.25 -                        public Object run() {
   20.26 +                PrivilegedAction<Void> action = new PrivilegedAction<Void>() {
   20.27 +                        public Void run() {
   20.28                              System.loadLibrary(libName);
   20.29                              return null;
   20.30                          }
   20.31 @@ -104,8 +102,8 @@
   20.32          if (hasSecurityManager()) {
   20.33              if(Printer.debug) Printer.debug("using JDK 1.2 security to get property");
   20.34              try{
   20.35 -                PrivilegedAction action = new PrivilegedAction() {
   20.36 -                        public Object run() {
   20.37 +                PrivilegedAction<String> action = new PrivilegedAction<String>() {
   20.38 +                        public String run() {
   20.39                              try {
   20.40                                  return System.getProperty(propertyName);
   20.41                              } catch (Throwable t) {
   20.42 @@ -113,7 +111,7 @@
   20.43                              }
   20.44                          }
   20.45                      };
   20.46 -                propertyValue = (String) AccessController.doPrivileged(action);
   20.47 +                propertyValue = AccessController.doPrivileged(action);
   20.48              } catch( Exception e ) {
   20.49                  if(Printer.debug) Printer.debug("not using JDK 1.2 security to get properties");
   20.50                  propertyValue = System.getProperty(propertyName);
   20.51 @@ -142,8 +140,8 @@
   20.52          if(hasSecurityManager()) {
   20.53              try {
   20.54                  // invoke the privileged action using 1.2 security
   20.55 -                PrivilegedAction action = new PrivilegedAction() {
   20.56 -                        public Object run() {
   20.57 +                PrivilegedAction<Void> action = new PrivilegedAction<Void>() {
   20.58 +                        public Void run() {
   20.59                              loadPropertiesImpl(properties, filename);
   20.60                              return null;
   20.61                          }
   20.62 @@ -197,8 +195,8 @@
   20.63          if(hasSecurityManager()) {
   20.64              try {
   20.65                  // invoke the privileged action using 1.2 security
   20.66 -                PrivilegedAction action = new PrivilegedAction() {
   20.67 -                        public Object run() {
   20.68 +                PrivilegedAction<ThreadGroup> action = new PrivilegedAction<ThreadGroup>() {
   20.69 +                        public ThreadGroup run() {
   20.70                              try {
   20.71                                  return getTopmostThreadGroupImpl();
   20.72                              } catch (Throwable t) {
   20.73 @@ -206,7 +204,7 @@
   20.74                              }
   20.75                          }
   20.76                      };
   20.77 -                topmostThreadGroup = (ThreadGroup) AccessController.doPrivileged(action);
   20.78 +                topmostThreadGroup = AccessController.doPrivileged(action);
   20.79                  if(Printer.debug)Printer.debug("Got topmost thread group with JDK 1.2 security");
   20.80              } catch (Exception e) {
   20.81                  if(Printer.debug)Printer.debug("Exception getting topmost thread group with JDK 1.2 security");
   20.82 @@ -240,8 +238,8 @@
   20.83                                 final boolean doStart) {
   20.84          Thread thread = null;
   20.85          if(hasSecurityManager()) {
   20.86 -            PrivilegedAction action = new PrivilegedAction() {
   20.87 -                    public Object run() {
   20.88 +            PrivilegedAction<Thread> action = new PrivilegedAction<Thread>() {
   20.89 +                    public Thread run() {
   20.90                          try {
   20.91                              return createThreadImpl(runnable, threadName,
   20.92                                                      isDaemon, priority,
   20.93 @@ -251,7 +249,7 @@
   20.94                          }
   20.95                      }
   20.96                  };
   20.97 -            thread = (Thread) AccessController.doPrivileged(action);
   20.98 +            thread = AccessController.doPrivileged(action);
   20.99              if(Printer.debug) Printer.debug("created thread with JDK 1.2 security");
  20.100          } else {
  20.101              if(Printer.debug)Printer.debug("not using JDK 1.2 security");
  20.102 @@ -282,11 +280,11 @@
  20.103      }
  20.104  
  20.105  
  20.106 -    static List getProviders(final Class providerClass) {
  20.107 -        List p = new ArrayList();
  20.108 -        // Service.providers(Class) just creates "lazy" iterator instance,
  20.109 -        // so it doesn't require do be called from privileged section
  20.110 -        final Iterator ps = Service.providers(providerClass);
  20.111 +    static <T> List<T> getProviders(final Class<T> providerClass) {
  20.112 +        List<T> p = new ArrayList<>();
  20.113 +        // ServiceLoader creates "lazy" iterator instance, so it doesn't,
  20.114 +        // require do be called from privileged section
  20.115 +        final Iterator<T> ps = ServiceLoader.load(providerClass).iterator();
  20.116  
  20.117          // the iterator's hasNext() method looks through classpath for
  20.118          // the provider class names, so it requires read permissions
  20.119 @@ -301,7 +299,7 @@
  20.120                  // the iterator's next() method creates instances of the
  20.121                  // providers and it should be called in the current security
  20.122                  // context
  20.123 -                Object provider = ps.next();
  20.124 +                T provider = ps.next();
  20.125                  if (providerClass.isInstance(provider)) {
  20.126                      // $$mp 2003-08-22
  20.127                      // Always adding at the beginning reverses the
    21.1 --- a/src/share/classes/com/sun/net/httpserver/spi/HttpServerProvider.java	Tue Dec 06 16:31:58 2011 -0800
    21.2 +++ b/src/share/classes/com/sun/net/httpserver/spi/HttpServerProvider.java	Mon Dec 19 10:06:23 2011 -0800
    21.3 @@ -25,50 +25,58 @@
    21.4  
    21.5  package com.sun.net.httpserver.spi;
    21.6  
    21.7 -import java.io.FileDescriptor;
    21.8  import java.io.IOException;
    21.9  import java.net.*;
   21.10  import java.security.AccessController;
   21.11  import java.security.PrivilegedAction;
   21.12  import java.util.Iterator;
   21.13 -import sun.misc.Service;
   21.14 -import sun.misc.ServiceConfigurationError;
   21.15 -import sun.security.action.GetPropertyAction;
   21.16 +import java.util.ServiceLoader;
   21.17 +import java.util.ServiceConfigurationError;
   21.18  import com.sun.net.httpserver.*;
   21.19  
   21.20  /**
   21.21   * Service provider class for HttpServer.
   21.22 - * Sub-classes of HttpServerProvider provide an implementation of {@link HttpServer} and
   21.23 - * associated classes. Applications do not normally use this class.
   21.24 - * See {@link #provider()} for how providers are found and loaded.
   21.25 + * Sub-classes of HttpServerProvider provide an implementation of
   21.26 + * {@link HttpServer} and associated classes. Applications do not normally use
   21.27 + * this class. See {@link #provider()} for how providers are found and loaded.
   21.28   */
   21.29  public abstract class HttpServerProvider {
   21.30  
   21.31      /**
   21.32       * creates a HttpServer from this provider
   21.33 -     * @param addr the address to bind to. May be <code>null</code>
   21.34 -     * @param backlog the socket backlog. A value of <code>zero</code> means the systems default
   21.35 +     *
   21.36 +     * @param  addr
   21.37 +     *         the address to bind to. May be {@code null}
   21.38 +     *
   21.39 +     * @param  backlog
   21.40 +     *         the socket backlog. A value of {@code zero} means the systems default
   21.41       */
   21.42 -    public abstract HttpServer createHttpServer (InetSocketAddress addr, int backlog) throws IOException;
   21.43 +    public abstract HttpServer createHttpServer(InetSocketAddress addr,
   21.44 +                                                int backlog)
   21.45 +        throws IOException;
   21.46  
   21.47      /**
   21.48       * creates a HttpsServer from this provider
   21.49 -     * @param addr the address to bind to. May be <code>null</code>
   21.50 -     * @param backlog the socket backlog. A value of <code>zero</code> means the systems default
   21.51 +     *
   21.52 +     * @param  addr
   21.53 +     *         the address to bind to. May be {@code null}
   21.54 +     *
   21.55 +     * @param  backlog
   21.56 +     *         the socket backlog. A value of {@code zero} means the systems default
   21.57       */
   21.58 -    public abstract HttpsServer createHttpsServer (InetSocketAddress addr, int backlog) throws IOException;
   21.59 -
   21.60 -
   21.61 +    public abstract HttpsServer createHttpsServer(InetSocketAddress addr,
   21.62 +                                                  int backlog)
   21.63 +        throws IOException;
   21.64  
   21.65      private static final Object lock = new Object();
   21.66      private static HttpServerProvider provider = null;
   21.67  
   21.68      /**
   21.69 -     * Initializes a new instance of this class.  </p>
   21.70 +     * Initializes a new instance of this class.
   21.71       *
   21.72       * @throws  SecurityException
   21.73       *          If a security manager has been installed and it denies
   21.74 -     *          {@link RuntimePermission}<tt>("httpServerProvider")</tt>
   21.75 +     *          {@link RuntimePermission}{@code("httpServerProvider")}
   21.76       */
   21.77      protected HttpServerProvider() {
   21.78          SecurityManager sm = System.getSecurityManager();
   21.79 @@ -82,21 +90,22 @@
   21.80              return false;
   21.81          try {
   21.82              Class<?> c = Class.forName(cn, true,
   21.83 -                                    ClassLoader.getSystemClassLoader());
   21.84 +                                       ClassLoader.getSystemClassLoader());
   21.85              provider = (HttpServerProvider)c.newInstance();
   21.86              return true;
   21.87          } catch (ClassNotFoundException |
   21.88                   IllegalAccessException |
   21.89                   InstantiationException |
   21.90                   SecurityException x) {
   21.91 -            throw new ServiceConfigurationError(x);
   21.92 +            throw new ServiceConfigurationError(null, x);
   21.93          }
   21.94      }
   21.95  
   21.96      private static boolean loadProviderAsService() {
   21.97 -        @SuppressWarnings("unchecked")
   21.98 -        Iterator<HttpServerProvider> i = Service.providers(HttpServerProvider.class,
   21.99 -                                       ClassLoader.getSystemClassLoader());
  21.100 +        Iterator<HttpServerProvider> i =
  21.101 +            ServiceLoader.load(HttpServerProvider.class,
  21.102 +                               ClassLoader.getSystemClassLoader())
  21.103 +                .iterator();
  21.104          for (;;) {
  21.105              try {
  21.106                  if (!i.hasNext())
  21.107 @@ -123,19 +132,19 @@
  21.108       * <ol>
  21.109       *
  21.110       *   <li><p> If the system property
  21.111 -     *   <tt>com.sun.net.httpserver.HttpServerProvider</tt> is defined then it is
  21.112 -     *   taken to be the fully-qualified name of a concrete provider class.
  21.113 +     *   {@code com.sun.net.httpserver.HttpServerProvider} is defined then it
  21.114 +     *   is taken to be the fully-qualified name of a concrete provider class.
  21.115       *   The class is loaded and instantiated; if this process fails then an
  21.116       *   unspecified unchecked error or exception is thrown.  </p></li>
  21.117       *
  21.118       *   <li><p> If a provider class has been installed in a jar file that is
  21.119       *   visible to the system class loader, and that jar file contains a
  21.120       *   provider-configuration file named
  21.121 -     *   <tt>com.sun.net.httpserver.HttpServerProvider</tt> in the resource
  21.122 +     *   {@code com.sun.net.httpserver.HttpServerProvider} in the resource
  21.123       *   directory <tt>META-INF/services</tt>, then the first class name
  21.124       *   specified in that file is taken.  The class is loaded and
  21.125 -     *   instantiated; if this process fails then an unspecified unchecked error or exception is
  21.126 -     *   thrown.  </p></li>
  21.127 +     *   instantiated; if this process fails then an unspecified unchecked error
  21.128 +     *   or exception is thrown.  </p></li>
  21.129       *
  21.130       *   <li><p> Finally, if no provider has been specified by any of the above
  21.131       *   means then the system-default provider class is instantiated and the
    22.1 --- a/src/share/classes/com/sun/rowset/CachedRowSetImpl.java	Tue Dec 06 16:31:58 2011 -0800
    22.2 +++ b/src/share/classes/com/sun/rowset/CachedRowSetImpl.java	Mon Dec 19 10:06:23 2011 -0800
    22.3 @@ -357,7 +357,7 @@
    22.4  
    22.5          // set the Reader, this maybe overridden latter
    22.6          provider =
    22.7 -        (SyncProvider)SyncFactory.getInstance(DEFAULT_SYNC_PROVIDER);
    22.8 +        SyncFactory.getInstance(DEFAULT_SYNC_PROVIDER);
    22.9  
   22.10          if (!(provider instanceof RIOptimisticProvider)) {
   22.11              throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidp").toString());
   22.12 @@ -445,11 +445,10 @@
   22.13       * @param env a <code>Hashtable</code> object with a list of desired
   22.14       *        synchronization providers
   22.15       * @throws SQLException if the requested provider cannot be found by the
   22.16 -     * synchonization factory
   22.17 +     * synchronization factory
   22.18       * @see SyncProvider
   22.19       */
   22.20 -
   22.21 -    public CachedRowSetImpl(Hashtable env) throws SQLException {
   22.22 +    public CachedRowSetImpl(@SuppressWarnings("rawtypes") Hashtable env) throws SQLException {
   22.23  
   22.24  
   22.25          try {
   22.26 @@ -467,7 +466,7 @@
   22.27  
   22.28          // set the Reader, this maybe overridden latter
   22.29          provider =
   22.30 -        (SyncProvider)SyncFactory.getInstance(providerName);
   22.31 +        SyncFactory.getInstance(providerName);
   22.32  
   22.33          rowSetReader = provider.getRowSetReader();
   22.34          rowSetWriter = provider.getRowSetWriter();
   22.35 @@ -525,7 +524,7 @@
   22.36  
   22.37          iMatchColumns = new Vector<Integer>(10);
   22.38          for(int i = 0; i < 10 ; i++) {
   22.39 -           iMatchColumns.add(i,Integer.valueOf(-1));
   22.40 +           iMatchColumns.add(i, -1);
   22.41          }
   22.42  
   22.43          strMatchColumns = new Vector<String>(10);
   22.44 @@ -540,7 +539,7 @@
   22.45       */
   22.46      private void checkTransactionalWriter() {
   22.47          if (rowSetWriter != null) {
   22.48 -            Class c = rowSetWriter.getClass();
   22.49 +            Class<?> c = rowSetWriter.getClass();
   22.50              if (c != null) {
   22.51                  Class[] theInterfaces = c.getInterfaces();
   22.52                  for (int i = 0; i < theInterfaces.length; i++) {
   22.53 @@ -685,7 +684,7 @@
   22.54                          obj = new SerialArray((java.sql.Array)obj);
   22.55                  }
   22.56  
   22.57 -                ((Row)currentRow).initColumnObject(i, obj);
   22.58 +                currentRow.initColumnObject(i, obj);
   22.59              }
   22.60              rowsFetched++;
   22.61              rvh.add(currentRow);
   22.62 @@ -881,7 +880,7 @@
   22.63                  cursorPos = saveCursorPos;
   22.64              }
   22.65  
   22.66 -            if ((tXWriter) && this.COMMIT_ON_ACCEPT_CHANGES) {
   22.67 +            if (tXWriter) {
   22.68                  // do commit/rollback's here
   22.69                  if (!conflict) {
   22.70                      tWriter = (TransactionalWriter)rowSetWriter;
   22.71 @@ -901,7 +900,7 @@
   22.72  
   22.73              if (success == true) {
   22.74                  setOriginal();
   22.75 -            } else if (!(success) && !(this.COMMIT_ON_ACCEPT_CHANGES)) {
   22.76 +            } else if (!(success) ) {
   22.77                  throw new SyncProviderException(resBundle.handleGetObject("cachedrowsetimpl.accfailed").toString());
   22.78              }
   22.79  
   22.80 @@ -938,10 +937,8 @@
   22.81       * @see javax.sql.rowset.spi.SyncProvider
   22.82       */
   22.83      public void acceptChanges(Connection con) throws SyncProviderException{
   22.84 -
   22.85        setConnection(con);
   22.86        acceptChanges();
   22.87 -
   22.88      }
   22.89  
   22.90      /**
   22.91 @@ -957,7 +954,7 @@
   22.92       */
   22.93      public void restoreOriginal() throws SQLException {
   22.94          Row currentRow;
   22.95 -        for (Iterator i = rvh.iterator(); i.hasNext();) {
   22.96 +        for (Iterator<?> i = rvh.iterator(); i.hasNext();) {
   22.97              currentRow = (Row)i.next();
   22.98              if (currentRow.getInserted() == true) {
   22.99                  i.remove();
  22.100 @@ -1287,7 +1284,7 @@
  22.101          TreeMap<Integer, Object> tMap = new TreeMap<>();
  22.102  
  22.103          for (int i = 0; i<numRows; i++) {
  22.104 -            tMap.put(Integer.valueOf(i), rvh.get(i));
  22.105 +            tMap.put(i, rvh.get(i));
  22.106          }
  22.107  
  22.108          return (tMap.values());
  22.109 @@ -1379,7 +1376,7 @@
  22.110       */
  22.111      public void setSyncProvider(String providerStr) throws SQLException {
  22.112          provider =
  22.113 -        (SyncProvider)SyncFactory.getInstance(providerStr);
  22.114 +        SyncFactory.getInstance(providerStr);
  22.115  
  22.116          rowSetReader = provider.getRowSetReader();
  22.117          rowSetWriter = provider.getRowSetWriter();
  22.118 @@ -1880,7 +1877,7 @@
  22.119          // check for SQL NULL
  22.120          if (value == null) {
  22.121              setLastValueNull(true);
  22.122 -            return (int)0;
  22.123 +            return 0;
  22.124          }
  22.125  
  22.126          try {
  22.127 @@ -2353,7 +2350,7 @@
  22.128              throw new SQLException(ex.getMessage());
  22.129          }
  22.130  
  22.131 -        return (java.io.InputStream)asciiStream;
  22.132 +        return asciiStream;
  22.133      }
  22.134  
  22.135      /**
  22.136 @@ -2399,7 +2396,7 @@
  22.137  
  22.138          unicodeStream = new StringBufferInputStream(value.toString());
  22.139  
  22.140 -        return (java.io.InputStream)unicodeStream;
  22.141 +        return unicodeStream;
  22.142      }
  22.143  
  22.144      /**
  22.145 @@ -2454,7 +2451,7 @@
  22.146  
  22.147          binaryStream = new ByteArrayInputStream((byte[])value);
  22.148  
  22.149 -        return (java.io.InputStream)binaryStream;
  22.150 +        return binaryStream;
  22.151  
  22.152      }
  22.153  
  22.154 @@ -2958,7 +2955,7 @@
  22.155              Struct s = (Struct)value;
  22.156              map = getTypeMap();
  22.157              // look up the class in the map
  22.158 -            Class c = (Class)map.get(s.getSQLTypeName());
  22.159 +            Class<?> c = map.get(s.getSQLTypeName());
  22.160              if (c != null) {
  22.161                  // create new instance of the class
  22.162                  SQLData obj = null;
  22.163 @@ -3091,7 +3088,7 @@
  22.164              throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
  22.165          }
  22.166  
  22.167 -        return (java.io.Reader)charStream;
  22.168 +        return charStream;
  22.169      }
  22.170  
  22.171      /**
  22.172 @@ -4006,7 +4003,7 @@
  22.173              switch (trgType) {
  22.174                  case java.sql.Types.BIT:
  22.175                      Integer i = Integer.valueOf(srcObj.toString().trim());
  22.176 -                    return i.equals(Integer.valueOf((int)0)) ?
  22.177 +                    return i.equals(0) ?
  22.178                      Boolean.valueOf(false) :
  22.179                          Boolean.valueOf(true);
  22.180                  case java.sql.Types.TINYINT:
  22.181 @@ -4173,7 +4170,7 @@
  22.182              switch (trgType) {
  22.183                  case java.sql.Types.BIT:
  22.184                      Integer i = Integer.valueOf(srcObj.toString().trim());
  22.185 -                    return i.equals(Integer.valueOf((int)0)) ?
  22.186 +                    return i.equals(0) ?
  22.187                      Boolean.valueOf(false) :
  22.188                          Boolean.valueOf(true);
  22.189                  case java.sql.Types.BOOLEAN:
  22.190 @@ -4358,7 +4355,7 @@
  22.191          checkIndex(columnIndex);
  22.192          // make sure the cursor is on a valid row
  22.193          checkCursor();
  22.194 -        Object obj = convertNumeric(Integer.valueOf(x),
  22.195 +        Object obj = convertNumeric(x,
  22.196          java.sql.Types.INTEGER,
  22.197          RowSetMD.getColumnType(columnIndex));
  22.198  
  22.199 @@ -5709,7 +5706,7 @@
  22.200              Struct s = (Struct)value;
  22.201  
  22.202              // look up the class in the map
  22.203 -            Class c = (Class)map.get(s.getSQLTypeName());
  22.204 +            Class<?> c = map.get(s.getSQLTypeName());
  22.205              if (c != null) {
  22.206                  // create new instance of the class
  22.207                  SQLData obj = null;
  22.208 @@ -6293,7 +6290,7 @@
  22.209          int colCount = RowSetMD.getColumnCount();
  22.210          Row orig;
  22.211  
  22.212 -        for (Iterator i = rvh.iterator(); i.hasNext();) {
  22.213 +        for (Iterator<?> i = rvh.iterator(); i.hasNext();) {
  22.214              orig = new Row(colCount, ((Row)i.next()).getOrigRow());
  22.215              crs.rvh.add(orig);
  22.216          }
  22.217 @@ -6379,7 +6376,7 @@
  22.218       * @throws SQLException if an error occurs
  22.219       */
  22.220      public void setOriginal() throws SQLException {
  22.221 -        for (Iterator i = rvh.iterator(); i.hasNext();) {
  22.222 +        for (Iterator<?> i = rvh.iterator(); i.hasNext();) {
  22.223              Row row = (Row)i.next();
  22.224              makeRowOriginal(row);
  22.225              // remove deleted rows from the collection.
  22.226 @@ -6930,7 +6927,7 @@
  22.227           }
  22.228  
  22.229           for( int i = 0;i < columnIdxes.length ;i++) {
  22.230 -            iMatchColumns.set(i,Integer.valueOf(-1));
  22.231 +            iMatchColumns.set(i, -1);
  22.232           }
  22.233      }
  22.234  
  22.235 @@ -6998,7 +6995,7 @@
  22.236          int [] i_temp = new int[iMatchColumns.size()];
  22.237          int i_val;
  22.238  
  22.239 -        i_val = ((Integer)iMatchColumns.get(0)).intValue();
  22.240 +        i_val = iMatchColumns.get(0);
  22.241  
  22.242          if( i_val == -1 ) {
  22.243             throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.setmatchcols").toString());
  22.244 @@ -7039,7 +7036,7 @@
  22.245             }
  22.246          }
  22.247          for(int i = 0 ;i < columnIdxes.length; i++) {
  22.248 -           iMatchColumns.add(i,Integer.valueOf(columnIdxes[i]));
  22.249 +           iMatchColumns.add(i,columnIdxes[i]);
  22.250          }
  22.251      }
  22.252  
  22.253 @@ -7094,7 +7091,7 @@
  22.254              throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols1").toString());
  22.255          } else {
  22.256              // set iMatchColumn
  22.257 -            iMatchColumns.set(0, Integer.valueOf(columnIdx));
  22.258 +            iMatchColumns.set(0, columnIdx);
  22.259              //strMatchColumn = null;
  22.260          }
  22.261      }
  22.262 @@ -7147,7 +7144,7 @@
  22.263              throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch1").toString());
  22.264          } else {
  22.265                  // that is, we are unsetting it.
  22.266 -               iMatchColumns.set(0, Integer.valueOf(-1));
  22.267 +               iMatchColumns.set(0, -1);
  22.268          }
  22.269      }
  22.270  
  22.271 @@ -7171,7 +7168,7 @@
  22.272  
  22.273          if(!((strMatchColumns.get(0)).equals(columnName))) {
  22.274              throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch").toString());
  22.275 -        } else if( ((Integer)(iMatchColumns.get(0))).intValue() > 0) {
  22.276 +        } else if(iMatchColumns.get(0) > 0) {
  22.277              throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch2").toString());
  22.278          } else {
  22.279              strMatchColumns.set(0, null);   // that is, we are unsetting it.
  22.280 @@ -7369,7 +7366,7 @@
  22.281                      obj = new SerialArray((java.sql.Array)obj, map);
  22.282                  }
  22.283  
  22.284 -                ((Row)currentRow).initColumnObject(i, obj);
  22.285 +                currentRow.initColumnObject(i, obj);
  22.286              }
  22.287              rowsFetched++;
  22.288              maxRowsreached++;
    23.1 --- a/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java	Tue Dec 06 16:31:58 2011 -0800
    23.2 +++ b/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java	Mon Dec 19 10:06:23 2011 -0800
    23.3 @@ -66,6 +66,7 @@
    23.4       * @param env a Hashtable containing a desired synchconizatation provider
    23.5       * name-value pair.
    23.6       */
    23.7 +    @SuppressWarnings("rawtypes")
    23.8      public FilteredRowSetImpl(Hashtable env) throws SQLException {
    23.9          super(env);
   23.10      }
    24.1 --- a/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java	Tue Dec 06 16:31:58 2011 -0800
    24.2 +++ b/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java	Mon Dec 19 10:06:23 2011 -0800
    24.3 @@ -695,6 +695,7 @@
    24.4          return ps;
    24.5      }
    24.6  
    24.7 +    @SuppressWarnings("deprecation")
    24.8      private void decodeParams(Object[] params, PreparedStatement ps)
    24.9      throws SQLException {
   24.10  
   24.11 @@ -761,14 +762,17 @@
   24.12                              ps.setUnicodeStream(i + 1,
   24.13                                                  (java.io.InputStream)param[0],
   24.14                                                  ((Integer)param[1]).intValue());
   24.15 +                            break;
   24.16                          case JdbcRowSetImpl.BINARY_STREAM_PARAM:
   24.17                              ps.setBinaryStream(i + 1,
   24.18                                                 (java.io.InputStream)param[0],
   24.19                                                 ((Integer)param[1]).intValue());
   24.20 +                            break;
   24.21                          case JdbcRowSetImpl.ASCII_STREAM_PARAM:
   24.22                              ps.setAsciiStream(i + 1,
   24.23                                                (java.io.InputStream)param[0],
   24.24                                                ((Integer)param[1]).intValue());
   24.25 +                            break;
   24.26                          default:
   24.27                              throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.paramtype").toString());
   24.28                          }
   24.29 @@ -3822,7 +3826,7 @@
   24.30          int [] i_temp = new int[iMatchColumns.size()];
   24.31          int i_val;
   24.32  
   24.33 -        i_val = ((Integer)iMatchColumns.get(0)).intValue();
   24.34 +        i_val = iMatchColumns.get(0);
   24.35  
   24.36          if( i_val == -1 ) {
   24.37             throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.setmatchcols").toString());
   24.38 @@ -3996,7 +4000,7 @@
   24.39  
   24.40          if(!((strMatchColumns.get(0)).equals(columnName))) {
   24.41              throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.unsetmatch").toString());
   24.42 -        } else if( ((Integer)(iMatchColumns.get(0))).intValue() > 0) {
   24.43 +        } else if(iMatchColumns.get(0) > 0) {
   24.44              throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.usecolid").toString());
   24.45          } else {
   24.46              strMatchColumns.set(0, null);   // that is, we are unsetting it.
    25.1 --- a/src/share/classes/com/sun/rowset/JdbcRowSetResourceBundle.java	Tue Dec 06 16:31:58 2011 -0800
    25.2 +++ b/src/share/classes/com/sun/rowset/JdbcRowSetResourceBundle.java	Mon Dec 19 10:06:23 2011 -0800
    25.3 @@ -135,6 +135,7 @@
    25.4       * @return an enumeration of keys which have messages tranlated to
    25.5       * corresponding locales.
    25.6       */
    25.7 +    @SuppressWarnings("rawtypes")
    25.8      public Enumeration getKeys() {
    25.9         return propResBundle.getKeys();
   25.10      }
    26.1 --- a/src/share/classes/com/sun/rowset/JoinRowSetImpl.java	Tue Dec 06 16:31:58 2011 -0800
    26.2 +++ b/src/share/classes/com/sun/rowset/JoinRowSetImpl.java	Mon Dec 19 10:06:23 2011 -0800
    26.3 @@ -233,7 +233,7 @@
    26.4                }
    26.5                int[] indexes = new int[indices.size()];
    26.6                for(int i=0; i<indices.size();i++)
    26.7 -                  indexes[i] = ((Integer)indices.get(i)).intValue();
    26.8 +                  indexes[i] = indices.get(i);
    26.9                cRowset.setMatchColumn(indexes);
   26.10                // Set the match column here because join will be
   26.11                // based on columnId,
   26.12 @@ -413,6 +413,7 @@
   26.13       * @throws SQLException if an error occours generating a collection
   26.14       * of the originating RowSets contained within the JOIN.
   26.15       */
   26.16 +    @SuppressWarnings("rawtypes")
   26.17      public Collection getRowSets() throws SQLException {
   26.18          return vecRowSetsInJOIN;
   26.19      }
   26.20 @@ -893,7 +894,7 @@
   26.21  
   26.22         sz = vecRowSetsInJOIN.size();
   26.23         for(int i=0;i<sz; i++) {
   26.24 -          crs = (CachedRowSetImpl)vecRowSetsInJOIN.get(i);
   26.25 +          crs = vecRowSetsInJOIN.get(i);
   26.26            cols = crs.getMetaData().getColumnCount();
   26.27            tabName = tabName.concat(crs.getTableName());
   26.28            strTabName = strTabName.concat(tabName+", ");
   26.29 @@ -928,7 +929,7 @@
   26.30          // rowset1.getMatchColumnName() == rowset2.getMatchColumnName()
   26.31           for(int i=0;i<sz; i++) {
   26.32               strWhereClause = strWhereClause.concat(
   26.33 -               ((CachedRowSetImpl)vecRowSetsInJOIN.get(i)).getMatchColumnNames()[0]);
   26.34 +               vecRowSetsInJOIN.get(i).getMatchColumnNames()[0]);
   26.35               if(i%2!=0) {
   26.36                 strWhereClause = strWhereClause.concat("=");
   26.37               }  else {
   26.38 @@ -4175,7 +4176,7 @@
   26.39              // Default JoinRowSet type
   26.40              this.setJoinType(JoinRowSet.INNER_JOIN);
   26.41          }
   26.42 -        Integer i = (Integer)(vecJoinType.get(vecJoinType.size()-1));
   26.43 +        Integer i = vecJoinType.get(vecJoinType.size()-1);
   26.44          return i.intValue();
   26.45      }
   26.46  
    27.1 --- a/src/share/classes/com/sun/rowset/WebRowSetImpl.java	Tue Dec 06 16:31:58 2011 -0800
    27.2 +++ b/src/share/classes/com/sun/rowset/WebRowSetImpl.java	Mon Dec 19 10:06:23 2011 -0800
    27.3 @@ -1,5 +1,5 @@
    27.4  /*
    27.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    27.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
    27.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    27.8   *
    27.9   * This code is free software; you can redistribute it and/or modify it
   27.10 @@ -101,6 +101,7 @@
   27.11       * synchronization providers for the relational and XML providers; or
   27.12       * if the Hashtanle is null
   27.13       */
   27.14 +    @SuppressWarnings("rawtypes")
   27.15      public WebRowSetImpl(Hashtable env) throws SQLException {
   27.16  
   27.17          try {
   27.18 @@ -117,7 +118,7 @@
   27.19              (String)env.get(javax.sql.rowset.spi.SyncFactory.ROWSET_SYNC_PROVIDER);
   27.20  
   27.21          // set the Reader, this maybe overridden latter
   27.22 -        provider = (SyncProvider)SyncFactory.getInstance(providerName);
   27.23 +        provider = SyncFactory.getInstance(providerName);
   27.24  
   27.25          // xmlReader = provider.getRowSetReader();
   27.26          // xmlWriter = provider.getRowSetWriter();
    28.1 --- a/src/share/classes/com/sun/rowset/internal/CachedRowSetReader.java	Tue Dec 06 16:31:58 2011 -0800
    28.2 +++ b/src/share/classes/com/sun/rowset/internal/CachedRowSetReader.java	Mon Dec 19 10:06:23 2011 -0800
    28.3 @@ -363,6 +363,7 @@
    28.4       *               the given parameters are to be set
    28.5       * @throws SQLException if an access error occurs
    28.6       */
    28.7 +    @SuppressWarnings("deprecation")
    28.8      private void decodeParams(Object[] params,
    28.9                                PreparedStatement pstmt) throws SQLException {
   28.10      // There is a corresponding decodeParams in JdbcRowSetImpl
   28.11 @@ -428,14 +429,17 @@
   28.12                              pstmt.setUnicodeStream(i + 1,
   28.13                                                  (java.io.InputStream)param[0],
   28.14                                                  ((Integer)param[1]).intValue());
   28.15 +                            break;
   28.16                          case CachedRowSetImpl.BINARY_STREAM_PARAM:
   28.17                              pstmt.setBinaryStream(i + 1,
   28.18                                                 (java.io.InputStream)param[0],
   28.19                                                 ((Integer)param[1]).intValue());
   28.20 +                            break;
   28.21                          case CachedRowSetImpl.ASCII_STREAM_PARAM:
   28.22                              pstmt.setAsciiStream(i + 1,
   28.23                                                (java.io.InputStream)param[0],
   28.24                                                ((Integer)param[1]).intValue());
   28.25 +                            break;
   28.26                          default:
   28.27                              throw new SQLException(resBundle.handleGetObject("crsreader.paramtype").toString());
   28.28                          }
    29.1 --- a/src/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java	Tue Dec 06 16:31:58 2011 -0800
    29.2 +++ b/src/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java	Mon Dec 19 10:06:23 2011 -0800
    29.3 @@ -183,7 +183,7 @@
    29.4  /**
    29.5   * This <code>ArrayList<code> will hold the values of SyncResolver.*
    29.6   */
    29.7 -    private ArrayList status;
    29.8 +    private ArrayList<Integer> status;
    29.9  
   29.10  /**
   29.11   * This will check whether the same field value has changed both
   29.12 @@ -305,7 +305,7 @@
   29.13  
   29.14          iColCount = rsmdWrite.getColumnCount();
   29.15          int sz= crs.size()+1;
   29.16 -        status = new ArrayList(sz);
   29.17 +        status = new ArrayList<>(sz);
   29.18  
   29.19          status.add(0,null);
   29.20          rsmdResolv.setColumnCount(iColCount);
   29.21 @@ -338,11 +338,11 @@
   29.22              if (crs.rowDeleted()) {
   29.23                  // The row has been deleted.
   29.24                  if (conflict = (deleteOriginalRow(crs, this.crsResolve)) == true) {
   29.25 -                       status.add(rows, Integer.valueOf(SyncResolver.DELETE_ROW_CONFLICT));
   29.26 +                       status.add(rows, SyncResolver.DELETE_ROW_CONFLICT);
   29.27                  } else {
   29.28                        // delete happened without any occurrence of conflicts
   29.29                        // so update status accordingly
   29.30 -                       status.add(rows, Integer.valueOf(SyncResolver.NO_ROW_CONFLICT));
   29.31 +                       status.add(rows, SyncResolver.NO_ROW_CONFLICT);
   29.32                  }
   29.33  
   29.34             } else if (crs.rowInserted()) {
   29.35 @@ -350,20 +350,20 @@
   29.36  
   29.37                  pstmtIns = con.prepareStatement(insertCmd);
   29.38                  if ( (conflict = insertNewRow(crs, pstmtIns, this.crsResolve)) == true) {
   29.39 -                          status.add(rows, Integer.valueOf(SyncResolver.INSERT_ROW_CONFLICT));
   29.40 +                          status.add(rows, SyncResolver.INSERT_ROW_CONFLICT);
   29.41                  } else {
   29.42                        // insert happened without any occurrence of conflicts
   29.43                        // so update status accordingly
   29.44 -                       status.add(rows, Integer.valueOf(SyncResolver.NO_ROW_CONFLICT));
   29.45 +                       status.add(rows, SyncResolver.NO_ROW_CONFLICT);
   29.46                  }
   29.47              } else  if (crs.rowUpdated()) {
   29.48                    // The row has been updated.
   29.49                         if ( conflict = (updateOriginalRow(crs)) == true) {
   29.50 -                             status.add(rows, Integer.valueOf(SyncResolver.UPDATE_ROW_CONFLICT));
   29.51 +                             status.add(rows, SyncResolver.UPDATE_ROW_CONFLICT);
   29.52                 } else {
   29.53                        // update happened without any occurrence of conflicts
   29.54                        // so update status accordingly
   29.55 -                      status.add(rows, Integer.valueOf(SyncResolver.NO_ROW_CONFLICT));
   29.56 +                      status.add(rows, SyncResolver.NO_ROW_CONFLICT);
   29.57                 }
   29.58  
   29.59              } else {
   29.60 @@ -375,7 +375,7 @@
   29.61                  *  that is fine.
   29.62                  **/
   29.63                  int icolCount = crs.getMetaData().getColumnCount();
   29.64 -                status.add(rows, Integer.valueOf(SyncResolver.NO_ROW_CONFLICT));
   29.65 +                status.add(rows, SyncResolver.NO_ROW_CONFLICT);
   29.66  
   29.67                  this.crsResolve.moveToInsertRow();
   29.68                  for(int cols=0;cols<iColCount;cols++) {
   29.69 @@ -398,7 +398,7 @@
   29.70        boolean boolConf = false;
   29.71        for (int j=1;j<status.size();j++){
   29.72            // ignore status for index = 0 which is set to null
   29.73 -          if(! ((status.get(j)).equals(Integer.valueOf(SyncResolver.NO_ROW_CONFLICT)))) {
   29.74 +          if(! ((status.get(j)).equals(SyncResolver.NO_ROW_CONFLICT))) {
   29.75                // there is at least one conflict which needs to be resolved
   29.76                boolConf = true;
   29.77               break;
   29.78 @@ -540,7 +540,7 @@
   29.79  
   29.80                  // how many fields need to be updated
   29.81                  int colsNotChanged = 0;
   29.82 -                Vector cols = new Vector();
   29.83 +                Vector<Integer> cols = new Vector<>();
   29.84                  String updateExec = updateCmd;
   29.85                  Object orig;
   29.86                  Object curr;
   29.87 @@ -566,14 +566,14 @@
   29.88                   * into a CachedRowSet so that comparison of the column values
   29.89                   * from the ResultSet and CachedRowSet are possible
   29.90                   */
   29.91 -                Map map = (crs.getTypeMap() == null)?con.getTypeMap():crs.getTypeMap();
   29.92 +                Map<String, Class<?>> map = (crs.getTypeMap() == null)?con.getTypeMap():crs.getTypeMap();
   29.93                  if (rsval instanceof Struct) {
   29.94  
   29.95                      Struct s = (Struct)rsval;
   29.96  
   29.97                      // look up the class in the map
   29.98 -                    Class c = null;
   29.99 -                    c = (Class)map.get(s.getSQLTypeName());
  29.100 +                    Class<?> c = null;
  29.101 +                    c = map.get(s.getSQLTypeName());
  29.102                      if (c != null) {
  29.103                          // create new instance of the class
  29.104                          SQLData obj = null;
  29.105 @@ -652,7 +652,7 @@
  29.106                            updateExec += ", ";
  29.107                           }
  29.108                          updateExec += crs.getMetaData().getColumnName(i);
  29.109 -                        cols.add(Integer.valueOf(i));
  29.110 +                        cols.add(i);
  29.111                          updateExec += " = ? ";
  29.112                          first = false;
  29.113  
  29.114 @@ -698,7 +698,7 @@
  29.115                                      updateExec += ", ";
  29.116                                   }
  29.117                                  updateExec += crs.getMetaData().getColumnName(i);
  29.118 -                                cols.add(Integer.valueOf(i));
  29.119 +                                cols.add(i);
  29.120                                  updateExec += " = ? ";
  29.121                                  flag = false;
  29.122                               } else {
  29.123 @@ -749,7 +749,7 @@
  29.124  
  29.125                  // Comments needed here
  29.126                  for (i = 0; i < cols.size(); i++) {
  29.127 -                    Object obj = crs.getObject(((Integer)cols.get(i)).intValue());
  29.128 +                    Object obj = crs.getObject(cols.get(i));
  29.129                      if (obj != null)
  29.130                          pstmt.setObject(i + 1, obj);
  29.131                      else
    30.1 --- a/src/share/classes/com/sun/rowset/internal/Row.java	Tue Dec 06 16:31:58 2011 -0800
    30.2 +++ b/src/share/classes/com/sun/rowset/internal/Row.java	Mon Dec 19 10:06:23 2011 -0800
    30.3 @@ -1,5 +1,5 @@
    30.4  /*
    30.5 - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
    30.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
    30.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    30.8   *
    30.9   * This code is free software; you can redistribute it and/or modify it
   30.10 @@ -27,9 +27,7 @@
   30.11  
   30.12  import java.sql.*;
   30.13  import java.io.*;
   30.14 -import java.math.*;
   30.15  import java.lang.*;
   30.16 -import java.lang.reflect.*;
   30.17  import java.util.*;
   30.18  
   30.19  /**
   30.20 @@ -48,6 +46,8 @@
   30.21   */
   30.22  public class Row extends BaseRow implements Serializable, Cloneable {
   30.23  
   30.24 +static final long serialVersionUID = 5047859032611314762L;
   30.25 +
   30.26  /**
   30.27   * An array containing the current column values for this <code>Row</code>
   30.28   * object.
   30.29 @@ -115,9 +115,7 @@
   30.30   */
   30.31      public Row(int numCols, Object[] vals) {
   30.32          origVals = new Object[numCols];
   30.33 -        for (int i=0; i < numCols; i++) {
   30.34 -            origVals[i] = vals[i];
   30.35 -        }
   30.36 +        System.arraycopy(vals, 0, origVals, 0, numCols);
   30.37          currentVals = new Object[numCols];
   30.38          colsChanged = new BitSet(numCols);
   30.39          this.numCols = numCols;
    31.1 --- a/src/share/classes/com/sun/rowset/internal/SyncResolverImpl.java	Tue Dec 06 16:31:58 2011 -0800
    31.2 +++ b/src/share/classes/com/sun/rowset/internal/SyncResolverImpl.java	Mon Dec 19 10:06:23 2011 -0800
    31.3 @@ -65,7 +65,7 @@
    31.4       *  This ArrayList will contain the status of a row
    31.5       *  from the SyncResolver.* values else it will be null.
    31.6       */
    31.7 -    private ArrayList stats;
    31.8 +    private ArrayList<?> stats;
    31.9  
   31.10      /**
   31.11       * The RowSetWriter associated with the original
   31.12 @@ -429,6 +429,7 @@
   31.13       * This is used to set the status of each row
   31.14       * to either of the values SyncResolver.*_CONFLICT
   31.15       **/
   31.16 +    @SuppressWarnings("rawtypes")
   31.17      void setStatus(ArrayList status){
   31.18               stats = status;
   31.19      }
   31.20 @@ -856,6 +857,7 @@
   31.21       * @see #toCollection(String)
   31.22       * @see java.util.TreeMap
   31.23       */
   31.24 +    @SuppressWarnings("rawtypes")
   31.25      public Collection toCollection() throws SQLException {
   31.26         throw new UnsupportedOperationException();
   31.27      }
   31.28 @@ -878,6 +880,7 @@
   31.29       * @see #toCollection(String)
   31.30       * @see java.util.Vector
   31.31       */
   31.32 +    @SuppressWarnings("rawtypes")
   31.33      public Collection toCollection(int column) throws SQLException {
   31.34         throw new UnsupportedOperationException();
   31.35      }
   31.36 @@ -900,6 +903,7 @@
   31.37       * @see #toCollection(int)
   31.38       * @see java.util.Vector
   31.39       */
   31.40 +    @SuppressWarnings("rawtypes")
   31.41      public Collection toCollection(String column) throws SQLException {
   31.42          throw new UnsupportedOperationException();
   31.43      }
    32.1 --- a/src/share/classes/com/sun/rowset/internal/WebRowSetXmlWriter.java	Tue Dec 06 16:31:58 2011 -0800
    32.2 +++ b/src/share/classes/com/sun/rowset/internal/WebRowSetXmlWriter.java	Mon Dec 19 10:06:23 2011 -0800
    32.3 @@ -55,7 +55,7 @@
    32.4       * object will use for storing the tags to be used for writing the calling
    32.5       * <code>WebRowSet</code> object as an XML document.
    32.6       */
    32.7 -    private java.util.Stack stack;
    32.8 +    private java.util.Stack<String> stack;
    32.9  
   32.10      private  JdbcRowSetResourceBundle resBundle;
   32.11  
   32.12 @@ -94,7 +94,7 @@
   32.13      throws SQLException {
   32.14  
   32.15          // create a new stack for tag checking.
   32.16 -        stack = new java.util.Stack();
   32.17 +        stack = new java.util.Stack<>();
   32.18          writer = wrt;
   32.19          writeRowSet(caller);
   32.20      }
   32.21 @@ -127,7 +127,7 @@
   32.22      throws SQLException {
   32.23  
   32.24          // create a new stack for tag checking.
   32.25 -        stack = new java.util.Stack();
   32.26 +        stack = new java.util.Stack<>();
   32.27          writer = new OutputStreamWriter(oStream);
   32.28          writeRowSet(caller);
   32.29      }
   32.30 @@ -205,10 +205,10 @@
   32.31  
   32.32              //Changed to beginSection and endSection for maps for proper indentation
   32.33              beginSection("map");
   32.34 -            java.util.Map typeMap = caller.getTypeMap();
   32.35 +            java.util.Map<?,?> typeMap = caller.getTypeMap();
   32.36              if (typeMap != null) {
   32.37 -                Iterator i = typeMap.keySet().iterator();
   32.38 -                Class c;
   32.39 +                Iterator<?> i = typeMap.keySet().iterator();
   32.40 +                Class<?> c;
   32.41                  String type;
   32.42                  while (i.hasNext()) {
   32.43                      type = (String)i.next();
   32.44 @@ -532,7 +532,7 @@
   32.45      }
   32.46  
   32.47      private String getTag() {
   32.48 -        return (String)stack.pop();
   32.49 +        return stack.pop();
   32.50      }
   32.51  
   32.52      private void writeNull() throws java.io.IOException {
    33.1 --- a/src/share/classes/com/sun/rowset/internal/XmlReaderContentHandler.java	Tue Dec 06 16:31:58 2011 -0800
    33.2 +++ b/src/share/classes/com/sun/rowset/internal/XmlReaderContentHandler.java	Mon Dec 19 10:06:23 2011 -0800
    33.3 @@ -1,5 +1,5 @@
    33.4  /*
    33.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    33.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
    33.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    33.8   *
    33.9   * This code is free software; you can redistribute it and/or modify it
   33.10 @@ -71,14 +71,14 @@
   33.11  
   33.12  public class XmlReaderContentHandler extends DefaultHandler {
   33.13  
   33.14 -    private HashMap propMap;
   33.15 -    private HashMap colDefMap;
   33.16 -    private HashMap dataMap;
   33.17 +    private HashMap <String, Integer> propMap;
   33.18 +    private HashMap <String, Integer> colDefMap;
   33.19 +    private HashMap <String, Integer> dataMap;
   33.20  
   33.21 -    private HashMap typeMap;
   33.22 +    private HashMap<String,Class<?>> typeMap;
   33.23  
   33.24 -    private Vector updates;
   33.25 -    private Vector keyCols;
   33.26 +    private Vector<Object[]> updates;
   33.27 +    private Vector<String> keyCols;
   33.28  
   33.29      private String columnValue;
   33.30      private String propertyValue;
   33.31 @@ -438,7 +438,7 @@
   33.32          initMaps();
   33.33  
   33.34          // allocate the collection for the updates
   33.35 -        updates = new Vector();
   33.36 +        updates = new Vector<>();
   33.37  
   33.38          // start out with the empty string
   33.39          columnValue = "";
   33.40 @@ -477,21 +477,21 @@
   33.41      private void initMaps() {
   33.42          int items, i;
   33.43  
   33.44 -        propMap = new HashMap();
   33.45 +        propMap = new HashMap<>();
   33.46          items = properties.length;
   33.47  
   33.48          for (i=0;i<items;i++) {
   33.49              propMap.put(properties[i], Integer.valueOf(i));
   33.50          }
   33.51  
   33.52 -        colDefMap = new HashMap();
   33.53 +        colDefMap = new HashMap<>();
   33.54          items = colDef.length;
   33.55  
   33.56          for (i=0;i<items;i++) {
   33.57              colDefMap.put(colDef[i], Integer.valueOf(i));
   33.58          }
   33.59  
   33.60 -        dataMap = new HashMap();
   33.61 +        dataMap = new HashMap<>();
   33.62          items = data.length;
   33.63  
   33.64          for (i=0;i<items;i++) {
   33.65 @@ -499,7 +499,7 @@
   33.66          }
   33.67  
   33.68          //Initialize connection map here
   33.69 -        typeMap = new HashMap();
   33.70 +        typeMap = new HashMap<>();
   33.71      }
   33.72  
   33.73      public void startDocument() throws SAXException {
   33.74 @@ -549,14 +549,14 @@
   33.75          case PROPERTIES:
   33.76  
   33.77              tempCommand = "";
   33.78 -            tag = ((Integer)propMap.get(name)).intValue();
   33.79 +            tag = propMap.get(name);
   33.80              if (tag == PropNullTag)
   33.81                 setNullValue(true);
   33.82              else
   33.83                  setTag(tag);
   33.84              break;
   33.85          case METADATA:
   33.86 -            tag = ((Integer)colDefMap.get(name)).intValue();
   33.87 +            tag = colDefMap.get(name);
   33.88  
   33.89              if (tag == MetaNullTag)
   33.90                  setNullValue(true);
   33.91 @@ -573,10 +573,10 @@
   33.92              tempUpdate = "";
   33.93              if(dataMap.get(name) == null) {
   33.94                  tag = NullTag;
   33.95 -            } else if(((Integer)dataMap.get(name)).intValue() == EmptyStringTag) {
   33.96 +            } else if(dataMap.get(name) == EmptyStringTag) {
   33.97                  tag = EmptyStringTag;
   33.98              } else {
   33.99 -                 tag = ((Integer)dataMap.get(name)).intValue();
  33.100 +                 tag = dataMap.get(name);
  33.101              }
  33.102  
  33.103              if (tag == NullTag) {
  33.104 @@ -630,6 +630,7 @@
  33.105       *
  33.106       * @exception SAXException if a general SAX error occurs
  33.107       */
  33.108 +    @SuppressWarnings("fallthrough")
  33.109      public void endElement(String uri, String lName, String qName) throws SAXException {
  33.110          int tag;
  33.111  
  33.112 @@ -644,13 +645,13 @@
  33.113              }
  33.114  
  33.115              try {
  33.116 -                tag = ((Integer)propMap.get(name)).intValue();
  33.117 +                tag = propMap.get(name);
  33.118                  switch (tag) {
  33.119                  case KeycolsTag:
  33.120                      if (keyCols != null) {
  33.121                          int i[] = new int[keyCols.size()];
  33.122                          for (int j = 0; j < i.length; j++)
  33.123 -                            i[j] = Integer.parseInt((String)keyCols.elementAt(j));
  33.124 +                            i[j] = Integer.parseInt(keyCols.elementAt(j));
  33.125                          rs.setKeyColumns(i);
  33.126                      }
  33.127                      break;
  33.128 @@ -723,7 +724,7 @@
  33.129              if(dataMap.get(name) == null) {
  33.130                  tag = NullTag;
  33.131              } else {
  33.132 -                 tag = ((Integer)dataMap.get(name)).intValue();
  33.133 +                 tag = dataMap.get(name);
  33.134              }
  33.135              switch (tag) {
  33.136              case ColTag:
  33.137 @@ -820,7 +821,7 @@
  33.138          if (updates.size() > 0) {
  33.139              try {
  33.140                  Object upd[];
  33.141 -                Iterator i = updates.iterator();
  33.142 +                Iterator<?> i = updates.iterator();
  33.143                  while (i.hasNext()) {
  33.144                      upd = (Object [])i.next();
  33.145                      idx = ((Integer)upd[0]).intValue();
  33.146 @@ -1075,7 +1076,7 @@
  33.147              break;
  33.148          case PropColumnTag:
  33.149              if (keyCols == null)
  33.150 -                keyCols = new Vector();
  33.151 +                keyCols = new Vector<>();
  33.152              keyCols.add(s);
  33.153              break;
  33.154          case MapTag:
    34.1 --- a/src/share/classes/java/applet/Applet.java	Tue Dec 06 16:31:58 2011 -0800
    34.2 +++ b/src/share/classes/java/applet/Applet.java	Mon Dec 19 10:06:23 2011 -0800
    34.3 @@ -117,7 +117,7 @@
    34.4                  s.checkPermission(new AWTPermission("setAppletStub"));
    34.5              }
    34.6          }
    34.7 -        this.stub = (AppletStub)stub;
    34.8 +        this.stub = stub;
    34.9      }
   34.10  
   34.11      /**
   34.12 @@ -210,6 +210,7 @@
   34.13       * @param   width    the new requested width for the applet.
   34.14       * @param   height   the new requested height for the applet.
   34.15       */
   34.16 +    @SuppressWarnings("deprecation")
   34.17      public void resize(int width, int height) {
   34.18          Dimension d = size();
   34.19          if ((d.width != width) || (d.height != height)) {
   34.20 @@ -225,6 +226,7 @@
   34.21       *
   34.22       * @param   d   an object giving the new width and height.
   34.23       */
   34.24 +    @SuppressWarnings("deprecation")
   34.25      public void resize(Dimension d) {
   34.26          resize(d.width, d.height);
   34.27      }
    35.1 --- a/src/share/classes/java/awt/Component.java	Tue Dec 06 16:31:58 2011 -0800
    35.2 +++ b/src/share/classes/java/awt/Component.java	Mon Dec 19 10:06:23 2011 -0800
    35.3 @@ -666,9 +666,10 @@
    35.4       * can lead to a deadlock if client code also uses synchronization
    35.5       * by a component object. For every such situation revealed we should
    35.6       * consider possibility of replacing "this" with the package private
    35.7 -     * objectLock object introduced below. So far there're 2 issues known:
    35.8 +     * objectLock object introduced below. So far there're 3 issues known:
    35.9       * - CR 6708322 (the getName/setName methods);
   35.10 -     * - CR 6608764 (the PropertyChangeListener machinery).
   35.11 +     * - CR 6608764 (the PropertyChangeListener machinery);
   35.12 +     * - CR 7108598 (the Container.paint/KeyboardFocusManager.clearMostRecentFocusOwner methods).
   35.13       *
   35.14       * Note: this field is considered final, though readObject() prohibits
   35.15       * initializing final fields.
   35.16 @@ -1158,6 +1159,10 @@
   35.17      boolean updateGraphicsData(GraphicsConfiguration gc) {
   35.18          checkTreeLock();
   35.19  
   35.20 +        if (graphicsConfig == gc) {
   35.21 +            return false;
   35.22 +        }
   35.23 +
   35.24          graphicsConfig = gc;
   35.25  
   35.26          ComponentPeer peer = getPeer();
    36.1 --- a/src/share/classes/java/awt/Container.java	Tue Dec 06 16:31:58 2011 -0800
    36.2 +++ b/src/share/classes/java/awt/Container.java	Mon Dec 19 10:06:23 2011 -0800
    36.3 @@ -1950,7 +1950,7 @@
    36.4       */
    36.5      public void paint(Graphics g) {
    36.6          if (isShowing()) {
    36.7 -            synchronized (this) {
    36.8 +            synchronized (getObjectLock()) {
    36.9                  if (printing) {
   36.10                      if (printingThreads.contains(Thread.currentThread())) {
   36.11                          return;
   36.12 @@ -2004,7 +2004,7 @@
   36.13          if (isShowing()) {
   36.14              Thread t = Thread.currentThread();
   36.15              try {
   36.16 -                synchronized (this) {
   36.17 +                synchronized (getObjectLock()) {
   36.18                      if (printingThreads == null) {
   36.19                          printingThreads = new HashSet();
   36.20                      }
   36.21 @@ -2013,7 +2013,7 @@
   36.22                  }
   36.23                  super.print(g);  // By default, Component.print() calls paint()
   36.24              } finally {
   36.25 -                synchronized (this) {
   36.26 +                synchronized (getObjectLock()) {
   36.27                      printingThreads.remove(t);
   36.28                      printing = !printingThreads.isEmpty();
   36.29                  }
    37.1 --- a/src/share/classes/java/awt/font/StyledParagraph.java	Tue Dec 06 16:31:58 2011 -0800
    37.2 +++ b/src/share/classes/java/awt/font/StyledParagraph.java	Mon Dec 19 10:06:23 2011 -0800
    37.3 @@ -34,6 +34,7 @@
    37.4  import java.awt.im.InputMethodHighlight;
    37.5  import java.text.Annotation;
    37.6  import java.text.AttributedCharacterIterator;
    37.7 +import java.text.AttributedCharacterIterator.Attribute;
    37.8  import java.util.Vector;
    37.9  import java.util.HashMap;
   37.10  import java.util.Map;
   37.11 @@ -65,7 +66,7 @@
   37.12      // If there are multiple Decorations in the paragraph, they are
   37.13      // stored in this Vector, in order.  Otherwise this vector and
   37.14      // the decorationStarts array are null.
   37.15 -    private Vector decorations;
   37.16 +    private Vector<Decoration> decorations;
   37.17      // If there are multiple Decorations in the paragraph,
   37.18      // decorationStarts[i] contains the index where decoration i
   37.19      // starts.  For convenience, there is an extra entry at the
   37.20 @@ -76,7 +77,7 @@
   37.21      // they are
   37.22      // stored in this Vector, in order.  Otherwise this vector and
   37.23      // the fontStarts array are null.
   37.24 -    private Vector fonts;
   37.25 +    private Vector<Object> fonts;
   37.26      // If there are multiple Fonts/GraphicAttributes in the paragraph,
   37.27      // fontStarts[i] contains the index where decoration i
   37.28      // starts.  For convenience, there is an extra entry at the
   37.29 @@ -104,7 +105,7 @@
   37.30              final int nextRunStart = aci.getRunLimit();
   37.31              final int localIndex = index-start;
   37.32  
   37.33 -            Map attributes = aci.getAttributes();
   37.34 +            Map<? extends Attribute, ?> attributes = aci.getAttributes();
   37.35              attributes = addInputMethodAttrs(attributes);
   37.36              Decoration d = Decoration.getDecoration(attributes);
   37.37              addDecoration(d, localIndex);
   37.38 @@ -168,7 +169,8 @@
   37.39          char ch = aci.setIndex(insertPos);
   37.40          int relativePos = Math.max(insertPos - aci.getBeginIndex() - 1, 0);
   37.41  
   37.42 -        Map attributes = addInputMethodAttrs(aci.getAttributes());
   37.43 +        Map<? extends Attribute, ?> attributes =
   37.44 +            addInputMethodAttrs(aci.getAttributes());
   37.45          Decoration d = Decoration.getDecoration(attributes);
   37.46          if (!oldParagraph.getDecorationAt(relativePos).equals(d)) {
   37.47              return new StyledParagraph(aci, chars);
   37.48 @@ -297,7 +299,7 @@
   37.49              return decoration;
   37.50          }
   37.51          int run = findRunContaining(index, decorationStarts);
   37.52 -        return (Decoration) decorations.elementAt(run);
   37.53 +        return decorations.elementAt(run);
   37.54      }
   37.55  
   37.56      /**
   37.57 @@ -339,6 +341,7 @@
   37.58       * starts array does not have room for the index, a
   37.59       * new array is created and returned.
   37.60       */
   37.61 +    @SuppressWarnings({"rawtypes", "unchecked"})
   37.62      private static int[] addToVector(Object obj,
   37.63                                       int index,
   37.64                                       Vector v,
   37.65 @@ -374,7 +377,7 @@
   37.66          }
   37.67          else {
   37.68              if (!decoration.equals(d)) {
   37.69 -                decorations = new Vector(INITIAL_SIZE);
   37.70 +                decorations = new Vector<Decoration>(INITIAL_SIZE);
   37.71                  decorations.addElement(decoration);
   37.72                  decorations.addElement(d);
   37.73                  decorationStarts = new int[INITIAL_SIZE];
   37.74 @@ -398,7 +401,7 @@
   37.75          }
   37.76          else {
   37.77              if (!font.equals(f)) {
   37.78 -                fonts = new Vector(INITIAL_SIZE);
   37.79 +                fonts = new Vector<Object>(INITIAL_SIZE);
   37.80                  fonts.addElement(font);
   37.81                  fonts.addElement(f);
   37.82                  fontStarts = new int[INITIAL_SIZE];
   37.83 @@ -412,7 +415,8 @@
   37.84       * Resolve the given chars into Fonts using FontResolver, then add
   37.85       * font runs for each.
   37.86       */
   37.87 -    private void addFonts(char[] chars, Map attributes, int start, int limit) {
   37.88 +    private void addFonts(char[] chars, Map<? extends Attribute, ?> attributes,
   37.89 +                          int start, int limit) {
   37.90  
   37.91          FontResolver resolver = FontResolver.getInstance();
   37.92          CodePointIterator iter = CodePointIterator.create(chars, start, limit);
   37.93 @@ -426,7 +430,8 @@
   37.94       * Return a Map with entries from oldStyles, as well as input
   37.95       * method entries, if any.
   37.96       */
   37.97 -    static Map addInputMethodAttrs(Map oldStyles) {
   37.98 +    static Map<? extends Attribute, ?>
   37.99 +           addInputMethodAttrs(Map<? extends Attribute, ?> oldStyles) {
  37.100  
  37.101          Object value = oldStyles.get(TextAttribute.INPUT_METHOD_HIGHLIGHT);
  37.102  
  37.103 @@ -439,7 +444,7 @@
  37.104                  InputMethodHighlight hl;
  37.105                  hl = (InputMethodHighlight) value;
  37.106  
  37.107 -                Map imStyles = null;
  37.108 +                Map<? extends Attribute, ?> imStyles = null;
  37.109                  try {
  37.110                      imStyles = hl.getStyle();
  37.111                  } catch (NoSuchMethodError e) {
  37.112 @@ -451,7 +456,8 @@
  37.113                  }
  37.114  
  37.115                  if (imStyles != null) {
  37.116 -                    HashMap newStyles = new HashMap(5, (float)0.9);
  37.117 +                    HashMap<Attribute, Object>
  37.118 +                        newStyles = new HashMap<>(5, (float)0.9);
  37.119                      newStyles.putAll(oldStyles);
  37.120  
  37.121                      newStyles.putAll(imStyles);
  37.122 @@ -471,7 +477,8 @@
  37.123       * If attributes does not contain a GraphicAttribute, Font, or
  37.124       * Font family entry this method returns null.
  37.125       */
  37.126 -    private static Object getGraphicOrFont(Map attributes) {
  37.127 +    private static Object getGraphicOrFont(
  37.128 +            Map<? extends Attribute, ?> attributes) {
  37.129  
  37.130          Object value = attributes.get(TextAttribute.CHAR_REPLACEMENT);
  37.131          if (value != null) {
    38.1 --- a/src/share/classes/java/awt/font/TextAttribute.java	Tue Dec 06 16:31:58 2011 -0800
    38.2 +++ b/src/share/classes/java/awt/font/TextAttribute.java	Mon Dec 19 10:06:23 2011 -0800
    38.3 @@ -257,7 +257,8 @@
    38.4  public final class TextAttribute extends Attribute {
    38.5  
    38.6      // table of all instances in this class, used by readResolve
    38.7 -    private static final Map instanceMap = new HashMap(29);
    38.8 +    private static final Map<String, TextAttribute>
    38.9 +            instanceMap = new HashMap<String, TextAttribute>(29);
   38.10  
   38.11      /**
   38.12       * Constructs a <code>TextAttribute</code> with the specified name.
   38.13 @@ -280,7 +281,7 @@
   38.14                  "subclass didn't correctly implement readResolve");
   38.15          }
   38.16  
   38.17 -        TextAttribute instance = (TextAttribute) instanceMap.get(getName());
   38.18 +        TextAttribute instance = instanceMap.get(getName());
   38.19          if (instance != null) {
   38.20              return instance;
   38.21          } else {
    39.1 --- a/src/share/classes/java/awt/font/TextLayout.java	Tue Dec 06 16:31:58 2011 -0800
    39.2 +++ b/src/share/classes/java/awt/font/TextLayout.java	Mon Dec 19 10:06:23 2011 -0800
    39.3 @@ -55,6 +55,7 @@
    39.4  import java.text.AttributedString;
    39.5  import java.text.AttributedCharacterIterator;
    39.6  import java.text.AttributedCharacterIterator.Attribute;
    39.7 +import java.text.CharacterIterator;
    39.8  import java.util.Map;
    39.9  import java.util.HashMap;
   39.10  import java.util.Hashtable;
   39.11 @@ -382,7 +383,7 @@
   39.12              throw new IllegalArgumentException("Zero length string passed to TextLayout constructor.");
   39.13          }
   39.14  
   39.15 -        Map attributes = null;
   39.16 +        Map<? extends Attribute, ?> attributes = null;
   39.17          if (font.hasLayoutAttributes()) {
   39.18              attributes = font.getAttributes();
   39.19          }
   39.20 @@ -451,7 +452,7 @@
   39.21      private static Font singleFont(char[] text,
   39.22                                     int start,
   39.23                                     int limit,
   39.24 -                                   Map attributes) {
   39.25 +                                   Map<? extends Attribute, ?> attributes) {
   39.26  
   39.27          if (attributes.get(TextAttribute.CHAR_REPLACEMENT) != null) {
   39.28              return null;
   39.29 @@ -516,14 +517,17 @@
   39.30          text.first();
   39.31          char[] chars = new char[len];
   39.32          int n = 0;
   39.33 -        for (char c = text.first(); c != text.DONE; c = text.next()) {
   39.34 +        for (char c = text.first();
   39.35 +             c != CharacterIterator.DONE;
   39.36 +             c = text.next())
   39.37 +        {
   39.38              chars[n++] = c;
   39.39          }
   39.40  
   39.41          text.first();
   39.42          if (text.getRunLimit() == limit) {
   39.43  
   39.44 -            Map attributes = text.getAttributes();
   39.45 +            Map<? extends Attribute, ?> attributes = text.getAttributes();
   39.46              Font font = singleFont(chars, 0, len, attributes);
   39.47              if (font != null) {
   39.48                  fastInit(chars, font, attributes, frc);
   39.49 @@ -561,7 +565,9 @@
   39.50      /**
   39.51       * Initialize the paragraph-specific data.
   39.52       */
   39.53 -    private void paragraphInit(byte aBaseline, CoreMetrics lm, Map paragraphAttrs, char[] text) {
   39.54 +    private void paragraphInit(byte aBaseline, CoreMetrics lm,
   39.55 +                               Map<? extends Attribute, ?> paragraphAttrs,
   39.56 +                               char[] text) {
   39.57  
   39.58          baseline = aBaseline;
   39.59  
   39.60 @@ -581,7 +587,10 @@
   39.61       * all renderable by one font (ie no embedded graphics)
   39.62       * all on one baseline
   39.63       */
   39.64 -    private void fastInit(char[] chars, Font font, Map attrs, FontRenderContext frc) {
   39.65 +    private void fastInit(char[] chars, Font font,
   39.66 +                          Map<? extends Attribute, ?> attrs,
   39.67 +                          FontRenderContext frc) {
   39.68 +
   39.69          // Object vf = attrs.get(TextAttribute.ORIENTATION);
   39.70          // isVerticalLine = TextAttribute.ORIENTATION_VERTICAL.equals(vf);
   39.71          isVerticalLine = false;
   39.72 @@ -619,7 +628,7 @@
   39.73              // and use it and its font to initialize the paragraph.
   39.74              // If not, use the first graphic to initialize.
   39.75  
   39.76 -            Map paragraphAttrs = text.getAttributes();
   39.77 +            Map<? extends Attribute, ?> paragraphAttrs = text.getAttributes();
   39.78  
   39.79              boolean haveFont = TextLine.advanceToFirstFont(text);
   39.80  
    40.1 --- a/src/share/classes/java/awt/font/TextLine.java	Tue Dec 06 16:31:58 2011 -0800
    40.2 +++ b/src/share/classes/java/awt/font/TextLine.java	Mon Dec 19 10:06:23 2011 -0800
    40.3 @@ -43,6 +43,7 @@
    40.4  import java.awt.image.BufferedImage;
    40.5  import java.text.Annotation;
    40.6  import java.text.AttributedCharacterIterator;
    40.7 +import java.text.AttributedCharacterIterator.Attribute;
    40.8  import java.text.Bidi;
    40.9  import java.text.CharacterIterator;
   40.10  import java.util.Hashtable;
   40.11 @@ -318,7 +319,8 @@
   40.12              for (int i = 0, n = 0; i < fComponents.length; ++i, n += 2) {
   40.13                  tlc = fComponents[getComponentLogicalIndex(i)];
   40.14                  AffineTransform at = tlc.getBaselineTransform();
   40.15 -                if (at != null && ((at.getType() & at.TYPE_TRANSLATION) != 0)) {
   40.16 +                if (at != null &&
   40.17 +                    ((at.getType() & AffineTransform.TYPE_TRANSLATION) != 0)) {
   40.18                      double dx = at.getTranslateX();
   40.19                      double dy = at.getTranslateY();
   40.20                      builder.moveTo(tx += dx, ty += dy);
   40.21 @@ -903,7 +905,7 @@
   40.22                                                char[] chars,
   40.23                                                Font font,
   40.24                                                CoreMetrics lm,
   40.25 -                                              Map attributes) {
   40.26 +                                              Map<? extends Attribute, ?> attributes) {
   40.27  
   40.28          boolean isDirectionLTR = true;
   40.29          byte[] levels = null;
   40.30 @@ -1250,7 +1252,10 @@
   40.31       */
   40.32      static boolean advanceToFirstFont(AttributedCharacterIterator aci) {
   40.33  
   40.34 -        for (char ch = aci.first(); ch != aci.DONE; ch = aci.setIndex(aci.getRunLimit())) {
   40.35 +        for (char ch = aci.first();
   40.36 +             ch != CharacterIterator.DONE;
   40.37 +             ch = aci.setIndex(aci.getRunLimit()))
   40.38 +        {
   40.39  
   40.40              if (aci.getAttribute(TextAttribute.CHAR_REPLACEMENT) == null) {
   40.41                  return true;
    41.1 --- a/src/share/classes/java/awt/font/TextMeasurer.java	Tue Dec 06 16:31:58 2011 -0800
    41.2 +++ b/src/share/classes/java/awt/font/TextMeasurer.java	Mon Dec 19 10:06:23 2011 -0800
    41.3 @@ -43,6 +43,7 @@
    41.4  import java.awt.Font;
    41.5  
    41.6  import java.text.AttributedCharacterIterator;
    41.7 +import java.text.AttributedCharacterIterator.Attribute;
    41.8  import java.text.AttributedString;
    41.9  import java.text.Bidi;
   41.10  import java.text.BreakIterator;
   41.11 @@ -176,7 +177,7 @@
   41.12              throw new Error();
   41.13          }
   41.14          if (fComponents != null) {
   41.15 -            other.fComponents = (TextLineComponent[]) fComponents.clone();
   41.16 +            other.fComponents = fComponents.clone();
   41.17          }
   41.18          return other;
   41.19      }
   41.20 @@ -199,7 +200,10 @@
   41.21          fChars = new char[text.getEndIndex() - fStart];
   41.22  
   41.23          int n = 0;
   41.24 -        for (char c = text.first(); c != text.DONE; c = text.next()) {
   41.25 +        for (char c = text.first();
   41.26 +             c != CharacterIterator.DONE;
   41.27 +             c = text.next())
   41.28 +        {
   41.29              fChars[n++] = c;
   41.30          }
   41.31  
   41.32 @@ -211,7 +215,7 @@
   41.33          }
   41.34  
   41.35          text.first();
   41.36 -        Map paragraphAttrs = text.getAttributes();
   41.37 +        Map<? extends Attribute, ?> paragraphAttrs = text.getAttributes();
   41.38          NumericShaper shaper = AttributeValues.getNumericShaping(paragraphAttrs);
   41.39          if (shaper != null) {
   41.40              shaper.shape(fChars, 0, fChars.length);
   41.41 @@ -243,7 +247,8 @@
   41.42                  GraphicAttribute graphic = (GraphicAttribute)
   41.43                                  paragraphAttrs.get(TextAttribute.CHAR_REPLACEMENT);
   41.44                  fBaseline = TextLayout.getBaselineFromGraphic(graphic);
   41.45 -                Font dummyFont = new Font(new Hashtable(5, (float)0.9));
   41.46 +                Hashtable<Attribute, ?> fmap = new Hashtable<>(5, (float)0.9);
   41.47 +                Font dummyFont = new Font(fmap);
   41.48                  LineMetrics lm = dummyFont.getLineMetrics(" ", 0, 1, fFrc);
   41.49                  fBaselineOffsets = lm.getBaselineOffsets();
   41.50              }
    42.1 --- a/src/share/classes/java/awt/geom/Path2D.java	Tue Dec 06 16:31:58 2011 -0800
    42.2 +++ b/src/share/classes/java/awt/geom/Path2D.java	Mon Dec 19 10:06:23 2011 -0800
    42.3 @@ -667,7 +667,8 @@
    42.4                          // Collapse out initial moveto/lineto
    42.5                          break;
    42.6                      }
    42.7 -                    // NO BREAK;
    42.8 +                    lineTo(coords[0], coords[1]);
    42.9 +                    break;
   42.10                  case SEG_LINETO:
   42.11                      lineTo(coords[0], coords[1]);
   42.12                      break;
   42.13 @@ -1392,7 +1393,8 @@
   42.14                          // Collapse out initial moveto/lineto
   42.15                          break;
   42.16                      }
   42.17 -                    // NO BREAK;
   42.18 +                    lineTo(coords[0], coords[1]);
   42.19 +                    break;
   42.20                  case SEG_LINETO:
   42.21                      lineTo(coords[0], coords[1]);
   42.22                      break;
   42.23 @@ -2456,7 +2458,7 @@
   42.24                  }
   42.25              }
   42.26          }
   42.27 -        s.writeByte((byte) SERIAL_PATH_END);
   42.28 +        s.writeByte(SERIAL_PATH_END);
   42.29      }
   42.30  
   42.31      final void readObject(java.io.ObjectInputStream s, boolean storedbl)
    43.1 --- a/src/share/classes/java/awt/im/InputMethodHighlight.java	Tue Dec 06 16:31:58 2011 -0800
    43.2 +++ b/src/share/classes/java/awt/im/InputMethodHighlight.java	Mon Dec 19 10:06:23 2011 -0800
    43.3 @@ -190,6 +190,6 @@
    43.4      private boolean selected;
    43.5      private int state;
    43.6      private int variation;
    43.7 -    private Map style;
    43.8 +    private Map<TextAttribute, ?> style;
    43.9  
   43.10  };
    44.1 --- a/src/share/classes/java/beans/BeanDescriptor.java	Tue Dec 06 16:31:58 2011 -0800
    44.2 +++ b/src/share/classes/java/beans/BeanDescriptor.java	Mon Dec 19 10:06:23 2011 -0800
    44.3 @@ -37,8 +37,8 @@
    44.4  
    44.5  public class BeanDescriptor extends FeatureDescriptor {
    44.6  
    44.7 -    private Reference<Class> beanClassRef;
    44.8 -    private Reference<Class> customizerClassRef;
    44.9 +    private Reference<? extends Class<?>> beanClassRef;
   44.10 +    private Reference<? extends Class<?>> customizerClassRef;
   44.11  
   44.12      /**
   44.13       * Create a BeanDescriptor for a bean that doesn't have a customizer.
   44.14 @@ -59,8 +59,8 @@
   44.15       *          the bean's Customizer.  For example sun.beans.OurButtonCustomizer.class.
   44.16       */
   44.17      public BeanDescriptor(Class<?> beanClass, Class<?> customizerClass) {
   44.18 -        this.beanClassRef = getWeakReference((Class)beanClass);
   44.19 -        this.customizerClassRef = getWeakReference((Class)customizerClass);
   44.20 +        this.beanClassRef = getWeakReference(beanClass);
   44.21 +        this.customizerClassRef = getWeakReference(customizerClass);
   44.22  
   44.23          String name = beanClass.getName();
   44.24          while (name.indexOf('.') >= 0) {
    45.1 --- a/src/share/classes/java/beans/Beans.java	Tue Dec 06 16:31:58 2011 -0800
    45.2 +++ b/src/share/classes/java/beans/Beans.java	Mon Dec 19 10:06:23 2011 -0800
    45.3 @@ -32,7 +32,6 @@
    45.4  import java.applet.AppletStub;
    45.5  import java.applet.AudioClip;
    45.6  
    45.7 -import java.awt.GraphicsEnvironment;
    45.8  import java.awt.Image;
    45.9  
   45.10  import java.beans.beancontext.BeanContext;
   45.11 @@ -53,15 +52,11 @@
   45.12  import java.util.Iterator;
   45.13  import java.util.Vector;
   45.14  
   45.15 -import sun.awt.AppContext;
   45.16 -
   45.17  /**
   45.18   * This class provides some general purpose beans control methods.
   45.19   */
   45.20  
   45.21  public class Beans {
   45.22 -    private static final Object DESIGN_TIME = new Object();
   45.23 -    private static final Object GUI_AVAILABLE = new Object();
   45.24  
   45.25      /**
   45.26       * <p>
   45.27 @@ -181,9 +176,9 @@
   45.28          // Try to find a serialized object with this name
   45.29          final String serName = beanName.replace('.','/').concat(".ser");
   45.30          final ClassLoader loader = cls;
   45.31 -        ins = (InputStream)AccessController.doPrivileged
   45.32 -            (new PrivilegedAction() {
   45.33 -                public Object run() {
   45.34 +        ins = AccessController.doPrivileged
   45.35 +            (new PrivilegedAction<InputStream>() {
   45.36 +                public InputStream run() {
   45.37                      if (loader == null)
   45.38                          return ClassLoader.getSystemResourceAsStream(serName);
   45.39                      else
   45.40 @@ -213,7 +208,7 @@
   45.41  
   45.42          if (result == null) {
   45.43              // No serialized object, try just instantiating the class
   45.44 -            Class cl;
   45.45 +            Class<?> cl;
   45.46  
   45.47              try {
   45.48                  cl = ClassFinder.findClass(beanName, cls);
   45.49 @@ -278,10 +273,10 @@
   45.50                      // Now get the URL correponding to the resource name.
   45.51  
   45.52                      final ClassLoader cloader = cls;
   45.53 -                    objectUrl = (URL)
   45.54 +                    objectUrl =
   45.55                          AccessController.doPrivileged
   45.56 -                        (new PrivilegedAction() {
   45.57 -                            public Object run() {
   45.58 +                        (new PrivilegedAction<URL>() {
   45.59 +                            public URL run() {
   45.60                                  if (cloader == null)
   45.61                                      return ClassLoader.getSystemResource
   45.62                                                                  (resourceName);
   45.63 @@ -326,7 +321,7 @@
   45.64                  // now, if there is a BeanContext, add the bean, if applicable.
   45.65  
   45.66                  if (beanContext != null) {
   45.67 -                    beanContext.add(result);
   45.68 +                    unsafeBeanContextAdd(beanContext, result);
   45.69                  }
   45.70  
   45.71                  // If it was deserialized then it was already init-ed.
   45.72 @@ -344,12 +339,16 @@
   45.73                    ((BeansAppletStub)stub).active = true;
   45.74                  } else initializer.activate(applet);
   45.75  
   45.76 -            } else if (beanContext != null) beanContext.add(result);
   45.77 +            } else if (beanContext != null) unsafeBeanContextAdd(beanContext, result);
   45.78          }
   45.79  
   45.80          return result;
   45.81      }
   45.82  
   45.83 +    @SuppressWarnings("unchecked")
   45.84 +    private static void unsafeBeanContextAdd(BeanContext beanContext, Object res) {
   45.85 +        beanContext.add(res);
   45.86 +    }
   45.87  
   45.88      /**
   45.89       * From a given bean, obtain an object representing a specified
   45.90 @@ -395,8 +394,7 @@
   45.91       * @see DesignMode
   45.92       */
   45.93      public static boolean isDesignTime() {
   45.94 -        Object value = AppContext.getAppContext().get(DESIGN_TIME);
   45.95 -        return (value instanceof Boolean) && (Boolean) value;
   45.96 +        return ThreadGroupContext.getContext().isDesignTime();
   45.97      }
   45.98  
   45.99      /**
  45.100 @@ -413,8 +411,7 @@
  45.101       *
  45.102       */
  45.103      public static boolean isGuiAvailable() {
  45.104 -        Object value = AppContext.getAppContext().get(GUI_AVAILABLE);
  45.105 -        return (value instanceof Boolean) ? (Boolean) value : !GraphicsEnvironment.isHeadless();
  45.106 +        return ThreadGroupContext.getContext().isGuiAvailable();
  45.107      }
  45.108  
  45.109      /**
  45.110 @@ -440,7 +437,7 @@
  45.111          if (sm != null) {
  45.112              sm.checkPropertiesAccess();
  45.113          }
  45.114 -        AppContext.getAppContext().put(DESIGN_TIME, Boolean.valueOf(isDesignTime));
  45.115 +        ThreadGroupContext.getContext().setDesignTime(isDesignTime);
  45.116      }
  45.117  
  45.118      /**
  45.119 @@ -466,7 +463,7 @@
  45.120          if (sm != null) {
  45.121              sm.checkPropertiesAccess();
  45.122          }
  45.123 -        AppContext.getAppContext().put(GUI_AVAILABLE, Boolean.valueOf(isGuiAvailable));
  45.124 +        ThreadGroupContext.getContext().setGuiAvailable(isGuiAvailable);
  45.125      }
  45.126  }
  45.127  
  45.128 @@ -496,6 +493,7 @@
  45.129      /**
  45.130       * Use the given ClassLoader rather than using the system class
  45.131       */
  45.132 +    @SuppressWarnings("rawtypes")
  45.133      protected Class resolveClass(ObjectStreamClass classDesc)
  45.134          throws IOException, ClassNotFoundException {
  45.135  
  45.136 @@ -511,7 +509,7 @@
  45.137  
  45.138  class BeansAppletContext implements AppletContext {
  45.139      Applet target;
  45.140 -    Hashtable imageCache = new Hashtable();
  45.141 +    Hashtable<URL,Object> imageCache = new Hashtable<>();
  45.142  
  45.143      BeansAppletContext(Applet target) {
  45.144          this.target = target;
  45.145 @@ -556,8 +554,8 @@
  45.146          return null;
  45.147      }
  45.148  
  45.149 -    public Enumeration getApplets() {
  45.150 -        Vector applets = new Vector();
  45.151 +    public Enumeration<Applet> getApplets() {
  45.152 +        Vector<Applet> applets = new Vector<>();
  45.153          applets.addElement(target);
  45.154          return applets.elements();
  45.155      }
  45.156 @@ -583,7 +581,7 @@
  45.157          return null;
  45.158      }
  45.159  
  45.160 -    public Iterator getStreamKeys(){
  45.161 +    public Iterator<String> getStreamKeys(){
  45.162          // We do nothing.
  45.163          return null;
  45.164      }
    46.1 --- a/src/share/classes/java/beans/ChangeListenerMap.java	Tue Dec 06 16:31:58 2011 -0800
    46.2 +++ b/src/share/classes/java/beans/ChangeListenerMap.java	Mon Dec 19 10:06:23 2011 -0800
    46.3 @@ -76,7 +76,7 @@
    46.4       */
    46.5      public final synchronized void add(String name, L listener) {
    46.6          if (this.map == null) {
    46.7 -            this.map = new HashMap<String, L[]>();
    46.8 +            this.map = new HashMap<>();
    46.9          }
   46.10          L[] array = this.map.get(name);
   46.11          int size = (array != null)
   46.12 @@ -146,7 +146,7 @@
   46.13      public final void set(String name, L[] listeners) {
   46.14          if (listeners != null) {
   46.15              if (this.map == null) {
   46.16 -                this.map = new HashMap<String, L[]>();
   46.17 +                this.map = new HashMap<>();
   46.18              }
   46.19              this.map.put(name, listeners);
   46.20          }
   46.21 @@ -167,7 +167,7 @@
   46.22          if (this.map == null) {
   46.23              return newArray(0);
   46.24          }
   46.25 -        List<L> list = new ArrayList<L>();
   46.26 +        List<L> list = new ArrayList<>();
   46.27  
   46.28          L[] listeners = this.map.get(null);
   46.29          if (listeners != null) {
   46.30 @@ -239,6 +239,7 @@
   46.31       */
   46.32      public final L extract(L listener) {
   46.33          while (listener instanceof EventListenerProxy) {
   46.34 +            @SuppressWarnings("unchecked")
   46.35              EventListenerProxy<L> proxy = (EventListenerProxy<L>) listener;
   46.36              listener = proxy.getListener();
   46.37          }
    47.1 --- a/src/share/classes/java/beans/DefaultPersistenceDelegate.java	Tue Dec 06 16:31:58 2011 -0800
    47.2 +++ b/src/share/classes/java/beans/DefaultPersistenceDelegate.java	Mon Dec 19 10:06:23 2011 -0800
    47.3 @@ -95,7 +95,7 @@
    47.4          this.constructor = constructorPropertyNames;
    47.5      }
    47.6  
    47.7 -    private static boolean definesEquals(Class type) {
    47.8 +    private static boolean definesEquals(Class<?> type) {
    47.9          try {
   47.10              return type == type.getMethod("equals", Object.class).getDeclaringClass();
   47.11          }
   47.12 @@ -153,7 +153,7 @@
   47.13       */
   47.14      protected Expression instantiate(Object oldInstance, Encoder out) {
   47.15          int nArgs = constructor.length;
   47.16 -        Class type = oldInstance.getClass();
   47.17 +        Class<?> type = oldInstance.getClass();
   47.18          Object[] constructorArgs = new Object[nArgs];
   47.19          for(int i = 0; i < nArgs; i++) {
   47.20              try {
   47.21 @@ -167,7 +167,7 @@
   47.22          return new Expression(oldInstance, oldInstance.getClass(), "new", constructorArgs);
   47.23      }
   47.24  
   47.25 -    private Method findMethod(Class type, String property) {
   47.26 +    private Method findMethod(Class<?> type, String property) {
   47.27          if (property == null) {
   47.28              throw new IllegalArgumentException("Property name is null");
   47.29          }
   47.30 @@ -182,7 +182,7 @@
   47.31          return method;
   47.32      }
   47.33  
   47.34 -    private void doProperty(Class type, PropertyDescriptor pd, Object oldInstance, Object newInstance, Encoder out) throws Exception {
   47.35 +    private void doProperty(Class<?> type, PropertyDescriptor pd, Object oldInstance, Object newInstance, Encoder out) throws Exception {
   47.36          Method getter = pd.getReadMethod();
   47.37          Method setter = pd.getWriteMethod();
   47.38  
   47.39 @@ -218,7 +218,7 @@
   47.40      }
   47.41  
   47.42      // Write out the properties of this instance.
   47.43 -    private void initBean(Class type, Object oldInstance, Object newInstance, Encoder out) {
   47.44 +    private void initBean(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
   47.45          for (Field field : type.getFields()) {
   47.46              int mod = field.getModifiers();
   47.47              if (Modifier.isFinal(mod) || Modifier.isStatic(mod) || Modifier.isTransient(mod)) {
   47.48 @@ -288,7 +288,7 @@
   47.49              if (d.isTransient()) {
   47.50                  continue;
   47.51              }
   47.52 -            Class listenerType = d.getListenerType();
   47.53 +            Class<?> listenerType = d.getListenerType();
   47.54  
   47.55  
   47.56              // The ComponentListener is added automatically, when
   47.57 @@ -318,7 +318,7 @@
   47.58              }
   47.59              catch (Exception e2) {
   47.60                  try {
   47.61 -                    Method m = type.getMethod("getListeners", new Class[]{Class.class});
   47.62 +                    Method m = type.getMethod("getListeners", new Class<?>[]{Class.class});
   47.63                      oldL = (EventListener[])MethodUtil.invoke(m, oldInstance, new Object[]{listenerType});
   47.64                      newL = (EventListener[])MethodUtil.invoke(m, newInstance, new Object[]{listenerType});
   47.65                  }
   47.66 @@ -401,7 +401,7 @@
   47.67          }
   47.68      }
   47.69  
   47.70 -    private static PropertyDescriptor getPropertyDescriptor(Class type, String property) {
   47.71 +    private static PropertyDescriptor getPropertyDescriptor(Class<?> type, String property) {
   47.72          try {
   47.73              for (PropertyDescriptor pd : Introspector.getBeanInfo(type).getPropertyDescriptors()) {
   47.74                  if (property.equals(pd.getName()))
    48.1 --- a/src/share/classes/java/beans/Encoder.java	Tue Dec 06 16:31:58 2011 -0800
    48.2 +++ b/src/share/classes/java/beans/Encoder.java	Mon Dec 19 10:06:23 2011 -0800
    48.3 @@ -47,10 +47,10 @@
    48.4  
    48.5  public class Encoder {
    48.6      private final PersistenceDelegateFinder finder = new PersistenceDelegateFinder();
    48.7 -    private Map bindings = new IdentityHashMap();
    48.8 +    private Map<Object, Expression> bindings = new IdentityHashMap<>();
    48.9      private ExceptionListener exceptionListener;
   48.10      boolean executeStatements = true;
   48.11 -    private Map attributes;
   48.12 +    private Map<Object, Object> attributes;
   48.13  
   48.14      /**
   48.15       * Write the specified object to the output stream.
   48.16 @@ -195,7 +195,13 @@
   48.17       */
   48.18      public PersistenceDelegate getPersistenceDelegate(Class<?> type) {
   48.19          PersistenceDelegate pd = this.finder.find(type);
   48.20 -        return (pd != null) ? pd : MetaData.getPersistenceDelegate(type);
   48.21 +        if (pd == null) {
   48.22 +            pd = MetaData.getPersistenceDelegate(type);
   48.23 +            if (pd != null) {
   48.24 +                this.finder.register(type, pd);
   48.25 +            }
   48.26 +        }
   48.27 +        return pd;
   48.28      }
   48.29  
   48.30      /**
   48.31 @@ -221,7 +227,7 @@
   48.32       * @see #get
   48.33       */
   48.34      public Object remove(Object oldInstance) {
   48.35 -        Expression exp = (Expression)bindings.remove(oldInstance);
   48.36 +        Expression exp = bindings.remove(oldInstance);
   48.37          return getValue(exp);
   48.38      }
   48.39  
   48.40 @@ -242,7 +248,7 @@
   48.41              oldInstance.getClass() == String.class) {
   48.42              return oldInstance;
   48.43          }
   48.44 -        Expression exp = (Expression)bindings.get(oldInstance);
   48.45 +        Expression exp = bindings.get(oldInstance);
   48.46          return getValue(exp);
   48.47      }
   48.48  
   48.49 @@ -331,7 +337,7 @@
   48.50      // Package private method for setting an attributes table for the encoder
   48.51      void setAttribute(Object key, Object value) {
   48.52          if (attributes == null) {
   48.53 -            attributes = new HashMap();
   48.54 +            attributes = new HashMap<>();
   48.55          }
   48.56          attributes.put(key, value);
   48.57      }
    49.1 --- a/src/share/classes/java/beans/EventHandler.java	Tue Dec 06 16:31:58 2011 -0800
    49.2 +++ b/src/share/classes/java/beans/EventHandler.java	Mon Dec 19 10:06:23 2011 -0800
    49.3 @@ -385,14 +385,14 @@
    49.4              if (target != null) {
    49.5                  getter = Statement.getMethod(target.getClass(),
    49.6                                        "get" + NameGenerator.capitalize(first),
    49.7 -                                      new Class[]{});
    49.8 +                                      new Class<?>[]{});
    49.9                  if (getter == null) {
   49.10                      getter = Statement.getMethod(target.getClass(),
   49.11                                     "is" + NameGenerator.capitalize(first),
   49.12 -                                   new Class[]{});
   49.13 +                                   new Class<?>[]{});
   49.14                  }
   49.15                  if (getter == null) {
   49.16 -                    getter = Statement.getMethod(target.getClass(), first, new Class[]{});
   49.17 +                    getter = Statement.getMethod(target.getClass(), first, new Class<?>[]{});
   49.18                  }
   49.19              }
   49.20              if (getter == null) {
   49.21 @@ -450,12 +450,12 @@
   49.22  
   49.23              if (eventPropertyName == null) {     // Nullary method.
   49.24                  newArgs = new Object[]{};
   49.25 -                argTypes = new Class[]{};
   49.26 +                argTypes = new Class<?>[]{};
   49.27              }
   49.28              else {
   49.29                  Object input = applyGetters(arguments[0], getEventPropertyName());
   49.30                  newArgs = new Object[]{input};
   49.31 -                argTypes = new Class[]{input == null ? null :
   49.32 +                argTypes = new Class<?>[]{input == null ? null :
   49.33                                         input.getClass()};
   49.34              }
   49.35              try {
   49.36 @@ -674,6 +674,7 @@
   49.37       *
   49.38       * @see EventHandler
   49.39       */
   49.40 +    @SuppressWarnings("unchecked")
   49.41      public static <T> T create(Class<T> listenerInterface,
   49.42                                 Object target, String action,
   49.43                                 String eventPropertyName,
   49.44 @@ -688,7 +689,7 @@
   49.45                            "listenerInterface must be non-null");
   49.46          }
   49.47          return (T)Proxy.newProxyInstance(target.getClass().getClassLoader(),
   49.48 -                                         new Class[] {listenerInterface},
   49.49 +                                         new Class<?>[] {listenerInterface},
   49.50                                           eventHandler);
   49.51      }
   49.52  }
    50.1 --- a/src/share/classes/java/beans/EventSetDescriptor.java	Tue Dec 06 16:31:58 2011 -0800
    50.2 +++ b/src/share/classes/java/beans/EventSetDescriptor.java	Mon Dec 19 10:06:23 2011 -0800
    50.3 @@ -45,7 +45,7 @@
    50.4      private MethodDescriptor getMethodDescriptor;
    50.5  
    50.6      private Reference<Method[]> listenerMethodsRef;
    50.7 -    private Reference<Class> listenerTypeRef;
    50.8 +    private Reference<? extends Class<?>> listenerTypeRef;
    50.9  
   50.10      private boolean unicast;
   50.11      private boolean inDefaultEventSet = true;
   50.12 @@ -91,7 +91,7 @@
   50.13          }
   50.14      }
   50.15  
   50.16 -    private static String getListenerClassName(Class cls) {
   50.17 +    private static String getListenerClassName(Class<?> cls) {
   50.18          String className = cls.getName();
   50.19          return className.substring(className.lastIndexOf('.') + 1);
   50.20      }
   50.21 @@ -182,7 +182,7 @@
   50.22          }
   50.23      }
   50.24  
   50.25 -    private static Method getMethod(Class cls, String name, int args)
   50.26 +    private static Method getMethod(Class<?> cls, String name, int args)
   50.27          throws IntrospectionException {
   50.28          if (name == null) {
   50.29              return null;
   50.30 @@ -295,7 +295,7 @@
   50.31                  : null;
   50.32      }
   50.33  
   50.34 -    private void setListenerType(Class cls) {
   50.35 +    private void setListenerType(Class<?> cls) {
   50.36          this.listenerTypeRef = getWeakReference(cls);
   50.37      }
   50.38  
    51.1 --- a/src/share/classes/java/beans/FeatureDescriptor.java	Tue Dec 06 16:31:58 2011 -0800
    51.2 +++ b/src/share/classes/java/beans/FeatureDescriptor.java	Mon Dec 19 10:06:23 2011 -0800
    51.3 @@ -51,7 +51,7 @@
    51.4  public class FeatureDescriptor {
    51.5      private static final String TRANSIENT = "transient";
    51.6  
    51.7 -    private Reference<Class> classRef;
    51.8 +    private Reference<? extends Class<?>> classRef;
    51.9  
   51.10      /**
   51.11       * Constructs a <code>FeatureDescriptor</code>.
   51.12 @@ -284,7 +284,7 @@
   51.13       */
   51.14      private Hashtable<String, Object> getTable() {
   51.15          if (this.table == null) {
   51.16 -            this.table = new Hashtable<String, Object>();
   51.17 +            this.table = new Hashtable<>();
   51.18          }
   51.19          return this.table;
   51.20      }
   51.21 @@ -317,11 +317,11 @@
   51.22  
   51.23      // Package private methods for recreating the weak/soft referent
   51.24  
   51.25 -    void setClass0(Class cls) {
   51.26 +    void setClass0(Class<?> cls) {
   51.27          this.classRef = getWeakReference(cls);
   51.28      }
   51.29  
   51.30 -    Class getClass0() {
   51.31 +    Class<?> getClass0() {
   51.32          return (this.classRef != null)
   51.33                  ? this.classRef.get()
   51.34                  : null;
   51.35 @@ -336,7 +336,7 @@
   51.36       */
   51.37      static <T> Reference<T> getSoftReference(T object) {
   51.38          return (object != null)
   51.39 -                ? new SoftReference<T>(object)
   51.40 +                ? new SoftReference<>(object)
   51.41                  : null;
   51.42      }
   51.43  
   51.44 @@ -349,7 +349,7 @@
   51.45       */
   51.46      static <T> Reference<T> getWeakReference(T object) {
   51.47          return (object != null)
   51.48 -                ? new WeakReference<T>(object)
   51.49 +                ? new WeakReference<>(object)
   51.50                  : null;
   51.51      }
   51.52  
   51.53 @@ -363,7 +363,7 @@
   51.54       * @see Method#getGenericReturnType
   51.55       * @see Method#getReturnType
   51.56       */
   51.57 -    static Class getReturnType(Class base, Method method) {
   51.58 +    static Class<?> getReturnType(Class<?> base, Method method) {
   51.59          if (base == null) {
   51.60              base = method.getDeclaringClass();
   51.61          }
   51.62 @@ -380,7 +380,7 @@
   51.63       * @see Method#getGenericParameterTypes
   51.64       * @see Method#getParameterTypes
   51.65       */
   51.66 -    static Class[] getParameterTypes(Class base, Method method) {
   51.67 +    static Class<?>[] getParameterTypes(Class<?> base, Method method) {
   51.68          if (base == null) {
   51.69              base = method.getDeclaringClass();
   51.70          }
   51.71 @@ -425,7 +425,7 @@
   51.72      void appendTo(StringBuilder sb) {
   51.73      }
   51.74  
   51.75 -    static void appendTo(StringBuilder sb, String name, Reference reference) {
   51.76 +    static void appendTo(StringBuilder sb, String name, Reference<?> reference) {
   51.77          if (reference != null) {
   51.78              appendTo(sb, name, reference.get());
   51.79          }
    52.1 --- a/src/share/classes/java/beans/IndexedPropertyDescriptor.java	Tue Dec 06 16:31:58 2011 -0800
    52.2 +++ b/src/share/classes/java/beans/IndexedPropertyDescriptor.java	Mon Dec 19 10:06:23 2011 -0800
    52.3 @@ -40,7 +40,7 @@
    52.4  
    52.5  public class IndexedPropertyDescriptor extends PropertyDescriptor {
    52.6  
    52.7 -    private Reference<Class> indexedPropertyTypeRef;
    52.8 +    private Reference<? extends Class<?>> indexedPropertyTypeRef;
    52.9      private Reference<Method> indexedReadMethodRef;
   52.10      private Reference<Method> indexedWriteMethodRef;
   52.11  
   52.12 @@ -175,14 +175,14 @@
   52.13      public synchronized Method getIndexedReadMethod() {
   52.14          Method indexedReadMethod = getIndexedReadMethod0();
   52.15          if (indexedReadMethod == null) {
   52.16 -            Class cls = getClass0();
   52.17 +            Class<?> cls = getClass0();
   52.18              if (cls == null ||
   52.19                  (indexedReadMethodName == null && indexedReadMethodRef == null)) {
   52.20                  // the Indexed readMethod was explicitly set to null.
   52.21                  return null;
   52.22              }
   52.23              if (indexedReadMethodName == null) {
   52.24 -                Class type = getIndexedPropertyType0();
   52.25 +                Class<?> type = getIndexedPropertyType0();
   52.26                  if (type == boolean.class || type == null) {
   52.27                      indexedReadMethodName = Introspector.IS_PREFIX + getBaseName();
   52.28                  } else {
   52.29 @@ -190,7 +190,7 @@
   52.30                  }
   52.31              }
   52.32  
   52.33 -            Class[] args = { int.class };
   52.34 +            Class<?>[] args = { int.class };
   52.35              indexedReadMethod = Introspector.findMethod(cls, indexedReadMethodName, 1, args);
   52.36              if (indexedReadMethod == null) {
   52.37                  // no "is" method, so look for a "get" method.
   52.38 @@ -240,7 +240,7 @@
   52.39      public synchronized Method getIndexedWriteMethod() {
   52.40          Method indexedWriteMethod = getIndexedWriteMethod0();
   52.41          if (indexedWriteMethod == null) {
   52.42 -            Class cls = getClass0();
   52.43 +            Class<?> cls = getClass0();
   52.44              if (cls == null ||
   52.45                  (indexedWriteMethodName == null && indexedWriteMethodRef == null)) {
   52.46                  // the Indexed writeMethod was explicitly set to null.
   52.47 @@ -250,14 +250,14 @@
   52.48              // We need the indexed type to ensure that we get the correct method.
   52.49              // Cannot use the getIndexedPropertyType method since that could
   52.50              // result in an infinite loop.
   52.51 -            Class type = getIndexedPropertyType0();
   52.52 +            Class<?> type = getIndexedPropertyType0();
   52.53              if (type == null) {
   52.54                  try {
   52.55                      type = findIndexedPropertyType(getIndexedReadMethod(), null);
   52.56                      setIndexedPropertyType(type);
   52.57                  } catch (IntrospectionException ex) {
   52.58                      // Set iprop type to be the classic type
   52.59 -                    Class propType = getPropertyType();
   52.60 +                    Class<?> propType = getPropertyType();
   52.61                      if (propType.isArray()) {
   52.62                          type = propType.getComponentType();
   52.63                      }
   52.64 @@ -268,7 +268,7 @@
   52.65                  indexedWriteMethodName = Introspector.SET_PREFIX + getBaseName();
   52.66              }
   52.67  
   52.68 -            Class[] args = (type == null) ? null : new Class[] { int.class, type };
   52.69 +            Class<?>[] args = (type == null) ? null : new Class<?>[] { int.class, type };
   52.70              indexedWriteMethod = Introspector.findMethod(cls, indexedWriteMethodName, 2, args);
   52.71              if (indexedWriteMethod != null) {
   52.72                  if (!indexedWriteMethod.getReturnType().equals(void.class)) {
   52.73 @@ -289,7 +289,7 @@
   52.74          throws IntrospectionException {
   52.75  
   52.76          // If the indexed property type has not been set, then set it.
   52.77 -        Class type = findIndexedPropertyType(getIndexedReadMethod(),
   52.78 +        Class<?> type = findIndexedPropertyType(getIndexedReadMethod(),
   52.79                                               writeMethod);
   52.80          setIndexedPropertyType(type);
   52.81          setIndexedWriteMethod0(writeMethod);
   52.82 @@ -319,7 +319,7 @@
   52.83       *         or {@code null} if the type cannot be determined
   52.84       */
   52.85      public synchronized Class<?> getIndexedPropertyType() {
   52.86 -        Class type = getIndexedPropertyType0();
   52.87 +        Class<?> type = getIndexedPropertyType0();
   52.88          if (type == null) {
   52.89              try {
   52.90                  type = findIndexedPropertyType(getIndexedReadMethod(),
   52.91 @@ -334,11 +334,11 @@
   52.92  
   52.93      // Private methods which set get/set the Reference objects
   52.94  
   52.95 -    private void setIndexedPropertyType(Class type) {
   52.96 +    private void setIndexedPropertyType(Class<?> type) {
   52.97          this.indexedPropertyTypeRef = getWeakReference(type);
   52.98      }
   52.99  
  52.100 -    private Class getIndexedPropertyType0() {
  52.101 +    private Class<?> getIndexedPropertyType0() {
  52.102          return (this.indexedPropertyTypeRef != null)
  52.103                  ? this.indexedPropertyTypeRef.get()
  52.104                  : null;
  52.105 @@ -356,10 +356,10 @@
  52.106                  : null;
  52.107      }
  52.108  
  52.109 -    private Class findIndexedPropertyType(Method indexedReadMethod,
  52.110 +    private Class<?> findIndexedPropertyType(Method indexedReadMethod,
  52.111                                            Method indexedWriteMethod)
  52.112          throws IntrospectionException {
  52.113 -        Class indexedPropertyType = null;
  52.114 +        Class<?> indexedPropertyType = null;
  52.115  
  52.116          if (indexedReadMethod != null) {
  52.117              Class params[] = getParameterTypes(getClass0(), indexedReadMethod);
  52.118 @@ -389,7 +389,7 @@
  52.119              }
  52.120              indexedPropertyType = params[1];
  52.121          }
  52.122 -        Class propertyType = getPropertyType();
  52.123 +        Class<?> propertyType = getPropertyType();
  52.124          if (propertyType != null && (!propertyType.isArray() ||
  52.125                                       propertyType.getComponentType() != indexedPropertyType)) {
  52.126              throw new IntrospectionException("type mismatch between indexed and non-indexed methods: "
    53.1 --- a/src/share/classes/java/beans/Introspector.java	Tue Dec 06 16:31:58 2011 -0800
    53.2 +++ b/src/share/classes/java/beans/Introspector.java	Mon Dec 19 10:06:23 2011 -0800
    53.3 @@ -26,7 +26,6 @@
    53.4  package java.beans;
    53.5  
    53.6  import com.sun.beans.WeakCache;
    53.7 -import com.sun.beans.finder.BeanInfoFinder;
    53.8  import com.sun.beans.finder.ClassFinder;
    53.9  
   53.10  import java.awt.Component;
   53.11 @@ -44,9 +43,7 @@
   53.12  import java.util.EventObject;
   53.13  import java.util.List;
   53.14  import java.util.TreeMap;
   53.15 -import java.util.WeakHashMap;
   53.16  
   53.17 -import sun.awt.AppContext;
   53.18  import sun.reflect.misc.ReflectUtil;
   53.19  
   53.20  /**
   53.21 @@ -98,18 +95,15 @@
   53.22      public final static int IGNORE_ALL_BEANINFO        = 3;
   53.23  
   53.24      // Static Caches to speed up introspection.
   53.25 -    private static WeakCache<Class<?>, Method[]> declaredMethodCache =
   53.26 -            new WeakCache<Class<?>, Method[]>();
   53.27 +    private static final WeakCache<Class<?>, Method[]> declaredMethodCache = new WeakCache<>();
   53.28  
   53.29 -    private static final Object BEANINFO_CACHE = new Object();
   53.30 -
   53.31 -    private Class beanClass;
   53.32 +    private Class<?> beanClass;
   53.33      private BeanInfo explicitBeanInfo;
   53.34      private BeanInfo superBeanInfo;
   53.35      private BeanInfo additionalBeanInfo[];
   53.36  
   53.37      private boolean propertyChangeSource = false;
   53.38 -    private static Class eventListenerType = EventListener.class;
   53.39 +    private static Class<EventListener> eventListenerType = EventListener.class;
   53.40  
   53.41      // These should be removed.
   53.42      private String defaultEventName;
   53.43 @@ -117,14 +111,14 @@
   53.44      private int defaultEventIndex = -1;
   53.45      private int defaultPropertyIndex = -1;
   53.46  
   53.47 -    // Methods maps from Method objects to MethodDescriptors
   53.48 -    private Map methods;
   53.49 +    // Methods maps from Method names to MethodDescriptors
   53.50 +    private Map<String, MethodDescriptor> methods;
   53.51  
   53.52      // properties maps from String names to PropertyDescriptors
   53.53 -    private Map properties;
   53.54 +    private Map<String, PropertyDescriptor> properties;
   53.55  
   53.56      // events maps from String names to EventSetDescriptors
   53.57 -    private Map events;
   53.58 +    private Map<String, EventSetDescriptor> events;
   53.59  
   53.60      private final static EventSetDescriptor[] EMPTY_EVENTSETDESCRIPTORS = new EventSetDescriptor[0];
   53.61  
   53.62 @@ -134,8 +128,6 @@
   53.63      static final String SET_PREFIX = "set";
   53.64      static final String IS_PREFIX = "is";
   53.65  
   53.66 -    private static final Object FINDER_KEY = new Object();
   53.67 -
   53.68      //======================================================================
   53.69      //                          Public methods
   53.70      //======================================================================
   53.71 @@ -160,20 +152,15 @@
   53.72          if (!ReflectUtil.isPackageAccessible(beanClass)) {
   53.73              return (new Introspector(beanClass, null, USE_ALL_BEANINFO)).getBeanInfo();
   53.74          }
   53.75 -        Map<Class<?>, BeanInfo> beanInfoCache;
   53.76 +        ThreadGroupContext context = ThreadGroupContext.getContext();
   53.77          BeanInfo beanInfo;
   53.78 -        synchronized (BEANINFO_CACHE) {
   53.79 -            beanInfoCache = (Map<Class<?>, BeanInfo>) AppContext.getAppContext().get(BEANINFO_CACHE);
   53.80 -            if (beanInfoCache == null) {
   53.81 -                beanInfoCache = new WeakHashMap<Class<?>, BeanInfo>();
   53.82 -                AppContext.getAppContext().put(BEANINFO_CACHE, beanInfoCache);
   53.83 -            }
   53.84 -            beanInfo = beanInfoCache.get(beanClass);
   53.85 +        synchronized (declaredMethodCache) {
   53.86 +            beanInfo = context.getBeanInfo(beanClass);
   53.87          }
   53.88          if (beanInfo == null) {
   53.89              beanInfo = new Introspector(beanClass, null, USE_ALL_BEANINFO).getBeanInfo();
   53.90 -            synchronized (BEANINFO_CACHE) {
   53.91 -                beanInfoCache.put(beanClass, beanInfo);
   53.92 +            synchronized (declaredMethodCache) {
   53.93 +                context.putBeanInfo(beanClass, beanInfo);
   53.94              }
   53.95          }
   53.96          return beanInfo;
   53.97 @@ -306,7 +293,7 @@
   53.98       */
   53.99  
  53.100      public static String[] getBeanInfoSearchPath() {
  53.101 -        return getFinder().getPackages();
  53.102 +        return ThreadGroupContext.getContext().getBeanInfoFinder().getPackages();
  53.103      }
  53.104  
  53.105      /**
  53.106 @@ -330,7 +317,7 @@
  53.107          if (sm != null) {
  53.108              sm.checkPropertiesAccess();
  53.109          }
  53.110 -        getFinder().setPackages(path);
  53.111 +        ThreadGroupContext.getContext().getBeanInfoFinder().setPackages(path);
  53.112      }
  53.113  
  53.114  
  53.115 @@ -342,11 +329,8 @@
  53.116       */
  53.117  
  53.118      public static void flushCaches() {
  53.119 -        synchronized (BEANINFO_CACHE) {
  53.120 -            Map beanInfoCache = (Map) AppContext.getAppContext().get(BEANINFO_CACHE);
  53.121 -            if (beanInfoCache != null) {
  53.122 -                beanInfoCache.clear();
  53.123 -            }
  53.124 +        synchronized (declaredMethodCache) {
  53.125 +            ThreadGroupContext.getContext().clearBeanInfoCache();
  53.126              declaredMethodCache.clear();
  53.127          }
  53.128      }
  53.129 @@ -370,11 +354,8 @@
  53.130          if (clz == null) {
  53.131              throw new NullPointerException();
  53.132          }
  53.133 -        synchronized (BEANINFO_CACHE) {
  53.134 -            Map beanInfoCache = (Map) AppContext.getAppContext().get(BEANINFO_CACHE);
  53.135 -            if (beanInfoCache != null) {
  53.136 -                beanInfoCache.put(clz, null);
  53.137 -            }
  53.138 +        synchronized (declaredMethodCache) {
  53.139 +            ThreadGroupContext.getContext().removeBeanInfo(clz);
  53.140              declaredMethodCache.put(clz, null);
  53.141          }
  53.142      }
  53.143 @@ -383,14 +364,14 @@
  53.144      //                  Private implementation methods
  53.145      //======================================================================
  53.146  
  53.147 -    private Introspector(Class beanClass, Class stopClass, int flags)
  53.148 +    private Introspector(Class<?> beanClass, Class<?> stopClass, int flags)
  53.149                                              throws IntrospectionException {
  53.150          this.beanClass = beanClass;
  53.151  
  53.152          // Check stopClass is a superClass of startClass.
  53.153          if (stopClass != null) {
  53.154              boolean isSuper = false;
  53.155 -            for (Class c = beanClass.getSuperclass(); c != null; c = c.getSuperclass()) {
  53.156 +            for (Class<?> c = beanClass.getSuperclass(); c != null; c = c.getSuperclass()) {
  53.157                  if (c == stopClass) {
  53.158                      isSuper = true;
  53.159                  }
  53.160 @@ -405,7 +386,7 @@
  53.161              explicitBeanInfo = findExplicitBeanInfo(beanClass);
  53.162          }
  53.163  
  53.164 -        Class superClass = beanClass.getSuperclass();
  53.165 +        Class<?> superClass = beanClass.getSuperclass();
  53.166          if (superClass != stopClass) {
  53.167              int newFlags = flags;
  53.168              if (newFlags == IGNORE_IMMEDIATE_BEANINFO) {
  53.169 @@ -451,8 +432,8 @@
  53.170       * @param beanClass  the class type of the bean
  53.171       * @return Instance of an explicit BeanInfo class or null if one isn't found.
  53.172       */
  53.173 -    private static BeanInfo findExplicitBeanInfo(Class beanClass) {
  53.174 -        return getFinder().find(beanClass);
  53.175 +    private static BeanInfo findExplicitBeanInfo(Class<?> beanClass) {
  53.176 +        return ThreadGroupContext.getContext().getBeanInfoFinder().find(beanClass);
  53.177      }
  53.178  
  53.179      /**
  53.180 @@ -501,8 +482,8 @@
  53.181                      continue;
  53.182                  }
  53.183                  String name = method.getName();
  53.184 -                Class argTypes[] = method.getParameterTypes();
  53.185 -                Class resultType = method.getReturnType();
  53.186 +                Class<?>[] argTypes = method.getParameterTypes();
  53.187 +                Class<?> resultType = method.getReturnType();
  53.188                  int argCount = argTypes.length;
  53.189                  PropertyDescriptor pd = null;
  53.190  
  53.191 @@ -560,8 +541,8 @@
  53.192          processPropertyDescriptors();
  53.193  
  53.194          // Allocate and populate the result array.
  53.195 -        PropertyDescriptor result[] = new PropertyDescriptor[properties.size()];
  53.196 -        result = (PropertyDescriptor[])properties.values().toArray(result);
  53.197 +        PropertyDescriptor result[] =
  53.198 +                properties.values().toArray(new PropertyDescriptor[properties.size()]);
  53.199  
  53.200          // Set the default index.
  53.201          if (defaultPropertyName != null) {
  53.202 @@ -575,16 +556,16 @@
  53.203          return result;
  53.204      }
  53.205  
  53.206 -    private HashMap pdStore = new HashMap();
  53.207 +    private HashMap<String, List<PropertyDescriptor>> pdStore = new HashMap<>();
  53.208  
  53.209      /**
  53.210       * Adds the property descriptor to the list store.
  53.211       */
  53.212      private void addPropertyDescriptor(PropertyDescriptor pd) {
  53.213          String propName = pd.getName();
  53.214 -        List list = (List)pdStore.get(propName);
  53.215 +        List<PropertyDescriptor> list = pdStore.get(propName);
  53.216          if (list == null) {
  53.217 -            list = new ArrayList();
  53.218 +            list = new ArrayList<>();
  53.219              pdStore.put(propName, list);
  53.220          }
  53.221          if (this.beanClass != pd.getClass0()) {
  53.222 @@ -639,25 +620,25 @@
  53.223       */
  53.224      private void processPropertyDescriptors() {
  53.225          if (properties == null) {
  53.226 -            properties = new TreeMap();
  53.227 +            properties = new TreeMap<>();
  53.228          }
  53.229  
  53.230 -        List list;
  53.231 +        List<PropertyDescriptor> list;
  53.232  
  53.233          PropertyDescriptor pd, gpd, spd;
  53.234          IndexedPropertyDescriptor ipd, igpd, ispd;
  53.235  
  53.236 -        Iterator it = pdStore.values().iterator();
  53.237 +        Iterator<List<PropertyDescriptor>> it = pdStore.values().iterator();
  53.238          while (it.hasNext()) {
  53.239              pd = null; gpd = null; spd = null;
  53.240              ipd = null; igpd = null; ispd = null;
  53.241  
  53.242 -            list = (List)it.next();
  53.243 +            list = it.next();
  53.244  
  53.245              // First pass. Find the latest getter method. Merge properties
  53.246              // of previous getter methods.
  53.247              for (int i = 0; i < list.size(); i++) {
  53.248 -                pd = (PropertyDescriptor)list.get(i);
  53.249 +                pd = list.get(i);
  53.250                  if (pd instanceof IndexedPropertyDescriptor) {
  53.251                      ipd = (IndexedPropertyDescriptor)pd;
  53.252                      if (ipd.getIndexedReadMethod() != null) {
  53.253 @@ -686,7 +667,7 @@
  53.254              // Second pass. Find the latest setter method which
  53.255              // has the same type as the getter method.
  53.256              for (int i = 0; i < list.size(); i++) {
  53.257 -                pd = (PropertyDescriptor)list.get(i);
  53.258 +                pd = list.get(i);
  53.259                  if (pd instanceof IndexedPropertyDescriptor) {
  53.260                      ipd = (IndexedPropertyDescriptor)pd;
  53.261                      if (ipd.getIndexedWriteMethod() != null) {
  53.262 @@ -804,7 +785,7 @@
  53.263              // which does not have getter and setter methods.
  53.264              // See regression bug 4984912.
  53.265              if ( (pd == null) && (list.size() > 0) ) {
  53.266 -                pd = (PropertyDescriptor) list.get(0);
  53.267 +                pd = list.get(0);
  53.268              }
  53.269  
  53.270              if (pd != null) {
  53.271 @@ -823,8 +804,8 @@
  53.272                                                         PropertyDescriptor pd) {
  53.273          PropertyDescriptor result = null;
  53.274  
  53.275 -        Class propType = pd.getPropertyType();
  53.276 -        Class ipropType = ipd.getIndexedPropertyType();
  53.277 +        Class<?> propType = pd.getPropertyType();
  53.278 +        Class<?> ipropType = ipd.getIndexedPropertyType();
  53.279  
  53.280          if (propType.isArray() && propType.getComponentType() == ipropType) {
  53.281              if (pd.getClass0().isAssignableFrom(ipd.getClass0())) {
  53.282 @@ -858,7 +839,7 @@
  53.283                  if (write == null && read != null) {
  53.284                      write = findMethod(result.getClass0(),
  53.285                                         SET_PREFIX + NameGenerator.capitalize(result.getName()), 1,
  53.286 -                                       new Class[] { FeatureDescriptor.getReturnType(result.getClass0(), read) });
  53.287 +                                       new Class<?>[] { FeatureDescriptor.getReturnType(result.getClass0(), read) });
  53.288                      if (write != null) {
  53.289                          try {
  53.290                              result.setWriteMethod(write);
  53.291 @@ -898,7 +879,7 @@
  53.292       */
  53.293      private EventSetDescriptor[] getTargetEventInfo() throws IntrospectionException {
  53.294          if (events == null) {
  53.295 -            events = new HashMap();
  53.296 +            events = new HashMap<>();
  53.297          }
  53.298  
  53.299          // Check if the bean has its own BeanInfo that will provide
  53.300 @@ -949,9 +930,9 @@
  53.301              // Find all suitable "add", "remove" and "get" Listener methods
  53.302              // The name of the listener type is the key for these hashtables
  53.303              // i.e, ActionListener
  53.304 -            Map adds = null;
  53.305 -            Map removes = null;
  53.306 -            Map gets = null;
  53.307 +            Map<String, Method> adds = null;
  53.308 +            Map<String, Method> removes = null;
  53.309 +            Map<String, Method> gets = null;
  53.310  
  53.311              for (int i = 0; i < methodList.length; i++) {
  53.312                  Method method = methodList[i];
  53.313 @@ -970,8 +951,8 @@
  53.314                      continue;
  53.315                  }
  53.316  
  53.317 -                Class argTypes[] = FeatureDescriptor.getParameterTypes(beanClass, method);
  53.318 -                Class resultType = FeatureDescriptor.getReturnType(beanClass, method);
  53.319 +                Class<?>[] argTypes = FeatureDescriptor.getParameterTypes(beanClass, method);
  53.320 +                Class<?> resultType = FeatureDescriptor.getReturnType(beanClass, method);
  53.321  
  53.322                  if (name.startsWith(ADD_PREFIX) && argTypes.length == 1 &&
  53.323                      resultType == Void.TYPE &&
  53.324 @@ -980,7 +961,7 @@
  53.325                      if (listenerName.length() > 0 &&
  53.326                          argTypes[0].getName().endsWith(listenerName)) {
  53.327                          if (adds == null) {
  53.328 -                            adds = new HashMap();
  53.329 +                            adds = new HashMap<>();
  53.330                          }
  53.331                          adds.put(listenerName, method);
  53.332                      }
  53.333 @@ -992,7 +973,7 @@
  53.334                      if (listenerName.length() > 0 &&
  53.335                          argTypes[0].getName().endsWith(listenerName)) {
  53.336                          if (removes == null) {
  53.337 -                            removes = new HashMap();
  53.338 +                            removes = new HashMap<>();
  53.339                          }
  53.340                          removes.put(listenerName, method);
  53.341                      }
  53.342 @@ -1005,7 +986,7 @@
  53.343                      if (listenerName.length() > 0 &&
  53.344                          resultType.getComponentType().getName().endsWith(listenerName)) {
  53.345                          if (gets == null) {
  53.346 -                            gets = new HashMap();
  53.347 +                            gets = new HashMap<>();
  53.348                          }
  53.349                          gets.put(listenerName, method);
  53.350                      }
  53.351 @@ -1015,26 +996,26 @@
  53.352              if (adds != null && removes != null) {
  53.353                  // Now look for matching addFooListener+removeFooListener pairs.
  53.354                  // Bonus if there is a matching getFooListeners method as well.
  53.355 -                Iterator keys = adds.keySet().iterator();
  53.356 +                Iterator<String> keys = adds.keySet().iterator();
  53.357                  while (keys.hasNext()) {
  53.358 -                    String listenerName = (String) keys.next();
  53.359 +                    String listenerName = keys.next();
  53.360                      // Skip any "add" which doesn't have a matching "remove" or
  53.361                      // a listener name that doesn't end with Listener
  53.362                      if (removes.get(listenerName) == null || !listenerName.endsWith("Listener")) {
  53.363                          continue;
  53.364                      }
  53.365                      String eventName = decapitalize(listenerName.substring(0, listenerName.length()-8));
  53.366 -                    Method addMethod = (Method)adds.get(listenerName);
  53.367 -                    Method removeMethod = (Method)removes.get(listenerName);
  53.368 +                    Method addMethod = adds.get(listenerName);
  53.369 +                    Method removeMethod = removes.get(listenerName);
  53.370                      Method getMethod = null;
  53.371                      if (gets != null) {
  53.372 -                        getMethod = (Method)gets.get(listenerName);
  53.373 +                        getMethod = gets.get(listenerName);
  53.374                      }
  53.375 -                    Class argType = FeatureDescriptor.getParameterTypes(beanClass, addMethod)[0];
  53.376 +                    Class<?> argType = FeatureDescriptor.getParameterTypes(beanClass, addMethod)[0];
  53.377  
  53.378                      // generate a list of Method objects for each of the target methods:
  53.379                      Method allMethods[] = getPublicDeclaredMethods(argType);
  53.380 -                    List validMethods = new ArrayList(allMethods.length);
  53.381 +                    List<Method> validMethods = new ArrayList<>(allMethods.length);
  53.382                      for (int i = 0; i < allMethods.length; i++) {
  53.383                          if (allMethods[i] == null) {
  53.384                              continue;
  53.385 @@ -1044,7 +1025,7 @@
  53.386                              validMethods.add(allMethods[i]);
  53.387                          }
  53.388                      }
  53.389 -                    Method[] methods = (Method[])validMethods.toArray(new Method[validMethods.size()]);
  53.390 +                    Method[] methods = validMethods.toArray(new Method[validMethods.size()]);
  53.391  
  53.392                      EventSetDescriptor esd = new EventSetDescriptor(eventName, argType,
  53.393                                                                      methods, addMethod,
  53.394 @@ -1067,7 +1048,7 @@
  53.395          } else {
  53.396              // Allocate and populate the result array.
  53.397              result = new EventSetDescriptor[events.size()];
  53.398 -            result = (EventSetDescriptor[])events.values().toArray(result);
  53.399 +            result = events.values().toArray(result);
  53.400  
  53.401              // Set the default index.
  53.402              if (defaultEventName != null) {
  53.403 @@ -1086,7 +1067,7 @@
  53.404          if (esd.getName().equals("propertyChange")) {
  53.405              propertyChangeSource = true;
  53.406          }
  53.407 -        EventSetDescriptor old = (EventSetDescriptor)events.get(key);
  53.408 +        EventSetDescriptor old = events.get(key);
  53.409          if (old == null) {
  53.410              events.put(key, esd);
  53.411              return;
  53.412 @@ -1101,7 +1082,7 @@
  53.413       */
  53.414      private MethodDescriptor[] getTargetMethodInfo() {
  53.415          if (methods == null) {
  53.416 -            methods = new HashMap(100);
  53.417 +            methods = new HashMap<>(100);
  53.418          }
  53.419  
  53.420          // Check if the bean has its own BeanInfo that will provide
  53.421 @@ -1154,7 +1135,7 @@
  53.422  
  53.423          // Allocate and populate the result array.
  53.424          MethodDescriptor result[] = new MethodDescriptor[methods.size()];
  53.425 -        result = (MethodDescriptor[])methods.values().toArray(result);
  53.426 +        result = methods.values().toArray(result);
  53.427  
  53.428          return result;
  53.429      }
  53.430 @@ -1165,7 +1146,7 @@
  53.431          // This method gets called a *lot, so we try to be efficient.
  53.432          String name = md.getName();
  53.433  
  53.434 -        MethodDescriptor old = (MethodDescriptor)methods.get(name);
  53.435 +        MethodDescriptor old = methods.get(name);
  53.436          if (old == null) {
  53.437              // This is the common case.
  53.438              methods.put(name, md);
  53.439 @@ -1198,7 +1179,7 @@
  53.440          // This is very rare.
  53.441  
  53.442          String longKey = makeQualifiedMethodName(name, p1);
  53.443 -        old = (MethodDescriptor)methods.get(longKey);
  53.444 +        old = methods.get(longKey);
  53.445          if (old == null) {
  53.446              methods.put(longKey, md);
  53.447              return;
  53.448 @@ -1269,13 +1250,13 @@
  53.449      /*
  53.450       * Internal method to return *public* methods within a class.
  53.451       */
  53.452 -    private static Method[] getPublicDeclaredMethods(Class clz) {
  53.453 +    private static Method[] getPublicDeclaredMethods(Class<?> clz) {
  53.454          // Looking up Class.getDeclaredMethods is relatively expensive,
  53.455          // so we cache the results.
  53.456          if (!ReflectUtil.isPackageAccessible(clz)) {
  53.457              return new Method[0];
  53.458          }
  53.459 -        synchronized (BEANINFO_CACHE) {
  53.460 +        synchronized (declaredMethodCache) {
  53.461              Method[] result = declaredMethodCache.get(clz);
  53.462              if (result == null) {
  53.463                  result = clz.getMethods();
  53.464 @@ -1299,14 +1280,14 @@
  53.465       * Internal support for finding a target methodName with a given
  53.466       * parameter list on a given class.
  53.467       */
  53.468 -    private static Method internalFindMethod(Class start, String methodName,
  53.469 +    private static Method internalFindMethod(Class<?> start, String methodName,
  53.470                                                   int argCount, Class args[]) {
  53.471          // For overriden methods we need to find the most derived version.
  53.472          // So we start with the given class and walk up the superclass chain.
  53.473  
  53.474          Method method = null;
  53.475  
  53.476 -        for (Class cl = start; cl != null; cl = cl.getSuperclass()) {
  53.477 +        for (Class<?> cl = start; cl != null; cl = cl.getSuperclass()) {
  53.478              Method methods[] = getPublicDeclaredMethods(cl);
  53.479              for (int i = 0; i < methods.length; i++) {
  53.480                  method = methods[i];
  53.481 @@ -1357,7 +1338,7 @@
  53.482      /**
  53.483       * Find a target methodName on a given class.
  53.484       */
  53.485 -    static Method findMethod(Class cls, String methodName, int argCount) {
  53.486 +    static Method findMethod(Class<?> cls, String methodName, int argCount) {
  53.487          return findMethod(cls, methodName, argCount, null);
  53.488      }
  53.489  
  53.490 @@ -1373,7 +1354,7 @@
  53.491       * @param args Array of argument types for the method.
  53.492       * @return the method or null if not found
  53.493       */
  53.494 -    static Method findMethod(Class cls, String methodName, int argCount,
  53.495 +    static Method findMethod(Class<?> cls, String methodName, int argCount,
  53.496                               Class args[]) {
  53.497          if (methodName == null) {
  53.498              return null;
  53.499 @@ -1387,7 +1368,7 @@
  53.500       * or "implements" b.
  53.501       * Note tht either or both "Class" objects may represent interfaces.
  53.502       */
  53.503 -    static  boolean isSubclass(Class a, Class b) {
  53.504 +    static  boolean isSubclass(Class<?> a, Class<?> b) {
  53.505          // We rely on the fact that for any given java class or
  53.506          // primtitive type there is a unqiue Class object, so
  53.507          // we can use object equivalence in the comparisons.
  53.508 @@ -1397,12 +1378,12 @@
  53.509          if (a == null || b == null) {
  53.510              return false;
  53.511          }
  53.512 -        for (Class x = a; x != null; x = x.getSuperclass()) {
  53.513 +        for (Class<?> x = a; x != null; x = x.getSuperclass()) {
  53.514              if (x == b) {
  53.515                  return true;
  53.516              }
  53.517              if (b.isInterface()) {
  53.518 -                Class interfaces[] = x.getInterfaces();
  53.519 +                Class<?>[] interfaces = x.getInterfaces();
  53.520                  for (int i = 0; i < interfaces.length; i++) {
  53.521                      if (isSubclass(interfaces[i], b)) {
  53.522                          return true;
  53.523 @@ -1416,7 +1397,7 @@
  53.524      /**
  53.525       * Return true iff the given method throws the given exception.
  53.526       */
  53.527 -    private boolean throwsException(Method method, Class exception) {
  53.528 +    private boolean throwsException(Method method, Class<?> exception) {
  53.529          Class exs[] = method.getExceptionTypes();
  53.530          for (int i = 0; i < exs.length; i++) {
  53.531              if (exs[i] == exception) {
  53.532 @@ -1426,28 +1407,17 @@
  53.533          return false;
  53.534      }
  53.535  
  53.536 -    private static BeanInfoFinder getFinder() {
  53.537 -        AppContext context = AppContext.getAppContext();
  53.538 -        Object object = context.get(FINDER_KEY);
  53.539 -        if (object instanceof BeanInfoFinder) {
  53.540 -            return (BeanInfoFinder) object;
  53.541 -        }
  53.542 -        BeanInfoFinder finder = new BeanInfoFinder();
  53.543 -        context.put(FINDER_KEY, finder);
  53.544 -        return finder;
  53.545 -    }
  53.546 -
  53.547      /**
  53.548       * Try to create an instance of a named class.
  53.549       * First try the classloader of "sibling", then try the system
  53.550       * classloader then the class loader of the current Thread.
  53.551       */
  53.552 -    static Object instantiate(Class sibling, String className)
  53.553 +    static Object instantiate(Class<?> sibling, String className)
  53.554                   throws InstantiationException, IllegalAccessException,
  53.555                                                  ClassNotFoundException {
  53.556          // First check with sibling's classloader (if any).
  53.557          ClassLoader cl = sibling.getClassLoader();
  53.558 -        Class cls = ClassFinder.findClass(className, cl);
  53.559 +        Class<?> cls = ClassFinder.findClass(className, cl);
  53.560          return cls.newInstance();
  53.561      }
  53.562  
  53.563 @@ -1482,7 +1452,7 @@
  53.564          this.properties = properties;
  53.565          this.defaultProperty = defaultProperty;
  53.566          this.methods = methods;
  53.567 -        this.targetBeanInfoRef = new SoftReference<BeanInfo>(targetBeanInfo);
  53.568 +        this.targetBeanInfoRef = new SoftReference<>(targetBeanInfo);
  53.569      }
  53.570  
  53.571      /**
    54.1 --- a/src/share/classes/java/beans/MetaData.java	Tue Dec 06 16:31:58 2011 -0800
    54.2 +++ b/src/share/classes/java/beans/MetaData.java	Mon Dec 19 10:06:23 2011 -0800
    54.3 @@ -93,7 +93,7 @@
    54.4      }
    54.5  
    54.6      protected Expression instantiate(Object oldInstance, Encoder out) {
    54.7 -        Enum e = (Enum) oldInstance;
    54.8 +        Enum<?> e = (Enum<?>) oldInstance;
    54.9          return new Expression(e, Enum.class, "valueOf", new Object[]{e.getDeclaringClass(), e.name()});
   54.10      }
   54.11  }
   54.12 @@ -118,7 +118,7 @@
   54.13  
   54.14      protected Expression instantiate(Object oldInstance, Encoder out) {
   54.15          // System.out.println("instantiate: " + type + " " + oldInstance);
   54.16 -        Class oldClass = oldInstance.getClass();
   54.17 +        Class<?> oldClass = oldInstance.getClass();
   54.18          return new Expression(oldInstance, Array.class, "newInstance",
   54.19                     new Object[]{oldClass.getComponentType(),
   54.20                                  new Integer(Array.getLength(oldInstance))});
   54.21 @@ -152,14 +152,14 @@
   54.22  
   54.23  class ProxyPersistenceDelegate extends PersistenceDelegate {
   54.24      protected Expression instantiate(Object oldInstance, Encoder out) {
   54.25 -        Class type = oldInstance.getClass();
   54.26 +        Class<?> type = oldInstance.getClass();
   54.27          java.lang.reflect.Proxy p = (java.lang.reflect.Proxy)oldInstance;
   54.28          // This unappealing hack is not required but makes the
   54.29          // representation of EventHandlers much more concise.
   54.30          java.lang.reflect.InvocationHandler ih = java.lang.reflect.Proxy.getInvocationHandler(p);
   54.31          if (ih instanceof EventHandler) {
   54.32              EventHandler eh = (EventHandler)ih;
   54.33 -            Vector args = new Vector();
   54.34 +            Vector<Object> args = new Vector<>();
   54.35              args.add(type.getInterfaces()[0]);
   54.36              args.add(eh.getTarget());
   54.37              args.add(eh.getAction());
   54.38 @@ -200,7 +200,7 @@
   54.39      }
   54.40  
   54.41      protected Expression instantiate(Object oldInstance, Encoder out) {
   54.42 -        Class c = (Class)oldInstance;
   54.43 +        Class<?> c = (Class)oldInstance;
   54.44          // As of 1.3 it is not possible to call Class.forName("int"),
   54.45          // so we have to generate different code for primitive types.
   54.46          // This is needed for arrays whose subtype may be primitive.
   54.47 @@ -362,8 +362,8 @@
   54.48          if ((oldInstance instanceof List) || (oldInstance instanceof Set) || (oldInstance instanceof Map)) {
   54.49              return oldInstance.equals(newInstance);
   54.50          }
   54.51 -        Collection oldC = (Collection) oldInstance;
   54.52 -        Collection newC = (Collection) newInstance;
   54.53 +        Collection<?> oldC = (Collection<?>) oldInstance;
   54.54 +        Collection<?> newC = (Collection<?>) newInstance;
   54.55          return (oldC.size() == newC.size()) && oldC.containsAll(newC);
   54.56      }
   54.57  
   54.58 @@ -387,21 +387,21 @@
   54.59  
   54.60      static final class SingletonList_PersistenceDelegate extends java_util_Collections {
   54.61          protected Expression instantiate(Object oldInstance, Encoder out) {
   54.62 -            List list = (List) oldInstance;
   54.63 +            List<?> list = (List<?>) oldInstance;
   54.64              return new Expression(oldInstance, Collections.class, "singletonList", new Object[]{list.get(0)});
   54.65          }
   54.66      }
   54.67  
   54.68      static final class SingletonSet_PersistenceDelegate extends java_util_Collections {
   54.69          protected Expression instantiate(Object oldInstance, Encoder out) {
   54.70 -            Set set = (Set) oldInstance;
   54.71 +            Set<?> set = (Set<?>) oldInstance;
   54.72              return new Expression(oldInstance, Collections.class, "singleton", new Object[]{set.iterator().next()});
   54.73          }
   54.74      }
   54.75  
   54.76      static final class SingletonMap_PersistenceDelegate extends java_util_Collections {
   54.77          protected Expression instantiate(Object oldInstance, Encoder out) {
   54.78 -            Map map = (Map) oldInstance;
   54.79 +            Map<?,?> map = (Map<?,?>) oldInstance;
   54.80              Object key = map.keySet().iterator().next();
   54.81              return new Expression(oldInstance, Collections.class, "singletonMap", new Object[]{key, map.get(key)});
   54.82          }
   54.83 @@ -409,98 +409,98 @@
   54.84  
   54.85      static final class UnmodifiableCollection_PersistenceDelegate extends java_util_Collections {
   54.86          protected Expression instantiate(Object oldInstance, Encoder out) {
   54.87 -            List list = new ArrayList((Collection) oldInstance);
   54.88 +            List<?> list = new ArrayList<>((Collection<?>) oldInstance);
   54.89              return new Expression(oldInstance, Collections.class, "unmodifiableCollection", new Object[]{list});
   54.90          }
   54.91      }
   54.92  
   54.93      static final class UnmodifiableList_PersistenceDelegate extends java_util_Collections {
   54.94          protected Expression instantiate(Object oldInstance, Encoder out) {
   54.95 -            List list = new LinkedList((Collection) oldInstance);
   54.96 +            List<?> list = new LinkedList<>((Collection<?>) oldInstance);
   54.97              return new Expression(oldInstance, Collections.class, "unmodifiableList", new Object[]{list});
   54.98          }
   54.99      }
  54.100  
  54.101      static final class UnmodifiableRandomAccessList_PersistenceDelegate extends java_util_Collections {
  54.102          protected Expression instantiate(Object oldInstance, Encoder out) {
  54.103 -            List list = new ArrayList((Collection) oldInstance);
  54.104 +            List<?> list = new ArrayList<>((Collection<?>) oldInstance);
  54.105              return new Expression(oldInstance, Collections.class, "unmodifiableList", new Object[]{list});
  54.106          }
  54.107      }
  54.108  
  54.109      static final class UnmodifiableSet_PersistenceDelegate extends java_util_Collections {
  54.110          protected Expression instantiate(Object oldInstance, Encoder out) {
  54.111 -            Set set = new HashSet((Set) oldInstance);
  54.112 +            Set<?> set = new HashSet<>((Set<?>) oldInstance);
  54.113              return new Expression(oldInstance, Collections.class, "unmodifiableSet", new Object[]{set});
  54.114          }
  54.115      }
  54.116  
  54.117      static final class UnmodifiableSortedSet_PersistenceDelegate extends java_util_Collections {
  54.118          protected Expression instantiate(Object oldInstance, Encoder out) {
  54.119 -            SortedSet set = new TreeSet((SortedSet) oldInstance);
  54.120 +            SortedSet<?> set = new TreeSet<>((SortedSet<?>) oldInstance);
  54.121              return new Expression(oldInstance, Collections.class, "unmodifiableSortedSet", new Object[]{set});
  54.122          }
  54.123      }
  54.124  
  54.125      static final class UnmodifiableMap_PersistenceDelegate extends java_util_Collections {
  54.126          protected Expression instantiate(Object oldInstance, Encoder out) {
  54.127 -            Map map = new HashMap((Map) oldInstance);
  54.128 +            Map<?,?> map = new HashMap<>((Map<?,?>) oldInstance);
  54.129              return new Expression(oldInstance, Collections.class, "unmodifiableMap", new Object[]{map});
  54.130          }
  54.131      }
  54.132  
  54.133      static final class UnmodifiableSortedMap_PersistenceDelegate extends java_util_Collections {
  54.134          protected Expression instantiate(Object oldInstance, Encoder out) {
  54.135 -            SortedMap map = new TreeMap((SortedMap) oldInstance);
  54.136 +            SortedMap<?,?> map = new TreeMap<>((SortedMap<?,?>) oldInstance);
  54.137              return new Expression(oldInstance, Collections.class, "unmodifiableSortedMap", new Object[]{map});
  54.138          }
  54.139      }
  54.140  
  54.141      static final class SynchronizedCollection_PersistenceDelegate extends java_util_Collections {
  54.142          protected Expression instantiate(Object oldInstance, Encoder out) {
  54.143 -            List list = new ArrayList((Collection) oldInstance);
  54.144 +            List<?> list = new ArrayList<>((Collection<?>) oldInstance);
  54.145              return new Expression(oldInstance, Collections.class, "synchronizedCollection", new Object[]{list});
  54.146          }
  54.147      }
  54.148  
  54.149      static final class SynchronizedList_PersistenceDelegate extends java_util_Collections {
  54.150          protected Expression instantiate(Object oldInstance, Encoder out) {
  54.151 -            List list = new LinkedList((Collection) oldInstance);
  54.152 +            List<?> list = new LinkedList<>((Collection<?>) oldInstance);
  54.153              return new Expression(oldInstance, Collections.class, "synchronizedList", new Object[]{list});
  54.154          }
  54.155      }
  54.156  
  54.157      static final class SynchronizedRandomAccessList_PersistenceDelegate extends java_util_Collections {
  54.158          protected Expression instantiate(Object oldInstance, Encoder out) {
  54.159 -            List list = new ArrayList((Collection) oldInstance);
  54.160 +            List<?> list = new ArrayList<>((Collection<?>) oldInstance);
  54.161              return new Expression(oldInstance, Collections.class, "synchronizedList", new Object[]{list});
  54.162          }
  54.163      }
  54.164  
  54.165      static final class SynchronizedSet_PersistenceDelegate extends java_util_Collections {
  54.166          protected Expression instantiate(Object oldInstance, Encoder out) {
  54.167 -            Set set = new HashSet((Set) oldInstance);
  54.168 +            Set<?> set = new HashSet<>((Set<?>) oldInstance);
  54.169              return new Expression(oldInstance, Collections.class, "synchronizedSet", new Object[]{set});
  54.170          }
  54.171      }
  54.172  
  54.173      static final class SynchronizedSortedSet_PersistenceDelegate extends java_util_Collections {
  54.174          protected Expression instantiate(Object oldInstance, Encoder out) {
  54.175 -            SortedSet set = new TreeSet((SortedSet) oldInstance);
  54.176 +            SortedSet<?> set = new TreeSet<>((SortedSet<?>) oldInstance);
  54.177              return new Expression(oldInstance, Collections.class, "synchronizedSortedSet", new Object[]{set});
  54.178          }
  54.179      }
  54.180  
  54.181      static final class SynchronizedMap_PersistenceDelegate extends java_util_Collections {
  54.182          protected Expression instantiate(Object oldInstance, Encoder out) {
  54.183 -            Map map = new HashMap((Map) oldInstance);
  54.184 +            Map<?,?> map = new HashMap<>((Map<?,?>) oldInstance);
  54.185              return new Expression(oldInstance, Collections.class, "synchronizedMap", new Object[]{map});
  54.186          }
  54.187      }
  54.188  
  54.189      static final class SynchronizedSortedMap_PersistenceDelegate extends java_util_Collections {
  54.190          protected Expression instantiate(Object oldInstance, Encoder out) {
  54.191 -            SortedMap map = new TreeMap((SortedMap) oldInstance);
  54.192 +            SortedMap<?,?> map = new TreeMap<>((SortedMap<?,?>) oldInstance);
  54.193              return new Expression(oldInstance, Collections.class, "synchronizedSortedMap", new Object[]{map});
  54.194          }
  54.195      }
  54.196 @@ -508,7 +508,7 @@
  54.197      static final class CheckedCollection_PersistenceDelegate extends java_util_Collections {
  54.198          protected Expression instantiate(Object oldInstance, Encoder out) {
  54.199              Object type = MetaData.getPrivateFieldValue(oldInstance, "java.util.Collections$CheckedCollection.type");
  54.200 -            List list = new ArrayList((Collection) oldInstance);
  54.201 +            List<?> list = new ArrayList<>((Collection<?>) oldInstance);
  54.202              return new Expression(oldInstance, Collections.class, "checkedCollection", new Object[]{list, type});
  54.203          }
  54.204      }
  54.205 @@ -516,7 +516,7 @@
  54.206      static final class CheckedList_PersistenceDelegate extends java_util_Collections {
  54.207          protected Expression instantiate(Object oldInstance, Encoder out) {
  54.208              Object type = MetaData.getPrivateFieldValue(oldInstance, "java.util.Collections$CheckedCollection.type");
  54.209 -            List list = new LinkedList((Collection) oldInstance);
  54.210 +            List<?> list = new LinkedList<>((Collection<?>) oldInstance);
  54.211              return new Expression(oldInstance, Collections.class, "checkedList", new Object[]{list, type});
  54.212          }
  54.213      }
  54.214 @@ -524,7 +524,7 @@
  54.215      static final class CheckedRandomAccessList_PersistenceDelegate extends java_util_Collections {
  54.216          protected Expression instantiate(Object oldInstance, Encoder out) {
  54.217              Object type = MetaData.getPrivateFieldValue(oldInstance, "java.util.Collections$CheckedCollection.type");
  54.218 -            List list = new ArrayList((Collection) oldInstance);
  54.219 +            List<?> list = new ArrayList<>((Collection<?>) oldInstance);
  54.220              return new Expression(oldInstance, Collections.class, "checkedList", new Object[]{list, type});
  54.221          }
  54.222      }
  54.223 @@ -532,7 +532,7 @@
  54.224      static final class CheckedSet_PersistenceDelegate extends java_util_Collections {
  54.225          protected Expression instantiate(Object oldInstance, Encoder out) {
  54.226              Object type = MetaData.getPrivateFieldValue(oldInstance, "java.util.Collections$CheckedCollection.type");
  54.227 -            Set set = new HashSet((Set) oldInstance);
  54.228 +            Set<?> set = new HashSet<>((Set<?>) oldInstance);
  54.229              return new Expression(oldInstance, Collections.class, "checkedSet", new Object[]{set, type});
  54.230          }
  54.231      }
  54.232 @@ -540,7 +540,7 @@
  54.233      static final class CheckedSortedSet_PersistenceDelegate extends java_util_Collections {
  54.234          protected Expression instantiate(Object oldInstance, Encoder out) {
  54.235              Object type = MetaData.getPrivateFieldValue(oldInstance, "java.util.Collections$CheckedCollection.type");
  54.236 -            SortedSet set = new TreeSet((SortedSet) oldInstance);
  54.237 +            SortedSet<?> set = new TreeSet<>((SortedSet<?>) oldInstance);
  54.238              return new Expression(oldInstance, Collections.class, "checkedSortedSet", new Object[]{set, type});
  54.239          }
  54.240      }
  54.241 @@ -549,7 +549,7 @@
  54.242          protected Expression instantiate(Object oldInstance, Encoder out) {
  54.243              Object keyType   = MetaData.getPrivateFieldValue(oldInstance, "java.util.Collections$CheckedMap.keyType");
  54.244              Object valueType = MetaData.getPrivateFieldValue(oldInstance, "java.util.Collections$CheckedMap.valueType");
  54.245 -            Map map = new HashMap((Map) oldInstance);
  54.246 +            Map<?,?> map = new HashMap<>((Map<?,?>) oldInstance);
  54.247              return new Expression(oldInstance, Collections.class, "checkedMap", new Object[]{map, keyType, valueType});
  54.248          }
  54.249      }
  54.250 @@ -558,7 +558,7 @@
  54.251          protected Expression instantiate(Object oldInstance, Encoder out) {
  54.252              Object keyType   = MetaData.getPrivateFieldValue(oldInstance, "java.util.Collections$CheckedMap.keyType");
  54.253              Object valueType = MetaData.getPrivateFieldValue(oldInstance, "java.util.Collections$CheckedMap.valueType");
  54.254 -            SortedMap map = new TreeMap((SortedMap) oldInstance);
  54.255 +            SortedMap<?,?> map = new TreeMap<>((SortedMap<?,?>) oldInstance);
  54.256              return new Expression(oldInstance, Collections.class, "checkedSortedMap", new Object[]{map, keyType, valueType});
  54.257          }
  54.258      }
  54.259 @@ -605,13 +605,13 @@
  54.260  // Collection
  54.261  class java_util_Collection_PersistenceDelegate extends DefaultPersistenceDelegate {
  54.262      protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
  54.263 -        java.util.Collection oldO = (java.util.Collection)oldInstance;
  54.264 -        java.util.Collection newO = (java.util.Collection)newInstance;
  54.265 +        java.util.Collection<?> oldO = (java.util.Collection)oldInstance;
  54.266 +        java.util.Collection<?> newO = (java.util.Collection)newInstance;
  54.267  
  54.268          if (newO.size() != 0) {
  54.269              invokeStatement(oldInstance, "clear", new Object[]{}, out);
  54.270          }
  54.271 -        for (Iterator i = oldO.iterator(); i.hasNext();) {
  54.272 +        for (Iterator<?> i = oldO.iterator(); i.hasNext();) {
  54.273              invokeStatement(oldInstance, "add", new Object[]{i.next()}, out);
  54.274          }
  54.275      }
  54.276 @@ -620,8 +620,8 @@
  54.277  // List
  54.278  class java_util_List_PersistenceDelegate extends DefaultPersistenceDelegate {
  54.279      protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
  54.280 -        java.util.List oldO = (java.util.List)oldInstance;
  54.281 -        java.util.List newO = (java.util.List)newInstance;
  54.282 +        java.util.List<?> oldO = (java.util.List<?>)oldInstance;
  54.283 +        java.util.List<?> newO = (java.util.List<?>)newInstance;
  54.284          int oldSize = oldO.size();
  54.285          int newSize = (newO == null) ? 0 : newO.size();
  54.286          if (oldSize < newSize) {
  54.287 @@ -656,8 +656,8 @@
  54.288  class java_util_Map_PersistenceDelegate extends DefaultPersistenceDelegate {
  54.289      protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
  54.290          // System.out.println("Initializing: " + newInstance);
  54.291 -        java.util.Map oldMap = (java.util.Map)oldInstance;
  54.292 -        java.util.Map newMap = (java.util.Map)newInstance;
  54.293 +        java.util.Map<?,?> oldMap = (java.util.Map)oldInstance;
  54.294 +        java.util.Map<?,?> newMap = (java.util.Map)newInstance;
  54.295          // Remove the new elements.
  54.296          // Do this first otherwise we undo the adding work.
  54.297          if (newMap != null) {
  54.298 @@ -746,9 +746,9 @@
  54.299          int style = Font.PLAIN;
  54.300          int size = 12;
  54.301  
  54.302 -        Map basic = font.getAttributes();
  54.303 -        Map clone = new HashMap(basic.size());
  54.304 -        for (Object key : basic.keySet()) {
  54.305 +        Map<TextAttribute, ?> basic = font.getAttributes();
  54.306 +        Map<TextAttribute, Object> clone = new HashMap<>(basic.size());
  54.307 +        for (TextAttribute key : basic.keySet()) {
  54.308              Object value = basic.get(key);
  54.309              if (value != null) {
  54.310                  clone.put(key, value);
  54.311 @@ -784,7 +784,7 @@
  54.312                  }
  54.313              }
  54.314          }
  54.315 -        Class type = font.getClass();
  54.316 +        Class<?> type = font.getClass();
  54.317          if (count == clone.size()) {
  54.318              return new Expression(font, type, "new", new Object[]{family, style, size});
  54.319          }
  54.320 @@ -832,7 +832,7 @@
  54.321          if (args == null) {
  54.322              throw new IllegalStateException("Unsupported KeyStroke: " + key);
  54.323          }
  54.324 -        Class type = key.getClass();
  54.325 +        Class<?> type = key.getClass();
  54.326          String name = type.getName();
  54.327          // get short name of the class
  54.328          int index = name.lastIndexOf('.') + 1;
  54.329 @@ -1057,12 +1057,12 @@
  54.330      protected void initialize(Class<?> type, Object oldInstance,
  54.331                                Object newInstance, Encoder out) {
  54.332          super.initialize(type, oldInstance, newInstance, out);
  54.333 -        Hashtable tab = (Hashtable)ReflectionUtils.getPrivateField(oldInstance,
  54.334 +        Hashtable<?,?> tab = (Hashtable<?,?>)ReflectionUtils.getPrivateField(oldInstance,
  54.335                                                                     java.awt.CardLayout.class,
  54.336                                                                     "tab",
  54.337                                                                     out.getExceptionListener());
  54.338          if (tab != null) {
  54.339 -            for(Enumeration e = tab.keys(); e.hasMoreElements();) {
  54.340 +            for(Enumeration<?> e = tab.keys(); e.hasMoreElements();) {
  54.341                  Object child = e.nextElement();
  54.342                  invokeStatement(oldInstance, "addLayoutComponent",
  54.343                                  new Object[]{child, (String)tab.get(child)}, out);
  54.344 @@ -1076,12 +1076,12 @@
  54.345      protected void initialize(Class<?> type, Object oldInstance,
  54.346                                Object newInstance, Encoder out) {
  54.347          super.initialize(type, oldInstance, newInstance, out);
  54.348 -        Hashtable comptable = (Hashtable)ReflectionUtils.getPrivateField(oldInstance,
  54.349 +        Hashtable<?,?> comptable = (Hashtable<?,?>)ReflectionUtils.getPrivateField(oldInstance,
  54.350                                                   java.awt.GridBagLayout.class,
  54.351                                                   "comptable",
  54.352                                                   out.getExceptionListener());
  54.353          if (comptable != null) {
  54.354 -            for(Enumeration e = comptable.keys(); e.hasMoreElements();) {
  54.355 +            for(Enumeration<?> e = comptable.keys(); e.hasMoreElements();) {
  54.356                  Object child = e.nextElement();
  54.357                  invokeStatement(oldInstance, "addLayoutComponent",
  54.358                                  new Object[]{child, comptable.get(child)}, out);
  54.359 @@ -1119,8 +1119,8 @@
  54.360      protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
  54.361          // Note, the "size" property will be set here.
  54.362          super.initialize(type, oldInstance, newInstance, out);
  54.363 -        javax.swing.DefaultListModel m = (javax.swing.DefaultListModel)oldInstance;
  54.364 -        javax.swing.DefaultListModel n = (javax.swing.DefaultListModel)newInstance;
  54.365 +        javax.swing.DefaultListModel<?> m = (javax.swing.DefaultListModel<?>)oldInstance;
  54.366 +        javax.swing.DefaultListModel<?> n = (javax.swing.DefaultListModel<?>)newInstance;
  54.367          for (int i = n.getSize(); i < m.getSize(); i++) {
  54.368              invokeStatement(oldInstance, "add", // Can also use "addElement".
  54.369                      new Object[]{m.getElementAt(i)}, out);
  54.370 @@ -1132,7 +1132,7 @@
  54.371  class javax_swing_DefaultComboBoxModel_PersistenceDelegate extends DefaultPersistenceDelegate {
  54.372      protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
  54.373          super.initialize(type, oldInstance, newInstance, out);
  54.374 -        javax.swing.DefaultComboBoxModel m = (javax.swing.DefaultComboBoxModel)oldInstance;
  54.375 +        javax.swing.DefaultComboBoxModel<?> m = (javax.swing.DefaultComboBoxModel<?>)oldInstance;
  54.376          for (int i = 0; i < m.getSize(); i++) {
  54.377              invokeStatement(oldInstance, "addElement", new Object[]{m.getElementAt(i)}, out);
  54.378          }
  54.379 @@ -1275,7 +1275,7 @@
  54.380  
  54.381  class MetaData {
  54.382      private static final Map<String,Field> fields = Collections.synchronizedMap(new WeakHashMap<String, Field>());
  54.383 -    private static Hashtable internalPersistenceDelegates = new Hashtable();
  54.384 +    private static Hashtable<String, PersistenceDelegate> internalPersistenceDelegates = new Hashtable<>();
  54.385  
  54.386      private static PersistenceDelegate nullPersistenceDelegate = new NullPersistenceDelegate();
  54.387      private static PersistenceDelegate enumPersistenceDelegate = new EnumPersistenceDelegate();
  54.388 @@ -1308,6 +1308,7 @@
  54.389          internalPersistenceDelegates.put("java.util.RegularEnumSet", new java_util_EnumSet_PersistenceDelegate());
  54.390      }
  54.391  
  54.392 +    @SuppressWarnings("rawtypes")
  54.393      public synchronized static PersistenceDelegate getPersistenceDelegate(Class type) {
  54.394          if (type == null) {
  54.395              return nullPersistenceDelegate;
  54.396 @@ -1342,7 +1343,7 @@
  54.397          String typeName = type.getName();
  54.398          PersistenceDelegate pd = (PersistenceDelegate)getBeanAttribute(type, "persistenceDelegate");
  54.399          if (pd == null) {
  54.400 -            pd = (PersistenceDelegate)internalPersistenceDelegates.get(typeName);
  54.401 +            pd = internalPersistenceDelegates.get(typeName);
  54.402              if (pd != null) {
  54.403                  return pd;
  54.404              }
  54.405 @@ -1369,7 +1370,7 @@
  54.406          return (pd != null) ? pd : defaultPersistenceDelegate;
  54.407      }
  54.408  
  54.409 -    private static String[] getConstructorProperties(Class type) {
  54.410 +    private static String[] getConstructorProperties(Class<?> type) {
  54.411          String[] names = null;
  54.412          int length = 0;
  54.413          for (Constructor<?> constructor : type.getConstructors()) {
  54.414 @@ -1402,7 +1403,7 @@
  54.415          return true;
  54.416      }
  54.417  
  54.418 -    private static Object getBeanAttribute(Class type, String attribute) {
  54.419 +    private static Object getBeanAttribute(Class<?> type, String attribute) {
  54.420          try {
  54.421              return Introspector.getBeanInfo(type).getBeanDescriptor().getValue(attribute);
  54.422          } catch (IntrospectionException exception) {
    55.1 --- a/src/share/classes/java/beans/MethodDescriptor.java	Tue Dec 06 16:31:58 2011 -0800
    55.2 +++ b/src/share/classes/java/beans/MethodDescriptor.java	Mon Dec 19 10:06:23 2011 -0800
    55.3 @@ -42,7 +42,7 @@
    55.4  
    55.5      private String[] paramNames;
    55.6  
    55.7 -    private List params;
    55.8 +    private List<WeakReference<Class<?>>> params;
    55.9  
   55.10      private ParameterDescriptor parameterDescriptors[];
   55.11  
   55.12 @@ -81,10 +81,10 @@
   55.13      public synchronized Method getMethod() {
   55.14          Method method = getMethod0();
   55.15          if (method == null) {
   55.16 -            Class cls = getClass0();
   55.17 +            Class<?> cls = getClass0();
   55.18              String name = getName();
   55.19              if ((cls != null) && (name != null)) {
   55.20 -                Class[] params = getParams();
   55.21 +                Class<?>[] params = getParams();
   55.22                  if (params == null) {
   55.23                      for (int i = 0; i < 3; i++) {
   55.24                          // Find methods for up to 2 params. We are guessing here.
   55.25 @@ -121,15 +121,15 @@
   55.26                  : null;
   55.27      }
   55.28  
   55.29 -    private synchronized void setParams(Class[] param) {
   55.30 +    private synchronized void setParams(Class<?>[] param) {
   55.31          if (param == null) {
   55.32              return;
   55.33          }
   55.34          paramNames = new String[param.length];
   55.35 -        params = new ArrayList(param.length);
   55.36 +        params = new ArrayList<>(param.length);
   55.37          for (int i = 0; i < param.length; i++) {
   55.38              paramNames[i] = param[i].getName();
   55.39 -            params.add(new WeakReference(param[i]));
   55.40 +            params.add(new WeakReference<Class<?>>(param[i]));
   55.41          }
   55.42      }
   55.43  
   55.44 @@ -138,12 +138,12 @@
   55.45          return paramNames;
   55.46      }
   55.47  
   55.48 -    private synchronized Class[] getParams() {
   55.49 -        Class[] clss = new Class[params.size()];
   55.50 +    private synchronized Class<?>[] getParams() {
   55.51 +        Class<?>[] clss = new Class<?>[params.size()];
   55.52  
   55.53          for (int i = 0; i < params.size(); i++) {
   55.54 -            Reference ref = (Reference)params.get(i);
   55.55 -            Class cls = (Class)ref.get();
   55.56 +            Reference<? extends Class<?>> ref = (Reference<? extends Class<?>>)params.get(i);
   55.57 +            Class<?> cls = ref.get();
   55.58              if (cls == null) {
   55.59                  return null;
   55.60              } else {
    56.1 --- a/src/share/classes/java/beans/NameGenerator.java	Tue Dec 06 16:31:58 2011 -0800
    56.2 +++ b/src/share/classes/java/beans/NameGenerator.java	Mon Dec 19 10:06:23 2011 -0800
    56.3 @@ -43,12 +43,12 @@
    56.4   */
    56.5  class NameGenerator {
    56.6  
    56.7 -    private Map valueToName;
    56.8 -    private Map nameToCount;
    56.9 +    private Map<Object, String> valueToName;
   56.10 +    private Map<String, Integer> nameToCount;
   56.11  
   56.12      public NameGenerator() {
   56.13 -        valueToName = new IdentityHashMap();
   56.14 -        nameToCount = new HashMap();
   56.15 +        valueToName = new IdentityHashMap<>();
   56.16 +        nameToCount = new HashMap<>();
   56.17      }
   56.18  
   56.19      /**
   56.20 @@ -63,6 +63,7 @@
   56.21      /**
   56.22       * Returns the root name of the class.
   56.23       */
   56.24 +    @SuppressWarnings("rawtypes")
   56.25      public static String unqualifiedClassName(Class type) {
   56.26          if (type.isArray()) {
   56.27              return unqualifiedClassName(type.getComponentType())+"Array";
   56.28 @@ -97,15 +98,15 @@
   56.29              return unqualifiedClassName((Class)instance);
   56.30          }
   56.31          else {
   56.32 -            String result = (String)valueToName.get(instance);
   56.33 +            String result = valueToName.get(instance);
   56.34              if (result != null) {
   56.35                  return result;
   56.36              }
   56.37 -            Class type = instance.getClass();
   56.38 +            Class<?> type = instance.getClass();
   56.39              String className = unqualifiedClassName(type);
   56.40  
   56.41 -            Object size = nameToCount.get(className);
   56.42 -            int instanceNumber = (size == null) ? 0 : ((Integer)size).intValue() + 1;
   56.43 +            Integer size = nameToCount.get(className);
   56.44 +            int instanceNumber = (size == null) ? 0 : (size).intValue() + 1;
   56.45              nameToCount.put(className, new Integer(instanceNumber));
   56.46  
   56.47              result = className + instanceNumber;
    57.1 --- a/src/share/classes/java/beans/PersistenceDelegate.java	Tue Dec 06 16:31:58 2011 -0800
    57.2 +++ b/src/share/classes/java/beans/PersistenceDelegate.java	Mon Dec 19 10:06:23 2011 -0800
    57.3 @@ -207,7 +207,7 @@
    57.4                                Object oldInstance, Object newInstance,
    57.5                                Encoder out)
    57.6      {
    57.7 -        Class superType = type.getSuperclass();
    57.8 +        Class<?> superType = type.getSuperclass();
    57.9          PersistenceDelegate info = out.getPersistenceDelegate(superType);
   57.10          info.initialize(superType, oldInstance, newInstance, out);
   57.11      }
    58.1 --- a/src/share/classes/java/beans/PropertyChangeEvent.java	Tue Dec 06 16:31:58 2011 -0800
    58.2 +++ b/src/share/classes/java/beans/PropertyChangeEvent.java	Mon Dec 19 10:06:23 2011 -0800
    58.3 @@ -1,5 +1,5 @@
    58.4  /*
    58.5 - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
    58.6 + * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
    58.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    58.8   *
    58.9   * This code is free software; you can redistribute it and/or modify it
   58.10 @@ -25,6 +25,8 @@
   58.11  
   58.12  package java.beans;
   58.13  
   58.14 +import java.util.EventObject;
   58.15 +
   58.16  /**
   58.17   * A "PropertyChange" event gets delivered whenever a bean changes a "bound"
   58.18   * or "constrained" property.  A PropertyChangeEvent object is sent as an
   58.19 @@ -42,21 +44,21 @@
   58.20   * arbitrary set of if its properties have changed.  In this case the
   58.21   * old and new values should also be null.
   58.22   */
   58.23 -
   58.24 -public class PropertyChangeEvent extends java.util.EventObject {
   58.25 +public class PropertyChangeEvent extends EventObject {
   58.26      private static final long serialVersionUID = 7042693688939648123L;
   58.27  
   58.28      /**
   58.29 -     * Constructs a new <code>PropertyChangeEvent</code>.
   58.30 +     * Constructs a new {@code PropertyChangeEvent}.
   58.31       *
   58.32 -     * @param source  The bean that fired the event.
   58.33 -     * @param propertyName  The programmatic name of the property
   58.34 -     *          that was changed.
   58.35 -     * @param oldValue  The old value of the property.
   58.36 -     * @param newValue  The new value of the property.
   58.37 +     * @param source        the bean that fired the event
   58.38 +     * @param propertyName  the programmatic name of the property that was changed
   58.39 +     * @param oldValue      the old value of the property
   58.40 +     * @param newValue      the new value of the property
   58.41 +     *
   58.42 +     * @throws IllegalArgumentException if {@code source} is {@code null}
   58.43       */
   58.44      public PropertyChangeEvent(Object source, String propertyName,
   58.45 -                                     Object oldValue, Object newValue) {
   58.46 +                               Object oldValue, Object newValue) {
   58.47          super(source);
   58.48          this.propertyName = propertyName;
   58.49          this.newValue = newValue;
    59.1 --- a/src/share/classes/java/beans/PropertyChangeSupport.java	Tue Dec 06 16:31:58 2011 -0800
    59.2 +++ b/src/share/classes/java/beans/PropertyChangeSupport.java	Mon Dec 19 10:06:23 2011 -0800
    59.3 @@ -431,7 +431,7 @@
    59.4                      listeners = entry.getValue();
    59.5                  } else {
    59.6                      if (children == null) {
    59.7 -                        children = new Hashtable<String, PropertyChangeSupport>();
    59.8 +                        children = new Hashtable<>();
    59.9                      }
   59.10                      PropertyChangeSupport pcs = new PropertyChangeSupport(this.source);
   59.11                      pcs.map.set(null, entry.getValue());
   59.12 @@ -460,6 +460,7 @@
   59.13  
   59.14          ObjectInputStream.GetField fields = s.readFields();
   59.15  
   59.16 +        @SuppressWarnings("unchecked")
   59.17          Hashtable<String, PropertyChangeSupport> children = (Hashtable<String, PropertyChangeSupport>) fields.get("children", null);
   59.18          this.source = fields.get("source", null);
   59.19          fields.get("propertyChangeSupportSerializedDataVersion", 2);
    60.1 --- a/src/share/classes/java/beans/PropertyDescriptor.java	Tue Dec 06 16:31:58 2011 -0800
    60.2 +++ b/src/share/classes/java/beans/PropertyDescriptor.java	Mon Dec 19 10:06:23 2011 -0800
    60.3 @@ -35,10 +35,10 @@
    60.4   */
    60.5  public class PropertyDescriptor extends FeatureDescriptor {
    60.6  
    60.7 -    private Reference<Class> propertyTypeRef;
    60.8 +    private Reference<? extends Class<?>> propertyTypeRef;
    60.9      private Reference<Method> readMethodRef;
   60.10      private Reference<Method> writeMethodRef;
   60.11 -    private Reference<Class> propertyEditorClassRef;
   60.12 +    private Reference<? extends Class<?>> propertyEditorClassRef;
   60.13  
   60.14      private boolean bound;
   60.15      private boolean constrained;
   60.16 @@ -174,7 +174,7 @@
   60.17       *         or {@code null} if the type cannot be determined
   60.18       */
   60.19      public synchronized Class<?> getPropertyType() {
   60.20 -        Class type = getPropertyType0();
   60.21 +        Class<?> type = getPropertyType0();
   60.22          if (type  == null) {
   60.23              try {
   60.24                  type = findPropertyType(getReadMethod(), getWriteMethod());
   60.25 @@ -186,11 +186,11 @@
   60.26          return type;
   60.27      }
   60.28  
   60.29 -    private void setPropertyType(Class type) {
   60.30 +    private void setPropertyType(Class<?> type) {
   60.31          this.propertyTypeRef = getWeakReference(type);
   60.32      }
   60.33  
   60.34 -    private Class getPropertyType0() {
   60.35 +    private Class<?> getPropertyType0() {
   60.36          return (this.propertyTypeRef != null)
   60.37                  ? this.propertyTypeRef.get()
   60.38                  : null;
   60.39 @@ -205,13 +205,13 @@
   60.40      public synchronized Method getReadMethod() {
   60.41          Method readMethod = getReadMethod0();
   60.42          if (readMethod == null) {
   60.43 -            Class cls = getClass0();
   60.44 +            Class<?> cls = getClass0();
   60.45              if (cls == null || (readMethodName == null && readMethodRef == null)) {
   60.46                  // The read method was explicitly set to null.
   60.47                  return null;
   60.48              }
   60.49              if (readMethodName == null) {
   60.50 -                Class type = getPropertyType0();
   60.51 +                Class<?> type = getPropertyType0();
   60.52                  if (type == boolean.class || type == null) {
   60.53                      readMethodName = Introspector.IS_PREFIX + getBaseName();
   60.54                  } else {
   60.55 @@ -268,14 +268,14 @@
   60.56      public synchronized Method getWriteMethod() {
   60.57          Method writeMethod = getWriteMethod0();
   60.58          if (writeMethod == null) {
   60.59 -            Class cls = getClass0();
   60.60 +            Class<?> cls = getClass0();
   60.61              if (cls == null || (writeMethodName == null && writeMethodRef == null)) {
   60.62                  // The write method was explicitly set to null.
   60.63                  return null;
   60.64              }
   60.65  
   60.66              // We need the type to fetch the correct method.
   60.67 -            Class type = getPropertyType0();
   60.68 +            Class<?> type = getPropertyType0();
   60.69              if (type == null) {
   60.70                  try {
   60.71                      // Can't use getPropertyType since it will lead to recursive loop.
   60.72 @@ -292,7 +292,7 @@
   60.73                  writeMethodName = Introspector.SET_PREFIX + getBaseName();
   60.74              }
   60.75  
   60.76 -            Class[] args = (type == null) ? null : new Class[] { type };
   60.77 +            Class<?>[] args = (type == null) ? null : new Class<?>[] { type };
   60.78              writeMethod = Introspector.findMethod(cls, writeMethodName, 1, args);
   60.79              if (writeMethod != null) {
   60.80                  if (!writeMethod.getReturnType().equals(void.class)) {
   60.81 @@ -344,7 +344,7 @@
   60.82      /**
   60.83       * Overridden to ensure that a super class doesn't take precedent
   60.84       */
   60.85 -    void setClass0(Class clz) {
   60.86 +    void setClass0(Class<?> clz) {
   60.87          if (getClass0() != null && clz.isAssignableFrom(getClass0())) {
   60.88              // dont replace a subclass with a superclass
   60.89              return;
   60.90 @@ -402,7 +402,7 @@
   60.91       * @param propertyEditorClass  The Class for the desired PropertyEditor.
   60.92       */
   60.93      public void setPropertyEditorClass(Class<?> propertyEditorClass) {
   60.94 -        this.propertyEditorClassRef = getWeakReference((Class)propertyEditorClass);
   60.95 +        this.propertyEditorClassRef = getWeakReference(propertyEditorClass);
   60.96      }
   60.97  
   60.98      /**
   60.99 @@ -437,12 +437,12 @@
  60.100      public PropertyEditor createPropertyEditor(Object bean) {
  60.101          Object editor = null;
  60.102  
  60.103 -        Class cls = getPropertyEditorClass();
  60.104 +        Class<?> cls = getPropertyEditorClass();
  60.105          if (cls != null) {
  60.106 -            Constructor ctor = null;
  60.107 +            Constructor<?> ctor = null;
  60.108              if (bean != null) {
  60.109                  try {
  60.110 -                    ctor = cls.getConstructor(new Class[] { Object.class });
  60.111 +                    ctor = cls.getConstructor(new Class<?>[] { Object.class });
  60.112                  } catch (Exception ex) {
  60.113                      // Fall through
  60.114                  }
  60.115 @@ -454,10 +454,7 @@
  60.116                      editor = ctor.newInstance(new Object[] { bean });
  60.117                  }
  60.118              } catch (Exception ex) {
  60.119 -                // A serious error has occured.
  60.120 -                // Proably due to an invalid property editor.
  60.121 -                throw new RuntimeException("PropertyEditor not instantiated",
  60.122 -                                           ex);
  60.123 +                // Fall through
  60.124              }
  60.125          }
  60.126          return (PropertyEditor)editor;
  60.127 @@ -637,12 +634,12 @@
  60.128       *         read and write methods are null.
  60.129       * @throws IntrospectionException if the read or write method is invalid
  60.130       */
  60.131 -    private Class findPropertyType(Method readMethod, Method writeMethod)
  60.132 +    private Class<?> findPropertyType(Method readMethod, Method writeMethod)
  60.133          throws IntrospectionException {
  60.134 -        Class propertyType = null;
  60.135 +        Class<?> propertyType = null;
  60.136          try {
  60.137              if (readMethod != null) {
  60.138 -                Class[] params = getParameterTypes(getClass0(), readMethod);
  60.139 +                Class<?>[] params = getParameterTypes(getClass0(), readMethod);
  60.140                  if (params.length != 0) {
  60.141                      throw new IntrospectionException("bad read method arg count: "
  60.142                                                       + readMethod);
  60.143 @@ -654,7 +651,7 @@
  60.144                  }
  60.145              }
  60.146              if (writeMethod != null) {
  60.147 -                Class params[] = getParameterTypes(getClass0(), writeMethod);
  60.148 +                Class<?>[] params = getParameterTypes(getClass0(), writeMethod);
  60.149                  if (params.length != 1) {
  60.150                      throw new IntrospectionException("bad write method arg count: "
  60.151                                                       + writeMethod);
    61.1 --- a/src/share/classes/java/beans/PropertyEditorManager.java	Tue Dec 06 16:31:58 2011 -0800
    61.2 +++ b/src/share/classes/java/beans/PropertyEditorManager.java	Mon Dec 19 10:06:23 2011 -0800
    61.3 @@ -25,9 +25,6 @@
    61.4  
    61.5  package java.beans;
    61.6  
    61.7 -import com.sun.beans.finder.PropertyEditorFinder;
    61.8 -import sun.awt.AppContext;
    61.9 -
   61.10  /**
   61.11   * The PropertyEditorManager can be used to locate a property editor for
   61.12   * any given type name.  This property editor must support the
   61.13 @@ -55,8 +52,6 @@
   61.14  
   61.15  public class PropertyEditorManager {
   61.16  
   61.17 -    private static final Object FINDER_KEY = new Object();
   61.18 -
   61.19      /**
   61.20       * Registers an editor class to edit values of the given target class.
   61.21       * If the editor class is {@code null},
   61.22 @@ -81,7 +76,7 @@
   61.23          if (sm != null) {
   61.24              sm.checkPropertiesAccess();
   61.25          }
   61.26 -        getFinder().register(targetType, editorClass);
   61.27 +        ThreadGroupContext.getContext().getPropertyEditorFinder().register(targetType, editorClass);
   61.28      }
   61.29  
   61.30      /**
   61.31 @@ -92,7 +87,7 @@
   61.32       * The result is null if no suitable editor can be found.
   61.33       */
   61.34      public static PropertyEditor findEditor(Class<?> targetType) {
   61.35 -        return getFinder().find(targetType);
   61.36 +        return ThreadGroupContext.getContext().getPropertyEditorFinder().find(targetType);
   61.37      }
   61.38  
   61.39      /**
   61.40 @@ -104,7 +99,7 @@
   61.41       *         e.g. Sun implementation initially sets to  {"sun.beans.editors"}.
   61.42       */
   61.43      public static String[] getEditorSearchPath() {
   61.44 -        return getFinder().getPackages();
   61.45 +        return ThreadGroupContext.getContext().getPropertyEditorFinder().getPackages();
   61.46      }
   61.47  
   61.48      /**
   61.49 @@ -125,17 +120,6 @@
   61.50          if (sm != null) {
   61.51              sm.checkPropertiesAccess();
   61.52          }
   61.53 -        getFinder().setPackages(path);
   61.54 -    }
   61.55 -
   61.56 -    private static PropertyEditorFinder getFinder() {
   61.57 -        AppContext context = AppContext.getAppContext();
   61.58 -        Object object = context.get(FINDER_KEY);
   61.59 -        if (object instanceof PropertyEditorFinder) {
   61.60 -            return (PropertyEditorFinder) object;
   61.61 -        }
   61.62 -        PropertyEditorFinder finder = new PropertyEditorFinder();
   61.63 -        context.put(FINDER_KEY, finder);
   61.64 -        return finder;
   61.65 +        ThreadGroupContext.getContext().getPropertyEditorFinder().setPackages(path);
   61.66      }
   61.67  }
    62.1 --- a/src/share/classes/java/beans/PropertyEditorSupport.java	Tue Dec 06 16:31:58 2011 -0800
    62.2 +++ b/src/share/classes/java/beans/PropertyEditorSupport.java	Mon Dec 19 10:06:23 2011 -0800
    62.3 @@ -251,7 +251,7 @@
    62.4      public synchronized void addPropertyChangeListener(
    62.5                                  PropertyChangeListener listener) {
    62.6          if (listeners == null) {
    62.7 -            listeners = new java.util.Vector();
    62.8 +            listeners = new java.util.Vector<>();
    62.9          }
   62.10          listeners.addElement(listener);
   62.11      }
   62.12 @@ -278,25 +278,30 @@
   62.13       * Report that we have been modified to any interested listeners.
   62.14       */
   62.15      public void firePropertyChange() {
   62.16 -        java.util.Vector targets;
   62.17 +        java.util.Vector<PropertyChangeListener> targets;
   62.18          synchronized (this) {
   62.19              if (listeners == null) {
   62.20                  return;
   62.21              }
   62.22 -            targets = (java.util.Vector) listeners.clone();
   62.23 +            targets = unsafeClone(listeners);
   62.24          }
   62.25          // Tell our listeners that "everything" has changed.
   62.26          PropertyChangeEvent evt = new PropertyChangeEvent(source, null, null, null);
   62.27  
   62.28          for (int i = 0; i < targets.size(); i++) {
   62.29 -            PropertyChangeListener target = (PropertyChangeListener)targets.elementAt(i);
   62.30 +            PropertyChangeListener target = targets.elementAt(i);
   62.31              target.propertyChange(evt);
   62.32          }
   62.33      }
   62.34  
   62.35 +    @SuppressWarnings("unchecked")
   62.36 +    private <T> java.util.Vector<T> unsafeClone(java.util.Vector<T> v) {
   62.37 +        return (java.util.Vector<T>)v.clone();
   62.38 +    }
   62.39 +
   62.40      //----------------------------------------------------------------------
   62.41  
   62.42      private Object value;
   62.43      private Object source;
   62.44 -    private java.util.Vector listeners;
   62.45 +    private java.util.Vector<PropertyChangeListener> listeners;
   62.46  }
    63.1 --- a/src/share/classes/java/beans/ReflectionUtils.java	Tue Dec 06 16:31:58 2011 -0800
    63.2 +++ b/src/share/classes/java/beans/ReflectionUtils.java	Mon Dec 19 10:06:23 2011 -0800
    63.3 @@ -32,10 +32,12 @@
    63.4   */
    63.5  class ReflectionUtils {
    63.6  
    63.7 +    @SuppressWarnings("rawtypes")
    63.8      public static boolean isPrimitive(Class type) {
    63.9          return primitiveTypeFor(type) != null;
   63.10      }
   63.11  
   63.12 +    @SuppressWarnings("rawtypes")
   63.13      public static Class primitiveTypeFor(Class wrapper) {
   63.14          if (wrapper == Boolean.class) return Boolean.TYPE;
   63.15          if (wrapper == Byte.class) return Byte.TYPE;
   63.16 @@ -58,6 +60,7 @@
   63.17       * @param el an exception listener to handle exceptions; or null
   63.18       * @return value of the field; null if not found or an error is encountered
   63.19       */
   63.20 +    @SuppressWarnings("rawtypes")
   63.21      public static Object getPrivateField(Object instance, Class cls,
   63.22                                           String name, ExceptionListener el) {
   63.23          try {
    64.1 --- a/src/share/classes/java/beans/SimpleBeanInfo.java	Tue Dec 06 16:31:58 2011 -0800
    64.2 +++ b/src/share/classes/java/beans/SimpleBeanInfo.java	Mon Dec 19 10:06:23 2011 -0800
    64.3 @@ -116,10 +116,10 @@
    64.4       */
    64.5      public java.awt.Image loadImage(final String resourceName) {
    64.6          try {
    64.7 -            final Class c = getClass();
    64.8 +            final Class<?> c = getClass();
    64.9              java.awt.image.ImageProducer ip = (java.awt.image.ImageProducer)
   64.10                  java.security.AccessController.doPrivileged(
   64.11 -                new java.security.PrivilegedAction() {
   64.12 +                new java.security.PrivilegedAction<Object>() {
   64.13                      public Object run() {
   64.14                          java.net.URL url;
   64.15                          if ((url = c.getResource(resourceName)) == null) {
    65.1 --- a/src/share/classes/java/beans/Statement.java	Tue Dec 06 16:31:58 2011 -0800
    65.2 +++ b/src/share/classes/java/beans/Statement.java	Mon Dec 19 10:06:23 2011 -0800
    65.3 @@ -212,7 +212,7 @@
    65.4          if (target == Class.class && methodName.equals("forName")) {
    65.5              return ClassFinder.resolveClass((String)arguments[0], this.loader);
    65.6          }
    65.7 -        Class[] argClasses = new Class[arguments.length];
    65.8 +        Class<?>[] argClasses = new Class<?>[arguments.length];
    65.9          for(int i = 0; i < arguments.length; i++) {
   65.10              argClasses[i] = (arguments[i] == null) ? null : arguments[i].getClass();
   65.11          }
    66.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    66.2 +++ b/src/share/classes/java/beans/ThreadGroupContext.java	Mon Dec 19 10:06:23 2011 -0800
    66.3 @@ -0,0 +1,133 @@
    66.4 +/*
    66.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    66.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    66.7 + *
    66.8 + * This code is free software; you can redistribute it and/or modify it
    66.9 + * under the terms of the GNU General Public License version 2 only, as
   66.10 + * published by the Free Software Foundation.  Oracle designates this
   66.11 + * particular file as subject to the "Classpath" exception as provided
   66.12 + * by Oracle in the LICENSE file that accompanied this code.
   66.13 + *
   66.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
   66.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   66.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   66.17 + * version 2 for more details (a copy is included in the LICENSE file that
   66.18 + * accompanied this code).
   66.19 + *
   66.20 + * You should have received a copy of the GNU General Public License version
   66.21 + * 2 along with this work; if not, write to the Free Software Foundation,
   66.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   66.23 + *
   66.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   66.25 + * or visit www.oracle.com if you need additional information or have any
   66.26 + * questions.
   66.27 + */
   66.28 +
   66.29 +package java.beans;
   66.30 +
   66.31 +import com.sun.beans.finder.BeanInfoFinder;
   66.32 +import com.sun.beans.finder.PropertyEditorFinder;
   66.33 +
   66.34 +import java.awt.GraphicsEnvironment;
   66.35 +import java.util.HashMap;
   66.36 +import java.util.Map;
   66.37 +import java.util.WeakHashMap;
   66.38 +
   66.39 +/**
   66.40 + * The {@code ThreadGroupContext} is an application-dependent
   66.41 + * context referenced by the specific {@link ThreadGroup}.
   66.42 + * This is a replacement for the {@link sun.awt.AppContext}.
   66.43 + *
   66.44 + * @author  Sergey Malenkov
   66.45 + */
   66.46 +final class ThreadGroupContext {
   66.47 +
   66.48 +    private static final Map<ThreadGroup, ThreadGroupContext> contexts = new WeakHashMap<>();
   66.49 +
   66.50 +    /**
   66.51 +     * Returns the appropriate {@code AppContext} for the caller,
   66.52 +     * as determined by its {@code ThreadGroup}.
   66.53 +     *
   66.54 +     * @return  the application-dependent context
   66.55 +     */
   66.56 +    static ThreadGroupContext getContext() {
   66.57 +        ThreadGroup group = Thread.currentThread().getThreadGroup();
   66.58 +        synchronized (contexts) {
   66.59 +            ThreadGroupContext context = contexts.get(group);
   66.60 +            if (context == null) {
   66.61 +                context = new ThreadGroupContext();
   66.62 +                contexts.put(group, context);
   66.63 +            }
   66.64 +            return context;
   66.65 +        }
   66.66 +    }
   66.67 +
   66.68 +    private volatile boolean isDesignTime;
   66.69 +    private volatile Boolean isGuiAvailable;
   66.70 +
   66.71 +    private Map<Class<?>, BeanInfo> beanInfoCache;
   66.72 +    private BeanInfoFinder beanInfoFinder;
   66.73 +    private PropertyEditorFinder propertyEditorFinder;
   66.74 +
   66.75 +
   66.76 +    boolean isDesignTime() {
   66.77 +        return this.isDesignTime;
   66.78 +    }
   66.79 +
   66.80 +    void setDesignTime(boolean isDesignTime) {
   66.81 +        this.isDesignTime = isDesignTime;
   66.82 +    }
   66.83 +
   66.84 +
   66.85 +    boolean isGuiAvailable() {
   66.86 +        Boolean isGuiAvailable = this.isGuiAvailable;
   66.87 +        return (isGuiAvailable != null)
   66.88 +                ? isGuiAvailable.booleanValue()
   66.89 +                : !GraphicsEnvironment.isHeadless();
   66.90 +    }
   66.91 +
   66.92 +    void setGuiAvailable(boolean isGuiAvailable) {
   66.93 +        this.isGuiAvailable = Boolean.valueOf(isGuiAvailable);
   66.94 +    }
   66.95 +
   66.96 +
   66.97 +    BeanInfo getBeanInfo(Class<?> type) {
   66.98 +        return (this.beanInfoCache != null)
   66.99 +                ? this.beanInfoCache.get(type)
  66.100 +                : null;
  66.101 +    }
  66.102 +
  66.103 +    BeanInfo putBeanInfo(Class<?> type, BeanInfo info) {
  66.104 +        if (this.beanInfoCache == null) {
  66.105 +            this.beanInfoCache = new WeakHashMap<>();
  66.106 +        }
  66.107 +        return this.beanInfoCache.put(type, info);
  66.108 +    }
  66.109 +
  66.110 +    void removeBeanInfo(Class<?> type) {
  66.111 +        if (this.beanInfoCache != null) {
  66.112 +            this.beanInfoCache.remove(type);
  66.113 +        }
  66.114 +    }
  66.115 +
  66.116 +    void clearBeanInfoCache() {
  66.117 +        if (this.beanInfoCache != null) {
  66.118 +            this.beanInfoCache.clear();
  66.119 +        }
  66.120 +    }
  66.121 +
  66.122 +
  66.123 +    synchronized BeanInfoFinder getBeanInfoFinder() {
  66.124 +        if (this.beanInfoFinder == null) {
  66.125 +            this.beanInfoFinder = new BeanInfoFinder();
  66.126 +        }
  66.127 +        return this.beanInfoFinder;
  66.128 +    }
  66.129 +
  66.130 +    synchronized PropertyEditorFinder getPropertyEditorFinder() {
  66.131 +        if (this.propertyEditorFinder == null) {
  66.132 +            this.propertyEditorFinder = new PropertyEditorFinder();
  66.133 +        }
  66.134 +        return this.propertyEditorFinder;
  66.135 +    }
  66.136 +}
    67.1 --- a/src/share/classes/java/beans/VetoableChangeSupport.java	Tue Dec 06 16:31:58 2011 -0800
    67.2 +++ b/src/share/classes/java/beans/VetoableChangeSupport.java	Mon Dec 19 10:06:23 2011 -0800
    67.3 @@ -420,7 +420,7 @@
    67.4                      listeners = entry.getValue();
    67.5                  } else {
    67.6                      if (children == null) {
    67.7 -                        children = new Hashtable<String, VetoableChangeSupport>();
    67.8 +                        children = new Hashtable<>();
    67.9                      }
   67.10                      VetoableChangeSupport vcs = new VetoableChangeSupport(this.source);
   67.11                      vcs.map.set(null, entry.getValue());
   67.12 @@ -449,7 +449,8 @@
   67.13  
   67.14          ObjectInputStream.GetField fields = s.readFields();
   67.15  
   67.16 -        Hashtable<String, VetoableChangeSupport> children = (Hashtable<String, VetoableChangeSupport>) fields.get("children", null);
   67.17 +        @SuppressWarnings("unchecked")
   67.18 +        Hashtable<String, VetoableChangeSupport> children = (Hashtable<String, VetoableChangeSupport>)fields.get("children", null);
   67.19          this.source = fields.get("source", null);
   67.20          fields.get("vetoableChangeSupportSerializedDataVersion", 2);
   67.21  
    68.1 --- a/src/share/classes/java/beans/XMLEncoder.java	Tue Dec 06 16:31:58 2011 -0800
    68.2 +++ b/src/share/classes/java/beans/XMLEncoder.java	Mon Dec 19 10:06:23 2011 -0800
    68.3 @@ -287,8 +287,8 @@
    68.4          this.declaration = declaration;
    68.5          this.indentation = indentation;
    68.6          this.out = new OutputStreamWriter(out, cs.newEncoder());
    68.7 -        valueToExpression = new IdentityHashMap<Object, ValueData>();
    68.8 -        targetToStatementList = new IdentityHashMap<Object, List<Statement>>();
    68.9 +        valueToExpression = new IdentityHashMap<>();
   68.10 +        targetToStatementList = new IdentityHashMap<>();
   68.11          nameGenerator = new NameGenerator();
   68.12      }
   68.13  
   68.14 @@ -334,7 +334,7 @@
   68.15      private List<Statement> statementList(Object target) {
   68.16          List<Statement> list = targetToStatementList.get(target);
   68.17          if (list == null) {
   68.18 -            list = new ArrayList<Statement>();
   68.19 +            list = new ArrayList<>();
   68.20              targetToStatementList.put(target, list);
   68.21          }
   68.22          return list;
   68.23 @@ -604,7 +604,7 @@
   68.24                  return;
   68.25              }
   68.26  
   68.27 -            Class primitiveType = ReflectionUtils.primitiveTypeFor(value.getClass());
   68.28 +            Class<?> primitiveType = ReflectionUtils.primitiveTypeFor(value.getClass());
   68.29              if (primitiveType != null && target == value.getClass() &&
   68.30                  methodName.equals("new")) {
   68.31                  String primitiveTypeName = primitiveType.getName();
    69.1 --- a/src/share/classes/java/beans/beancontext/BeanContext.java	Tue Dec 06 16:31:58 2011 -0800
    69.2 +++ b/src/share/classes/java/beans/beancontext/BeanContext.java	Mon Dec 19 10:06:23 2011 -0800
    69.3 @@ -53,6 +53,7 @@
    69.4   * @see java.util.Collection
    69.5   */
    69.6  
    69.7 +@SuppressWarnings("rawtypes")
    69.8  public interface BeanContext extends BeanContextChild, Collection, DesignMode, Visibility {
    69.9  
   69.10      /**
    70.1 --- a/src/share/classes/java/beans/beancontext/BeanContextMembershipEvent.java	Tue Dec 06 16:31:58 2011 -0800
    70.2 +++ b/src/share/classes/java/beans/beancontext/BeanContextMembershipEvent.java	Mon Dec 19 10:06:23 2011 -0800
    70.3 @@ -65,6 +65,7 @@
    70.4       * @throws NullPointerException if <CODE>changes</CODE> is <CODE>null</CODE>
    70.5       */
    70.6  
    70.7 +    @SuppressWarnings("rawtypes")
    70.8      public BeanContextMembershipEvent(BeanContext bc, Collection changes) {
    70.9          super(bc);
   70.10  
   70.11 @@ -117,6 +118,7 @@
   70.12       * Gets the array of children affected by this event.
   70.13       * @return the array of children effected
   70.14       */
   70.15 +    @SuppressWarnings("rawtypes")
   70.16      public Iterator iterator() { return children.iterator(); }
   70.17  
   70.18      /*
   70.19 @@ -127,5 +129,6 @@
   70.20      * The list of children affected by this
   70.21      * event notification.
   70.22      */
   70.23 +    @SuppressWarnings("rawtypes")
   70.24      protected Collection children;
   70.25  }
    71.1 --- a/src/share/classes/java/io/ExpiringCache.java	Tue Dec 06 16:31:58 2011 -0800
    71.2 +++ b/src/share/classes/java/io/ExpiringCache.java	Mon Dec 19 10:06:23 2011 -0800
    71.3 @@ -35,7 +35,7 @@
    71.4  
    71.5  class ExpiringCache {
    71.6      private long millisUntilExpiration;
    71.7 -    private Map  map;
    71.8 +    private Map<String,Entry> map;
    71.9      // Clear out old entries every few queries
   71.10      private int queryCount;
   71.11      private int queryOverflow = 300;
   71.12 @@ -61,10 +61,11 @@
   71.13          this(30000);
   71.14      }
   71.15  
   71.16 +    @SuppressWarnings("serial")
   71.17      ExpiringCache(long millisUntilExpiration) {
   71.18          this.millisUntilExpiration = millisUntilExpiration;
   71.19 -        map = new LinkedHashMap() {
   71.20 -            protected boolean removeEldestEntry(Map.Entry eldest) {
   71.21 +        map = new LinkedHashMap<String,Entry>() {
   71.22 +            protected boolean removeEldestEntry(Map.Entry<String,Entry> eldest) {
   71.23                return size() > MAX_ENTRIES;
   71.24              }
   71.25            };
   71.26 @@ -99,7 +100,7 @@
   71.27      }
   71.28  
   71.29      private Entry entryFor(String key) {
   71.30 -        Entry entry = (Entry) map.get(key);
   71.31 +        Entry entry = map.get(key);
   71.32          if (entry != null) {
   71.33              long delta = System.currentTimeMillis() - entry.timestamp();
   71.34              if (delta < 0 || delta >= millisUntilExpiration) {
   71.35 @@ -111,12 +112,11 @@
   71.36      }
   71.37  
   71.38      private void cleanup() {
   71.39 -        Set keySet = map.keySet();
   71.40 +        Set<String> keySet = map.keySet();
   71.41          // Avoid ConcurrentModificationExceptions
   71.42          String[] keys = new String[keySet.size()];
   71.43          int i = 0;
   71.44 -        for (Iterator iter = keySet.iterator(); iter.hasNext(); ) {
   71.45 -            String key = (String) iter.next();
   71.46 +        for (String key: keySet) {
   71.47              keys[i++] = key;
   71.48          }
   71.49          for (int j = 0; j < keys.length; j++) {
    72.1 --- a/src/share/classes/java/io/File.java	Tue Dec 06 16:31:58 2011 -0800
    72.2 +++ b/src/share/classes/java/io/File.java	Mon Dec 19 10:06:23 2011 -0800
    72.3 @@ -2006,7 +2006,7 @@
    72.4          throws IOException
    72.5      {
    72.6          s.defaultWriteObject();
    72.7 -        s.writeChar(this.separatorChar); // Add the separator character
    72.8 +        s.writeChar(separatorChar); // Add the separator character
    72.9      }
   72.10  
   72.11      /**
    73.1 --- a/src/share/classes/java/io/LineNumberInputStream.java	Tue Dec 06 16:31:58 2011 -0800
    73.2 +++ b/src/share/classes/java/io/LineNumberInputStream.java	Mon Dec 19 10:06:23 2011 -0800
    73.3 @@ -87,6 +87,7 @@
    73.4       * @see        java.io.FilterInputStream#in
    73.5       * @see        java.io.LineNumberInputStream#getLineNumber()
    73.6       */
    73.7 +    @SuppressWarnings("fallthrough")
    73.8      public int read() throws IOException {
    73.9          int c = pushBack;
   73.10  
    74.1 --- a/src/share/classes/java/io/LineNumberReader.java	Tue Dec 06 16:31:58 2011 -0800
    74.2 +++ b/src/share/classes/java/io/LineNumberReader.java	Mon Dec 19 10:06:23 2011 -0800
    74.3 @@ -120,6 +120,7 @@
    74.4       * @throws  IOException
    74.5       *          If an I/O error occurs
    74.6       */
    74.7 +    @SuppressWarnings("fallthrough")
    74.8      public int read() throws IOException {
    74.9          synchronized (lock) {
   74.10              int c = super.read();
   74.11 @@ -159,6 +160,7 @@
   74.12       * @throws  IOException
   74.13       *          If an I/O error occurs
   74.14       */
   74.15 +    @SuppressWarnings("fallthrough")
   74.16      public int read(char cbuf[], int off, int len) throws IOException {
   74.17          synchronized (lock) {
   74.18              int n = super.read(cbuf, off, len);
    75.1 --- a/src/share/classes/java/io/ObjectInputStream.java	Tue Dec 06 16:31:58 2011 -0800
    75.2 +++ b/src/share/classes/java/io/ObjectInputStream.java	Mon Dec 19 10:06:23 2011 -0800
    75.3 @@ -689,9 +689,9 @@
    75.4          boolean hasNonPublicInterface = false;
    75.5  
    75.6          // define proxy in class loader of non-public interface(s), if any
    75.7 -        Class[] classObjs = new Class[interfaces.length];
    75.8 +        Class<?>[] classObjs = new Class<?>[interfaces.length];
    75.9          for (int i = 0; i < interfaces.length; i++) {
   75.10 -            Class cl = Class.forName(interfaces[i], false, latestLoader);
   75.11 +            Class<?> cl = Class.forName(interfaces[i], false, latestLoader);
   75.12              if ((cl.getModifiers() & Modifier.PUBLIC) == 0) {
   75.13                  if (hasNonPublicInterface) {
   75.14                      if (nonPublicLoader != cl.getClassLoader()) {
   75.15 @@ -1229,7 +1229,7 @@
   75.16       * "enableSubclassImplementation" SerializablePermission is checked.
   75.17       */
   75.18      private void verifySubclass() {
   75.19 -        Class cl = getClass();
   75.20 +        Class<?> cl = getClass();
   75.21          if (cl == ObjectInputStream.class) {
   75.22              return;
   75.23          }
   75.24 @@ -1473,12 +1473,12 @@
   75.25       * ClassNotFoundException will be associated with the class' handle in the
   75.26       * handle table).
   75.27       */
   75.28 -    private Class readClass(boolean unshared) throws IOException {
   75.29 +    private Class<?> readClass(boolean unshared) throws IOException {
   75.30          if (bin.readByte() != TC_CLASS) {
   75.31              throw new InternalError();
   75.32          }
   75.33          ObjectStreamClass desc = readClassDesc(false);
   75.34 -        Class cl = desc.forClass();
   75.35 +        Class<?> cl = desc.forClass();
   75.36          passHandle = handles.assign(unshared ? unsharedMarker : cl);
   75.37  
   75.38          ClassNotFoundException resolveEx = desc.getResolveException();
   75.39 @@ -1542,7 +1542,7 @@
   75.40              ifaces[i] = bin.readUTF();
   75.41          }
   75.42  
   75.43 -        Class cl = null;
   75.44 +        Class<?> cl = null;
   75.45          ClassNotFoundException resolveEx = null;
   75.46          bin.setBlockDataMode(true);
   75.47          try {
   75.48 @@ -1586,7 +1586,7 @@
   75.49                  "failed to read class descriptor").initCause(ex);
   75.50          }
   75.51  
   75.52 -        Class cl = null;
   75.53 +        Class<?> cl = null;
   75.54          ClassNotFoundException resolveEx = null;
   75.55          bin.setBlockDataMode(true);
   75.56          try {
   75.57 @@ -1643,7 +1643,7 @@
   75.58          int len = bin.readInt();
   75.59  
   75.60          Object array = null;
   75.61 -        Class cl, ccl = null;
   75.62 +        Class<?> cl, ccl = null;
   75.63          if ((cl = desc.forClass()) != null) {
   75.64              ccl = cl.getComponentType();
   75.65              array = Array.newInstance(ccl, len);
   75.66 @@ -1696,7 +1696,7 @@
   75.67       * Reads in and returns enum constant, or null if enum type is
   75.68       * unresolvable.  Sets passHandle to enum constant's assigned handle.
   75.69       */
   75.70 -    private Enum readEnum(boolean unshared) throws IOException {
   75.71 +    private Enum<?> readEnum(boolean unshared) throws IOException {
   75.72          if (bin.readByte() != TC_ENUM) {
   75.73              throw new InternalError();
   75.74          }
   75.75 @@ -1713,24 +1713,26 @@
   75.76          }
   75.77  
   75.78          String name = readString(false);
   75.79 -        Enum en = null;
   75.80 -        Class cl = desc.forClass();
   75.81 +        Enum<?> result = null;
   75.82 +        Class<?> cl = desc.forClass();
   75.83          if (cl != null) {
   75.84              try {
   75.85 -                en = Enum.valueOf(cl, name);
   75.86 +                @SuppressWarnings("unchecked")
   75.87 +                Enum<?> en = Enum.valueOf((Class)cl, name);
   75.88 +                result = en;
   75.89              } catch (IllegalArgumentException ex) {
   75.90                  throw (IOException) new InvalidObjectException(
   75.91                      "enum constant " + name + " does not exist in " +
   75.92                      cl).initCause(ex);
   75.93              }
   75.94              if (!unshared) {
   75.95 -                handles.setObject(enumHandle, en);
   75.96 +                handles.setObject(enumHandle, result);
   75.97              }
   75.98          }
   75.99  
  75.100          handles.finish(enumHandle);
  75.101          passHandle = enumHandle;
  75.102 -        return en;
  75.103 +        return result;
  75.104      }
  75.105  
  75.106      /**
  75.107 @@ -1941,7 +1943,7 @@
  75.108          throws IOException
  75.109      {
  75.110          // REMIND: is isInstance check necessary?
  75.111 -        Class cl = desc.forClass();
  75.112 +        Class<?> cl = desc.forClass();
  75.113          if (cl != null && obj != null && !cl.isInstance(obj)) {
  75.114              throw new ClassCastException();
  75.115          }
  75.116 @@ -2140,7 +2142,7 @@
  75.117           * class descriptor, returns -1.  Throws IllegalArgumentException if
  75.118           * neither incoming nor local class descriptor contains a match.
  75.119           */
  75.120 -        private int getFieldOffset(String name, Class type) {
  75.121 +        private int getFieldOffset(String name, Class<?> type) {
  75.122              ObjectStreamField field = desc.getField(name, type);
  75.123              if (field != null) {
  75.124                  return field.getOffset();
  75.125 @@ -2838,6 +2840,7 @@
  75.126              return readUTFBody(readUnsignedShort());
  75.127          }
  75.128  
  75.129 +        @SuppressWarnings("deprecation")
  75.130          public String readLine() throws IOException {
  75.131              return din.readLine();      // deprecated, not worth optimizing
  75.132          }
    76.1 --- a/src/share/classes/java/io/ObjectOutputStream.java	Tue Dec 06 16:31:58 2011 -0800
    76.2 +++ b/src/share/classes/java/io/ObjectOutputStream.java	Mon Dec 19 10:06:23 2011 -0800
    76.3 @@ -1034,7 +1034,7 @@
    76.4       * "enableSubclassImplementation" SerializablePermission is checked.
    76.5       */
    76.6      private void verifySubclass() {
    76.7 -        Class cl = getClass();
    76.8 +        Class<?> cl = getClass();
    76.9          if (cl == ObjectOutputStream.class) {
   76.10              return;
   76.11          }
   76.12 @@ -1060,22 +1060,22 @@
   76.13       * override security-sensitive non-final methods.  Returns true if subclass
   76.14       * is "safe", false otherwise.
   76.15       */
   76.16 -    private static boolean auditSubclass(final Class subcl) {
   76.17 +    private static boolean auditSubclass(final Class<?> subcl) {
   76.18          Boolean result = AccessController.doPrivileged(
   76.19              new PrivilegedAction<Boolean>() {
   76.20                  public Boolean run() {
   76.21 -                    for (Class cl = subcl;
   76.22 +                    for (Class<?> cl = subcl;
   76.23                           cl != ObjectOutputStream.class;
   76.24                           cl = cl.getSuperclass())
   76.25                      {
   76.26                          try {
   76.27                              cl.getDeclaredMethod(
   76.28 -                                "writeUnshared", new Class[] { Object.class });
   76.29 +                                "writeUnshared", new Class<?>[] { Object.class });
   76.30                              return Boolean.FALSE;
   76.31                          } catch (NoSuchMethodException ex) {
   76.32                          }
   76.33                          try {
   76.34 -                            cl.getDeclaredMethod("putFields", (Class[]) null);
   76.35 +                            cl.getDeclaredMethod("putFields", (Class<?>[]) null);
   76.36                              return Boolean.FALSE;
   76.37                          } catch (NoSuchMethodException ex) {
   76.38                          }
   76.39 @@ -1122,11 +1122,11 @@
   76.40  
   76.41              // check for replacement object
   76.42              Object orig = obj;
   76.43 -            Class cl = obj.getClass();
   76.44 +            Class<?> cl = obj.getClass();
   76.45              ObjectStreamClass desc;
   76.46              for (;;) {
   76.47                  // REMIND: skip this check for strings/arrays?
   76.48 -                Class repCl;
   76.49 +                Class<?> repCl;
   76.50                  desc = ObjectStreamClass.lookup(cl, true);
   76.51                  if (!desc.hasWriteReplaceMethod() ||
   76.52                      (obj = desc.invokeWriteReplace(obj)) == null ||
   76.53 @@ -1169,7 +1169,7 @@
   76.54              } else if (cl.isArray()) {
   76.55                  writeArray(obj, desc, unshared);
   76.56              } else if (obj instanceof Enum) {
   76.57 -                writeEnum((Enum) obj, desc, unshared);
   76.58 +                writeEnum((Enum<?>) obj, desc, unshared);
   76.59              } else if (obj instanceof Serializable) {
   76.60                  writeOrdinaryObject(obj, desc, unshared);
   76.61              } else {
   76.62 @@ -1204,7 +1204,7 @@
   76.63      /**
   76.64       * Writes representation of given class to stream.
   76.65       */
   76.66 -    private void writeClass(Class cl, boolean unshared) throws IOException {
   76.67 +    private void writeClass(Class<?> cl, boolean unshared) throws IOException {
   76.68          bout.writeByte(TC_CLASS);
   76.69          writeClassDesc(ObjectStreamClass.lookup(cl, true), false);
   76.70          handles.assign(unshared ? null : cl);
   76.71 @@ -1237,7 +1237,7 @@
   76.72          bout.writeByte(TC_PROXYCLASSDESC);
   76.73          handles.assign(unshared ? null : desc);
   76.74  
   76.75 -        Class cl = desc.forClass();
   76.76 +        Class<?> cl = desc.forClass();
   76.77          Class[] ifaces = cl.getInterfaces();
   76.78          bout.writeInt(ifaces.length);
   76.79          for (int i = 0; i < ifaces.length; i++) {
   76.80 @@ -1269,7 +1269,7 @@
   76.81              writeClassDescriptor(desc);
   76.82          }
   76.83  
   76.84 -        Class cl = desc.forClass();
   76.85 +        Class<?> cl = desc.forClass();
   76.86          bout.setBlockDataMode(true);
   76.87          annotateClass(cl);
   76.88          bout.setBlockDataMode(false);
   76.89 @@ -1306,7 +1306,7 @@
   76.90          writeClassDesc(desc, false);
   76.91          handles.assign(unshared ? null : array);
   76.92  
   76.93 -        Class ccl = desc.forClass().getComponentType();
   76.94 +        Class<?> ccl = desc.forClass().getComponentType();
   76.95          if (ccl.isPrimitive()) {
   76.96              if (ccl == Integer.TYPE) {
   76.97                  int[] ia = (int[]) array;
   76.98 @@ -1377,7 +1377,7 @@
   76.99      /**
  76.100       * Writes given enum constant to stream.
  76.101       */
  76.102 -    private void writeEnum(Enum en,
  76.103 +    private void writeEnum(Enum<?> en,
  76.104                             ObjectStreamClass desc,
  76.105                             boolean unshared)
  76.106          throws IOException
  76.107 @@ -1700,7 +1700,7 @@
  76.108           * types, and any other non-null type matches assignable types only.
  76.109           * Throws IllegalArgumentException if no matching field found.
  76.110           */
  76.111 -        private int getFieldOffset(String name, Class type) {
  76.112 +        private int getFieldOffset(String name, Class<?> type) {
  76.113              ObjectStreamField field = desc.getField(name, type);
  76.114              if (field == null) {
  76.115                  throw new IllegalArgumentException("no such field " + name +
    77.1 --- a/src/share/classes/java/io/ObjectStreamClass.java	Tue Dec 06 16:31:58 2011 -0800
    77.2 +++ b/src/share/classes/java/io/ObjectStreamClass.java	Mon Dec 19 10:06:23 2011 -0800
    77.3 @@ -144,7 +144,7 @@
    77.4      private volatile ClassDataSlot[] dataLayout;
    77.5  
    77.6      /** serialization-appropriate constructor, or null if none */
    77.7 -    private Constructor cons;
    77.8 +    private Constructor<?> cons;
    77.9      /** class-defined writeObject method, or null if none */
   77.10      private Method writeObjectMethod;
   77.11      /** class-defined readObject method, or null if none */
   77.12 @@ -1308,9 +1308,9 @@
   77.13       * Access checks are disabled on the returned constructor (if any), since
   77.14       * the defining class may still be non-public.
   77.15       */
   77.16 -    private static Constructor getExternalizableConstructor(Class<?> cl) {
   77.17 +    private static Constructor<?> getExternalizableConstructor(Class<?> cl) {
   77.18          try {
   77.19 -            Constructor cons = cl.getDeclaredConstructor((Class<?>[]) null);
   77.20 +            Constructor<?> cons = cl.getDeclaredConstructor((Class<?>[]) null);
   77.21              cons.setAccessible(true);
   77.22              return ((cons.getModifiers() & Modifier.PUBLIC) != 0) ?
   77.23                  cons : null;
   77.24 @@ -1324,7 +1324,7 @@
   77.25       * superclass, or null if none found.  Access checks are disabled on the
   77.26       * returned constructor (if any).
   77.27       */
   77.28 -    private static Constructor getSerializableConstructor(Class<?> cl) {
   77.29 +    private static Constructor<?> getSerializableConstructor(Class<?> cl) {
   77.30          Class<?> initCl = cl;
   77.31          while (Serializable.class.isAssignableFrom(initCl)) {
   77.32              if ((initCl = initCl.getSuperclass()) == null) {
   77.33 @@ -1332,7 +1332,7 @@
   77.34              }
   77.35          }
   77.36          try {
   77.37 -            Constructor cons = initCl.getDeclaredConstructor((Class<?>[]) null);
   77.38 +            Constructor<?> cons = initCl.getDeclaredConstructor((Class<?>[]) null);
   77.39              int mods = cons.getModifiers();
   77.40              if ((mods & Modifier.PRIVATE) != 0 ||
   77.41                  ((mods & (Modifier.PUBLIC | Modifier.PROTECTED)) == 0 &&
   77.42 @@ -1802,7 +1802,7 @@
   77.43              signature = getClassSignature(field.getType());
   77.44          }
   77.45  
   77.46 -        public MemberSignature(Constructor cons) {
   77.47 +        public MemberSignature(Constructor<?> cons) {
   77.48              member = cons;
   77.49              name = cons.getName();
   77.50              signature = getMethodSignature(
    78.1 --- a/src/share/classes/java/io/RandomAccessFile.java	Tue Dec 06 16:31:58 2011 -0800
    78.2 +++ b/src/share/classes/java/io/RandomAccessFile.java	Mon Dec 19 10:06:23 2011 -0800
    78.3 @@ -1049,6 +1049,7 @@
    78.4       * @param      s   a string of bytes to be written.
    78.5       * @exception  IOException  if an I/O error occurs.
    78.6       */
    78.7 +    @SuppressWarnings("deprecation")
    78.8      public final void writeBytes(String s) throws IOException {
    78.9          int len = s.length();
   78.10          byte[] b = new byte[len];
    79.1 --- a/src/share/classes/java/io/SequenceInputStream.java	Tue Dec 06 16:31:58 2011 -0800
    79.2 +++ b/src/share/classes/java/io/SequenceInputStream.java	Mon Dec 19 10:06:23 2011 -0800
    79.3 @@ -44,7 +44,7 @@
    79.4   */
    79.5  public
    79.6  class SequenceInputStream extends InputStream {
    79.7 -    Enumeration e;
    79.8 +    Enumeration<? extends InputStream> e;
    79.9      InputStream in;
   79.10  
   79.11      /**
   79.12 @@ -85,7 +85,7 @@
   79.13       * @param   s2   the second input stream to read.
   79.14       */
   79.15      public SequenceInputStream(InputStream s1, InputStream s2) {
   79.16 -        Vector  v = new Vector(2);
   79.17 +        Vector<InputStream> v = new Vector<>(2);
   79.18  
   79.19          v.addElement(s1);
   79.20          v.addElement(s2);
    80.1 --- a/src/share/classes/java/lang/ClassLoader.java	Tue Dec 06 16:31:58 2011 -0800
    80.2 +++ b/src/share/classes/java/lang/ClassLoader.java	Mon Dec 19 10:06:23 2011 -0800
    80.3 @@ -258,7 +258,7 @@
    80.4      private final Set<ProtectionDomain> domains;
    80.5  
    80.6      // Invoked by the VM to record every loaded class with this loader.
    80.7 -    void addClass(Class c) {
    80.8 +    void addClass(Class<?> c) {
    80.9          classes.addElement(c);
   80.10      }
   80.11  
   80.12 @@ -402,7 +402,7 @@
   80.13      {
   80.14          synchronized (getClassLoadingLock(name)) {
   80.15              // First, check if the class has already been loaded
   80.16 -            Class c = findLoadedClass(name);
   80.17 +            Class<?> c = findLoadedClass(name);
   80.18              if (c == null) {
   80.19                  long t0 = System.nanoTime();
   80.20                  try {
   80.21 @@ -468,7 +468,7 @@
   80.22      }
   80.23  
   80.24      // This method is invoked by the virtual machine to load a class.
   80.25 -    private Class loadClassInternal(String name)
   80.26 +    private Class<?> loadClassInternal(String name)
   80.27          throws ClassNotFoundException
   80.28      {
   80.29          // For backward compatibility, explicitly lock on 'this' when
   80.30 @@ -483,7 +483,7 @@
   80.31      }
   80.32  
   80.33      // Invoked by the VM after loading class with this loader.
   80.34 -    private void checkPackageAccess(Class cls, ProtectionDomain pd) {
   80.35 +    private void checkPackageAccess(Class<?> cls, ProtectionDomain pd) {
   80.36          final SecurityManager sm = System.getSecurityManager();
   80.37          if (sm != null) {
   80.38              final String name = cls.getName();
   80.39 @@ -669,9 +669,9 @@
   80.40          return source;
   80.41      }
   80.42  
   80.43 -    private Class defineTransformedClass(String name, byte[] b, int off, int len,
   80.44 -                                         ProtectionDomain pd,
   80.45 -                                         ClassFormatError cfe, String source)
   80.46 +    private Class<?> defineTransformedClass(String name, byte[] b, int off, int len,
   80.47 +                                            ProtectionDomain pd,
   80.48 +                                            ClassFormatError cfe, String source)
   80.49        throws ClassFormatError
   80.50      {
   80.51          // Class format error - try to transform the bytecode and
   80.52 @@ -679,7 +679,7 @@
   80.53          //
   80.54          ClassFileTransformer[] transformers =
   80.55              ClassFileTransformer.getTransformers();
   80.56 -        Class c = null;
   80.57 +        Class<?> c = null;
   80.58  
   80.59          if (transformers != null) {
   80.60              for (ClassFileTransformer transformer : transformers) {
   80.61 @@ -704,7 +704,7 @@
   80.62          return c;
   80.63      }
   80.64  
   80.65 -    private void postDefineClass(Class c, ProtectionDomain pd)
   80.66 +    private void postDefineClass(Class<?> c, ProtectionDomain pd)
   80.67      {
   80.68          if (pd.getCodeSource() != null) {
   80.69              Certificate certs[] = pd.getCodeSource().getCertificates();
   80.70 @@ -784,7 +784,7 @@
   80.71      {
   80.72          protectionDomain = preDefineClass(name, protectionDomain);
   80.73  
   80.74 -        Class c = null;
   80.75 +        Class<?> c = null;
   80.76          String source = defineClassSourceLocation(protectionDomain);
   80.77  
   80.78          try {
   80.79 @@ -882,7 +882,7 @@
   80.80  
   80.81          protectionDomain = preDefineClass(name, protectionDomain);
   80.82  
   80.83 -        Class c = null;
   80.84 +        Class<?> c = null;
   80.85          String source = defineClassSourceLocation(protectionDomain);
   80.86  
   80.87          try {
   80.88 @@ -899,15 +899,15 @@
   80.89          return c;
   80.90      }
   80.91  
   80.92 -    private native Class defineClass0(String name, byte[] b, int off, int len,
   80.93 -                                      ProtectionDomain pd);
   80.94 +    private native Class<?> defineClass0(String name, byte[] b, int off, int len,
   80.95 +                                         ProtectionDomain pd);
   80.96  
   80.97 -    private native Class defineClass1(String name, byte[] b, int off, int len,
   80.98 -                                      ProtectionDomain pd, String source);
   80.99 +    private native Class<?> defineClass1(String name, byte[] b, int off, int len,
  80.100 +                                         ProtectionDomain pd, String source);
  80.101  
  80.102 -    private native Class defineClass2(String name, java.nio.ByteBuffer b,
  80.103 -                                      int off, int len, ProtectionDomain pd,
  80.104 -                                      String source);
  80.105 +    private native Class<?> defineClass2(String name, java.nio.ByteBuffer b,
  80.106 +                                         int off, int len, ProtectionDomain pd,
  80.107 +                                         String source);
  80.108  
  80.109      // true if the name is null or has the potential to be a valid binary name
  80.110      private boolean checkName(String name) {
  80.111 @@ -1010,7 +1010,7 @@
  80.112          resolveClass0(c);
  80.113      }
  80.114  
  80.115 -    private native void resolveClass0(Class c);
  80.116 +    private native void resolveClass0(Class<?> c);
  80.117  
  80.118      /**
  80.119       * Finds a class with the specified <a href="#name">binary name</a>,
  80.120 @@ -1041,7 +1041,7 @@
  80.121          if (system == null) {
  80.122              if (!checkName(name))
  80.123                  throw new ClassNotFoundException(name);
  80.124 -            Class cls = findBootstrapClass(name);
  80.125 +            Class<?> cls = findBootstrapClass(name);
  80.126              if (cls == null) {
  80.127                  throw new ClassNotFoundException(name);
  80.128              }
  80.129 @@ -1054,7 +1054,7 @@
  80.130       * Returns a class loaded by the bootstrap class loader;
  80.131       * or return null if not found.
  80.132       */
  80.133 -    private Class findBootstrapClassOrNull(String name)
  80.134 +    private Class<?> findBootstrapClassOrNull(String name)
  80.135      {
  80.136          if (!checkName(name)) return null;
  80.137  
  80.138 @@ -1062,7 +1062,7 @@
  80.139      }
  80.140  
  80.141      // return null if not found
  80.142 -    private native Class findBootstrapClass(String name);
  80.143 +    private native Class<?> findBootstrapClass(String name);
  80.144  
  80.145      /**
  80.146       * Returns the class with the given <a href="#name">binary name</a> if this
  80.147 @@ -1084,7 +1084,7 @@
  80.148          return findLoadedClass0(name);
  80.149      }
  80.150  
  80.151 -    private native final Class findLoadedClass0(String name);
  80.152 +    private native final Class<?> findLoadedClass0(String name);
  80.153  
  80.154      /**
  80.155       * Sets the signers of a class.  This should be invoked after defining a
  80.156 @@ -1528,7 +1528,7 @@
  80.157      // invocation and the desired invoker.
  80.158      static ClassLoader getCallerClassLoader() {
  80.159          // NOTE use of more generic Reflection.getCallerClass()
  80.160 -        Class caller = Reflection.getCallerClass(3);
  80.161 +        Class<?> caller = Reflection.getCallerClass(3);
  80.162          // This can be null if the VM is requesting it
  80.163          if (caller == null) {
  80.164              return null;
  80.165 @@ -1722,7 +1722,7 @@
  80.166          private int jniVersion;
  80.167          // the class from which the library is loaded, also indicates
  80.168          // the loader this native library belongs.
  80.169 -        private Class fromClass;
  80.170 +        private Class<?> fromClass;
  80.171          // the canonicalized name of the native library.
  80.172          String name;
  80.173  
  80.174 @@ -1730,7 +1730,7 @@
  80.175          native long find(String name);
  80.176          native void unload();
  80.177  
  80.178 -        public NativeLibrary(Class fromClass, String name) {
  80.179 +        public NativeLibrary(Class<?> fromClass, String name) {
  80.180              this.name = name;
  80.181              this.fromClass = fromClass;
  80.182          }
  80.183 @@ -1758,7 +1758,7 @@
  80.184          }
  80.185          // Invoked in the VM to determine the context class in
  80.186          // JNI_Load/JNI_Unload
  80.187 -        static Class getFromClass() {
  80.188 +        static Class<?> getFromClass() {
  80.189              return ClassLoader.nativeLibraryContext.peek().fromClass;
  80.190          }
  80.191      }
  80.192 @@ -1813,7 +1813,7 @@
  80.193      }
  80.194  
  80.195      // Invoked in the java.lang.Runtime class to implement load and loadLibrary.
  80.196 -    static void loadLibrary(Class fromClass, String name,
  80.197 +    static void loadLibrary(Class<?> fromClass, String name,
  80.198                              boolean isAbsolute) {
  80.199          ClassLoader loader =
  80.200              (fromClass == null) ? null : fromClass.getClassLoader();
  80.201 @@ -1860,7 +1860,7 @@
  80.202          throw new UnsatisfiedLinkError("no " + name + " in java.library.path");
  80.203      }
  80.204  
  80.205 -    private static boolean loadLibrary0(Class fromClass, final File file) {
  80.206 +    private static boolean loadLibrary0(Class<?> fromClass, final File file) {
  80.207          boolean exists = AccessController.doPrivileged(
  80.208              new PrivilegedAction<Object>() {
  80.209                  public Object run() {
  80.210 @@ -2194,8 +2194,8 @@
  80.211              return parent;
  80.212          }
  80.213  
  80.214 -        Constructor ctor = Class.forName(cls, true, parent)
  80.215 -            .getDeclaredConstructor(new Class[] { ClassLoader.class });
  80.216 +        Constructor<?> ctor = Class.forName(cls, true, parent)
  80.217 +            .getDeclaredConstructor(new Class<?>[] { ClassLoader.class });
  80.218          ClassLoader sys = (ClassLoader) ctor.newInstance(
  80.219              new Object[] { parent });
  80.220          Thread.currentThread().setContextClassLoader(sys);
    81.1 --- a/src/share/classes/java/lang/Enum.java	Tue Dec 06 16:31:58 2011 -0800
    81.2 +++ b/src/share/classes/java/lang/Enum.java	Mon Dec 19 10:06:23 2011 -0800
    81.3 @@ -173,8 +173,8 @@
    81.4       * method is the order in which the constants are declared.
    81.5       */
    81.6      public final int compareTo(E o) {
    81.7 -        Enum other = (Enum)o;
    81.8 -        Enum self = this;
    81.9 +        Enum<?> other = (Enum<?>)o;
   81.10 +        Enum<E> self = this;
   81.11          if (self.getClass() != other.getClass() && // optimization
   81.12              self.getDeclaringClass() != other.getDeclaringClass())
   81.13              throw new ClassCastException();
   81.14 @@ -193,10 +193,11 @@
   81.15       * @return the Class object corresponding to this enum constant's
   81.16       *     enum type
   81.17       */
   81.18 +    @SuppressWarnings("unchecked")
   81.19      public final Class<E> getDeclaringClass() {
   81.20 -        Class clazz = getClass();
   81.21 -        Class zuper = clazz.getSuperclass();
   81.22 -        return (zuper == Enum.class) ? clazz : zuper;
   81.23 +        Class<?> clazz = getClass();
   81.24 +        Class<?> zuper = clazz.getSuperclass();
   81.25 +        return (zuper == Enum.class) ? (Class<E>)clazz : (Class<E>)zuper;
   81.26      }
   81.27  
   81.28      /**
    82.1 --- a/src/share/classes/java/lang/Package.java	Tue Dec 06 16:31:58 2011 -0800
    82.2 +++ b/src/share/classes/java/lang/Package.java	Mon Dec 19 10:06:23 2011 -0800
    82.3 @@ -608,5 +608,5 @@
    82.4      private final String implVendor;
    82.5      private final URL sealBase;
    82.6      private transient final ClassLoader loader;
    82.7 -    private transient Class packageInfo;
    82.8 +    private transient Class<?> packageInfo;
    82.9  }
    83.1 --- a/src/share/classes/java/lang/Runtime.java	Tue Dec 06 16:31:58 2011 -0800
    83.2 +++ b/src/share/classes/java/lang/Runtime.java	Mon Dec 19 10:06:23 2011 -0800
    83.3 @@ -780,7 +780,7 @@
    83.4          load0(System.getCallerClass(), filename);
    83.5      }
    83.6  
    83.7 -    synchronized void load0(Class fromClass, String filename) {
    83.8 +    synchronized void load0(Class<?> fromClass, String filename) {
    83.9          SecurityManager security = System.getSecurityManager();
   83.10          if (security != null) {
   83.11              security.checkLink(filename);
   83.12 @@ -833,7 +833,7 @@
   83.13          loadLibrary0(System.getCallerClass(), libname);
   83.14      }
   83.15  
   83.16 -    synchronized void loadLibrary0(Class fromClass, String libname) {
   83.17 +    synchronized void loadLibrary0(Class<?> fromClass, String libname) {
   83.18          SecurityManager security = System.getSecurityManager();
   83.19          if (security != null) {
   83.20              security.checkLink(libname);
    84.1 --- a/src/share/classes/java/lang/SecurityManager.java	Tue Dec 06 16:31:58 2011 -0800
    84.2 +++ b/src/share/classes/java/lang/SecurityManager.java	Mon Dec 19 10:06:23 2011 -0800
    84.3 @@ -400,7 +400,7 @@
    84.4       */
    84.5      @Deprecated
    84.6      protected Class<?> currentLoadedClass() {
    84.7 -        Class c = currentLoadedClass0();
    84.8 +        Class<?> c = currentLoadedClass0();
    84.9          if ((c != null) && hasAllPermission())
   84.10              c = null;
   84.11          return c;
   84.12 @@ -1715,7 +1715,7 @@
   84.13          checkPermission(new SecurityPermission(target));
   84.14      }
   84.15  
   84.16 -    private native Class currentLoadedClass0();
   84.17 +    private native Class<?> currentLoadedClass0();
   84.18  
   84.19      /**
   84.20       * Returns the thread group into which to instantiate any new
    85.1 --- a/src/share/classes/java/lang/String.java	Tue Dec 06 16:31:58 2011 -0800
    85.2 +++ b/src/share/classes/java/lang/String.java	Mon Dec 19 10:06:23 2011 -0800
    85.3 @@ -1245,6 +1245,9 @@
    85.4              }
    85.5              return n1 - n2;
    85.6          }
    85.7 +
    85.8 +        /** Replaces the de-serialized object. */
    85.9 +        private Object readResolve() { return CASE_INSENSITIVE_ORDER; }
   85.10      }
   85.11  
   85.12      /**
    86.1 --- a/src/share/classes/java/lang/System.java	Tue Dec 06 16:31:58 2011 -0800
    86.2 +++ b/src/share/classes/java/lang/System.java	Mon Dec 19 10:06:23 2011 -0800
    86.3 @@ -1171,13 +1171,13 @@
    86.4      private static void setJavaLangAccess() {
    86.5          // Allow privileged classes outside of java.lang
    86.6          sun.misc.SharedSecrets.setJavaLangAccess(new sun.misc.JavaLangAccess(){
    86.7 -            public sun.reflect.ConstantPool getConstantPool(Class klass) {
    86.8 +            public sun.reflect.ConstantPool getConstantPool(Class<?> klass) {
    86.9                  return klass.getConstantPool();
   86.10              }
   86.11 -            public void setAnnotationType(Class klass, AnnotationType type) {
   86.12 +            public void setAnnotationType(Class<?> klass, AnnotationType type) {
   86.13                  klass.setAnnotationType(type);
   86.14              }
   86.15 -            public AnnotationType getAnnotationType(Class klass) {
   86.16 +            public AnnotationType getAnnotationType(Class<?> klass) {
   86.17                  return klass.getAnnotationType();
   86.18              }
   86.19              public <E extends Enum<E>>
    87.1 --- a/src/share/classes/java/lang/Thread.java	Tue Dec 06 16:31:58 2011 -0800
    87.2 +++ b/src/share/classes/java/lang/Thread.java	Mon Dec 19 10:06:23 2011 -0800
    87.3 @@ -1650,7 +1650,7 @@
    87.4       * security-sensitive non-final methods, or else the
    87.5       * "enableContextClassLoaderOverride" RuntimePermission is checked.
    87.6       */
    87.7 -    private static boolean isCCLOverridden(Class cl) {
    87.8 +    private static boolean isCCLOverridden(Class<?> cl) {
    87.9          if (cl == Thread.class)
   87.10              return false;
   87.11  
   87.12 @@ -1670,21 +1670,21 @@
   87.13       * override security-sensitive non-final methods.  Returns true if the
   87.14       * subclass overrides any of the methods, false otherwise.
   87.15       */
   87.16 -    private static boolean auditSubclass(final Class subcl) {
   87.17 +    private static boolean auditSubclass(final Class<?> subcl) {
   87.18          Boolean result = AccessController.doPrivileged(
   87.19              new PrivilegedAction<Boolean>() {
   87.20                  public Boolean run() {
   87.21 -                    for (Class cl = subcl;
   87.22 +                    for (Class<?> cl = subcl;
   87.23                           cl != Thread.class;
   87.24                           cl = cl.getSuperclass())
   87.25                      {
   87.26                          try {
   87.27 -                            cl.getDeclaredMethod("getContextClassLoader", new Class[0]);
   87.28 +                            cl.getDeclaredMethod("getContextClassLoader", new Class<?>[0]);
   87.29                              return Boolean.TRUE;
   87.30                          } catch (NoSuchMethodException ex) {
   87.31                          }
   87.32                          try {
   87.33 -                            Class[] params = {ClassLoader.class};
   87.34 +                            Class<?>[] params = {ClassLoader.class};
   87.35                              cl.getDeclaredMethod("setContextClassLoader", params);
   87.36                              return Boolean.TRUE;
   87.37                          } catch (NoSuchMethodException ex) {
    88.1 --- a/src/share/classes/java/lang/ThreadGroup.java	Tue Dec 06 16:31:58 2011 -0800
    88.2 +++ b/src/share/classes/java/lang/ThreadGroup.java	Mon Dec 19 10:06:23 2011 -0800
    88.3 @@ -670,6 +670,7 @@
    88.4       *     {@link Thread#suspend} for details.
    88.5       */
    88.6      @Deprecated
    88.7 +    @SuppressWarnings("deprecation")
    88.8      public final void suspend() {
    88.9          if (stopOrSuspend(true))
   88.10              Thread.currentThread().suspend();
   88.11 @@ -682,6 +683,7 @@
   88.12       * if (and only if) the current thread is found to be in this thread
   88.13       * group or one of its subgroups.
   88.14       */
   88.15 +    @SuppressWarnings("deprecation")
   88.16      private boolean stopOrSuspend(boolean suspend) {
   88.17          boolean suicide = false;
   88.18          Thread us = Thread.currentThread();
   88.19 @@ -731,6 +733,7 @@
   88.20       *       deadlock-prone.  See {@link Thread#suspend} for details.
   88.21       */
   88.22      @Deprecated
   88.23 +    @SuppressWarnings("deprecation")
   88.24      public final void resume() {
   88.25          int ngroupsSnapshot;
   88.26          ThreadGroup[] groupsSnapshot;
    89.1 --- a/src/share/classes/java/lang/instrument/ClassDefinition.java	Tue Dec 06 16:31:58 2011 -0800
    89.2 +++ b/src/share/classes/java/lang/instrument/ClassDefinition.java	Mon Dec 19 10:06:23 2011 -0800
    89.3 @@ -40,12 +40,12 @@
    89.4      /**
    89.5       *  The class to redefine
    89.6       */
    89.7 -    private final   Class   mClass;
    89.8 +    private final Class<?> mClass;
    89.9  
   89.10      /**
   89.11       *  The replacement class file bytes
   89.12       */
   89.13 -    private final   byte[]  mClassFile;
   89.14 +    private final byte[]   mClassFile;
   89.15  
   89.16      /**
   89.17       *  Creates a new <code>ClassDefinition</code> binding using the supplied
    90.1 --- a/src/share/classes/java/lang/management/ManagementFactory.java	Tue Dec 06 16:31:58 2011 -0800
    90.2 +++ b/src/share/classes/java/lang/management/ManagementFactory.java	Mon Dec 19 10:06:23 2011 -0800
    90.3 @@ -576,7 +576,7 @@
    90.4                                 Class<T> mxbeanInterface)
    90.5              throws java.io.IOException {
    90.6  
    90.7 -        final Class interfaceClass = mxbeanInterface;
    90.8 +        final Class<?> interfaceClass = mxbeanInterface;
    90.9          // Only allow MXBean interfaces from rt.jar loaded by the
   90.10          // bootstrap class loader
   90.11          final ClassLoader loader =
    91.1 --- a/src/share/classes/java/lang/management/PlatformComponent.java	Tue Dec 06 16:31:58 2011 -0800
    91.2 +++ b/src/share/classes/java/lang/management/PlatformComponent.java	Mon Dec 19 10:06:23 2011 -0800
    91.3 @@ -314,7 +314,7 @@
    91.4      private final String domain;
    91.5      private final String type;
    91.6      private final Set<String> keyProperties;
    91.7 -    private final MXBeanFetcher fetcher;
    91.8 +    private final MXBeanFetcher<?> fetcher;
    91.9      private final PlatformComponent[] subComponents;
   91.10      private final boolean singleton;
   91.11  
   91.12 @@ -322,7 +322,7 @@
   91.13                                String domain, String type,
   91.14                                Set<String> keyProperties,
   91.15                                boolean singleton,
   91.16 -                              MXBeanFetcher fetcher,
   91.17 +                              MXBeanFetcher<?> fetcher,
   91.18                                PlatformComponent... subComponents) {
   91.19          this.mxbeanInterfaceName = intfName;
   91.20          this.domain = domain;
   91.21 @@ -373,7 +373,7 @@
   91.22      <T extends PlatformManagedObject>
   91.23          List<T> getMXBeans(Class<T> mxbeanInterface)
   91.24      {
   91.25 -        return fetcher.getMXBeans();
   91.26 +        return (List<T>) fetcher.getMXBeans();
   91.27      }
   91.28  
   91.29      <T extends PlatformManagedObject> T getSingletonMXBean(Class<T> mxbeanInterface)
   91.30 @@ -382,7 +382,7 @@
   91.31              throw new IllegalArgumentException(mxbeanInterfaceName +
   91.32                  " can have zero or more than one instances");
   91.33  
   91.34 -        List<T> list = fetcher.getMXBeans();
   91.35 +        List<T> list = getMXBeans(mxbeanInterface);
   91.36          assert list.size() == 1;
   91.37          return list.isEmpty() ? null : list.get(0);
   91.38      }
    92.1 --- a/src/share/classes/java/net/HttpCookie.java	Tue Dec 06 16:31:58 2011 -0800
    92.2 +++ b/src/share/classes/java/net/HttpCookie.java	Mon Dec 19 10:06:23 2011 -0800
    92.3 @@ -31,17 +31,15 @@
    92.4  import java.text.SimpleDateFormat;
    92.5  import java.util.TimeZone;
    92.6  import java.util.Date;
    92.7 -
    92.8 -import java.lang.NullPointerException;  // for javadoc
    92.9  import java.util.Locale;
   92.10  import java.util.Objects;
   92.11  
   92.12  /**
   92.13 - * An HttpCookie object represents an http cookie, which carries state
   92.14 + * An HttpCookie object represents an HTTP cookie, which carries state
   92.15   * information between server and user agent. Cookie is widely adopted
   92.16   * to create stateful sessions.
   92.17   *
   92.18 - * <p>There are 3 http cookie specifications:
   92.19 + * <p> There are 3 HTTP cookie specifications:
   92.20   * <blockquote>
   92.21   *   Netscape draft<br>
   92.22   *   RFC 2109 - <a href="http://www.ietf.org/rfc/rfc2109.txt">
   92.23 @@ -50,25 +48,19 @@
   92.24   * <i>http://www.ietf.org/rfc/rfc2965.txt</i></a>
   92.25   * </blockquote>
   92.26   *
   92.27 - * <p>HttpCookie class can accept all these 3 forms of syntax.
   92.28 + * <p> HttpCookie class can accept all these 3 forms of syntax.
   92.29   *
   92.30   * @author Edward Wang
   92.31   * @since 1.6
   92.32   */
   92.33  public final class HttpCookie implements Cloneable {
   92.34 -    /* ---------------- Fields -------------- */
   92.35 +    // ---------------- Fields --------------
   92.36  
   92.37 -    //
   92.38      // The value of the cookie itself.
   92.39 -    //
   92.40 -
   92.41 -    private String name;        // NAME= ... "$Name" style is reserved
   92.42 +    private final String name;  // NAME= ... "$Name" style is reserved
   92.43      private String value;       // value of NAME
   92.44  
   92.45 -    //
   92.46      // Attributes encoded in the header's cookie fields.
   92.47 -    //
   92.48 -
   92.49      private String comment;     // Comment=VALUE ... describes cookie's use
   92.50      private String commentURL;  // CommentURL="http URL" ... describes cookie's use
   92.51      private boolean toDiscard;  // Discard ... discard cookie unconditionally
   92.52 @@ -80,70 +72,61 @@
   92.53      private boolean httpOnly;   // HttpOnly ... i.e. not accessible to scripts
   92.54      private int version = 1;    // Version=1 ... RFC 2965 style
   92.55  
   92.56 -    //
   92.57      // Hold the creation time (in seconds) of the http cookie for later
   92.58      // expiration calculation
   92.59 -    //
   92.60 -    private long whenCreated = 0;
   92.61 +    private final long whenCreated;
   92.62  
   92.63 -
   92.64 -    //
   92.65      // Since the positive and zero max-age have their meanings,
   92.66      // this value serves as a hint as 'not specify max-age'
   92.67 -    //
   92.68      private final static long MAX_AGE_UNSPECIFIED = -1;
   92.69  
   92.70 -
   92.71 -    //
   92.72      // date formats used by Netscape's cookie draft
   92.73      // as well as formats seen on various sites
   92.74 -    //
   92.75      private final static String[] COOKIE_DATE_FORMATS = {
   92.76          "EEE',' dd-MMM-yyyy HH:mm:ss 'GMT'",
   92.77          "EEE',' dd MMM yyyy HH:mm:ss 'GMT'",
   92.78          "EEE MMM dd yyyy HH:mm:ss 'GMT'Z"
   92.79      };
   92.80  
   92.81 -    //
   92.82      // constant strings represent set-cookie header token
   92.83 -    //
   92.84      private final static String SET_COOKIE = "set-cookie:";
   92.85      private final static String SET_COOKIE2 = "set-cookie2:";
   92.86  
   92.87 -
   92.88 -    /* ---------------- Ctors -------------- */
   92.89 +    // ---------------- Ctors --------------
   92.90  
   92.91      /**
   92.92       * Constructs a cookie with a specified name and value.
   92.93       *
   92.94 -     * <p>The name must conform to RFC 2965. That means it can contain
   92.95 +     * <p> The name must conform to RFC 2965. That means it can contain
   92.96       * only ASCII alphanumeric characters and cannot contain commas,
   92.97       * semicolons, or white space or begin with a $ character. The cookie's
   92.98       * name cannot be changed after creation.
   92.99       *
  92.100 -     * <p>The value can be anything the server chooses to send. Its
  92.101 +     * <p> The value can be anything the server chooses to send. Its
  92.102       * value is probably of interest only to the server. The cookie's
  92.103       * value can be changed after creation with the
  92.104 -     * <code>setValue</code> method.
  92.105 +     * {@code setValue} method.
  92.106       *
  92.107 -     * <p>By default, cookies are created according to the RFC 2965
  92.108 +     * <p> By default, cookies are created according to the RFC 2965
  92.109       * cookie specification. The version can be changed with the
  92.110 -     * <code>setVersion</code> method.
  92.111 +     * {@code setVersion} method.
  92.112       *
  92.113       *
  92.114 -     * @param name                      a <code>String</code> specifying the name of the cookie
  92.115 +     * @param  name
  92.116 +     *         a {@code String} specifying the name of the cookie
  92.117       *
  92.118 -     * @param value                     a <code>String</code> specifying the value of the cookie
  92.119 +     * @param  value
  92.120 +     *         a {@code String} specifying the value of the cookie
  92.121       *
  92.122 -     * @throws IllegalArgumentException if the cookie name contains illegal characters
  92.123 -     *                                  or it is one of the tokens reserved for use
  92.124 -     *                                  by the cookie protocol
  92.125 -     * @throws NullPointerException     if <tt>name</tt> is <tt>null</tt>
  92.126 +     * @throws  IllegalArgumentException
  92.127 +     *          if the cookie name contains illegal characters or it is one of
  92.128 +     *          the tokens reserved for use by the cookie protocol
  92.129 +     * @throws  NullPointerException
  92.130 +     *          if {@code name} is {@code null}
  92.131 +     *
  92.132       * @see #setValue
  92.133       * @see #setVersion
  92.134 -     *
  92.135       */
  92.136 -
  92.137      public HttpCookie(String name, String value) {
  92.138          name = name.trim();
  92.139          if (name.length() == 0 || !isToken(name) || isReserved(name)) {
  92.140 @@ -159,23 +142,25 @@
  92.141          portlist = null;
  92.142      }
  92.143  
  92.144 -
  92.145      /**
  92.146       * Constructs cookies from set-cookie or set-cookie2 header string.
  92.147       * RFC 2965 section 3.2.2 set-cookie2 syntax indicates that one header line
  92.148       * may contain more than one cookie definitions, so this is a static
  92.149       * utility method instead of another constructor.
  92.150       *
  92.151 -     * @param header    a <tt>String</tt> specifying the set-cookie header.
  92.152 -     *                  The header should start with "set-cookie", or "set-cookie2"
  92.153 -     *                  token; or it should have no leading token at all.
  92.154 -     * @return          a List of cookie parsed from header line string
  92.155 -     * @throws IllegalArgumentException if header string violates the cookie
  92.156 -     *                                  specification's syntax, or the cookie
  92.157 -     *                                  name contains llegal characters, or
  92.158 -     *                                  the cookie name is one of the tokens
  92.159 -     *                                  reserved for use by the cookie protocol
  92.160 -     * @throws NullPointerException     if the header string is <tt>null</tt>
  92.161 +     * @param  header
  92.162 +     *         a {@code String} specifying the set-cookie header. The header
  92.163 +     *         should start with "set-cookie", or "set-cookie2" token; or it
  92.164 +     *         should have no leading token at all.
  92.165 +     *
  92.166 +     * @return  a List of cookie parsed from header line string
  92.167 +     *
  92.168 +     * @throws  IllegalArgumentException
  92.169 +     *          if header string violates the cookie specification's syntax, or
  92.170 +     *          the cookie name contains illegal characters, or the cookie name
  92.171 +     *          is one of the tokens reserved for use by the cookie protocol
  92.172 +     * @throws  NullPointerException
  92.173 +     *          if the header string is {@code null}
  92.174       */
  92.175      public static List<HttpCookie> parse(String header) {
  92.176          int version = guessCookieVersion(header);
  92.177 @@ -187,10 +172,9 @@
  92.178              header = header.substring(SET_COOKIE.length());
  92.179          }
  92.180  
  92.181 -
  92.182 -        List<HttpCookie> cookies = new java.util.ArrayList<HttpCookie>();
  92.183 -        // The Netscape cookie may have a comma in its expires attribute,
  92.184 -        // while the comma is the delimiter in rfc 2965/2109 cookie header string.
  92.185 +        List<HttpCookie> cookies = new java.util.ArrayList<>();
  92.186 +        // The Netscape cookie may have a comma in its expires attribute, while
  92.187 +        // the comma is the delimiter in rfc 2965/2109 cookie header string.
  92.188          // so the parse logic is slightly different
  92.189          if (version == 0) {
  92.190              // Netscape draft cookie
  92.191 @@ -212,17 +196,13 @@
  92.192          return cookies;
  92.193      }
  92.194  
  92.195 -
  92.196 -
  92.197 -
  92.198 -    /* ---------------- Public operations -------------- */
  92.199 -
  92.200 +    // ---------------- Public operations --------------
  92.201  
  92.202      /**
  92.203 -     * Reports whether this http cookie has expired or not.
  92.204 +     * Reports whether this HTTP cookie has expired or not.
  92.205       *
  92.206 -     * @return  <tt>true</tt> to indicate this http cookie has expired;
  92.207 -     *          otherwise, <tt>false</tt>
  92.208 +     * @return  {@code true} to indicate this HTTP cookie has expired;
  92.209 +     *          otherwise, {@code false}
  92.210       */
  92.211      public boolean hasExpired() {
  92.212          if (maxAge == 0) return true;
  92.213 @@ -240,155 +220,123 @@
  92.214      }
  92.215  
  92.216      /**
  92.217 -     *
  92.218       * Specifies a comment that describes a cookie's purpose.
  92.219       * The comment is useful if the browser presents the cookie
  92.220 -     * to the user. Comments
  92.221 -     * are not supported by Netscape Version 0 cookies.
  92.222 +     * to the user. Comments are not supported by Netscape Version 0 cookies.
  92.223       *
  92.224 -     * @param purpose           a <code>String</code> specifying the comment
  92.225 -     *                          to display to the user
  92.226 +     * @param  purpose
  92.227 +     *         a {@code String} specifying the comment to display to the user
  92.228       *
  92.229 -     * @see #getComment
  92.230 -     *
  92.231 +     * @see  #getComment
  92.232       */
  92.233 -
  92.234      public void setComment(String purpose) {
  92.235          comment = purpose;
  92.236      }
  92.237  
  92.238 -
  92.239 -
  92.240 -
  92.241      /**
  92.242       * Returns the comment describing the purpose of this cookie, or
  92.243 -     * <code>null</code> if the cookie has no comment.
  92.244 +     * {@code null} if the cookie has no comment.
  92.245       *
  92.246 -     * @return                  a <code>String</code> containing the comment,
  92.247 -     *                          or <code>null</code> if none
  92.248 +     * @return  a {@code String} containing the comment, or {@code null} if none
  92.249       *
  92.250 -     * @see #setComment
  92.251 -     *
  92.252 +     * @see  #setComment
  92.253       */
  92.254 -
  92.255      public String getComment() {
  92.256          return comment;
  92.257      }
  92.258  
  92.259 -
  92.260      /**
  92.261 +     * Specifies a comment URL that describes a cookie's purpose.
  92.262 +     * The comment URL is useful if the browser presents the cookie
  92.263 +     * to the user. Comment URL is RFC 2965 only.
  92.264       *
  92.265 -     * Specifies a comment url that describes a cookie's purpose.
  92.266 -     * The comment url is useful if the browser presents the cookie
  92.267 -     * to the user. Comment url is RFC 2965 only.
  92.268 +     * @param  purpose
  92.269 +     *         a {@code String} specifying the comment URL to display to the user
  92.270       *
  92.271 -     * @param purpose           a <code>String</code> specifying the comment url
  92.272 -     *                          to display to the user
  92.273 -     *
  92.274 -     * @see #getCommentURL
  92.275 -     *
  92.276 +     * @see  #getCommentURL
  92.277       */
  92.278 -
  92.279      public void setCommentURL(String purpose) {
  92.280          commentURL = purpose;
  92.281      }
  92.282  
  92.283 -
  92.284 -
  92.285 -
  92.286      /**
  92.287 -     * Returns the comment url describing the purpose of this cookie, or
  92.288 -     * <code>null</code> if the cookie has no comment url.
  92.289 +     * Returns the comment URL describing the purpose of this cookie, or
  92.290 +     * {@code null} if the cookie has no comment URL.
  92.291       *
  92.292 -     * @return                  a <code>String</code> containing the comment url,
  92.293 -     *                          or <code>null</code> if none
  92.294 +     * @return  a {@code String} containing the comment URL, or {@code null}
  92.295 +     *          if none
  92.296       *
  92.297 -     * @see #setCommentURL
  92.298 -     *
  92.299 +     * @see  #setCommentURL
  92.300       */
  92.301 -
  92.302      public String getCommentURL() {
  92.303          return commentURL;
  92.304      }
  92.305  
  92.306 -
  92.307      /**
  92.308       * Specify whether user agent should discard the cookie unconditionally.
  92.309       * This is RFC 2965 only attribute.
  92.310       *
  92.311 -     * @param discard   <tt>true</tt> indicates to discard cookie unconditionally
  92.312 +     * @param  discard
  92.313 +     *         {@code true} indicates to discard cookie unconditionally
  92.314       *
  92.315 -     * @see #getDiscard
  92.316 +     * @see  #getDiscard
  92.317       */
  92.318 -
  92.319      public void setDiscard(boolean discard) {
  92.320          toDiscard = discard;
  92.321      }
  92.322  
  92.323 -
  92.324 -
  92.325 -
  92.326      /**
  92.327 -     * Return the discard attribute of the cookie
  92.328 +     * Returns the discard attribute of the cookie
  92.329       *
  92.330 -     * @return  a <tt>boolean</tt> to represent this cookie's discard attribute
  92.331 +     * @return  a {@code boolean} to represent this cookie's discard attribute
  92.332       *
  92.333 -     * @see #setDiscard
  92.334 +     * @see  #setDiscard
  92.335       */
  92.336 -
  92.337      public boolean getDiscard() {
  92.338          return toDiscard;
  92.339      }
  92.340  
  92.341 -
  92.342      /**
  92.343       * Specify the portlist of the cookie, which restricts the port(s)
  92.344       * to which a cookie may be sent back in a Cookie header.
  92.345       *
  92.346 -     * @param ports     a <tt>String</tt> specify the port list, which is
  92.347 -     *                  comma seperated series of digits
  92.348 -     * @see #getPortlist
  92.349 +     * @param  ports
  92.350 +     *         a {@code String} specify the port list, which is comma separated
  92.351 +     *         series of digits
  92.352 +     *
  92.353 +     * @see  #getPortlist
  92.354       */
  92.355 -
  92.356      public void setPortlist(String ports) {
  92.357          portlist = ports;
  92.358      }
  92.359  
  92.360 -
  92.361 -
  92.362 -
  92.363      /**
  92.364 -     * Return the port list attribute of the cookie
  92.365 +     * Returns the port list attribute of the cookie
  92.366       *
  92.367 -     * @return  a <tt>String</tt> contains the port list
  92.368 -     *          or <tt>null</tt> if none
  92.369 -     * @see #setPortlist
  92.370 +     * @return  a {@code String} contains the port list or {@code null} if none
  92.371 +     *
  92.372 +     * @see  #setPortlist
  92.373       */
  92.374 -
  92.375      public String getPortlist() {
  92.376          return portlist;
  92.377      }
  92.378  
  92.379      /**
  92.380 -     *
  92.381       * Specifies the domain within which this cookie should be presented.
  92.382       *
  92.383 -     * <p>The form of the domain name is specified by RFC 2965. A domain
  92.384 -     * name begins with a dot (<code>.foo.com</code>) and means that
  92.385 +     * <p> The form of the domain name is specified by RFC 2965. A domain
  92.386 +     * name begins with a dot ({@code .foo.com}) and means that
  92.387       * the cookie is visible to servers in a specified Domain Name System
  92.388 -     * (DNS) zone (for example, <code>www.foo.com</code>, but not
  92.389 -     * <code>a.b.foo.com</code>). By default, cookies are only returned
  92.390 +     * (DNS) zone (for example, {@code www.foo.com}, but not
  92.391 +     * {@code a.b.foo.com}). By default, cookies are only returned
  92.392       * to the server that sent them.
  92.393       *
  92.394 +     * @param  pattern
  92.395 +     *         a {@code String} containing the domain name within which this
  92.396 +     *         cookie is visible; form is according to RFC 2965
  92.397       *
  92.398 -     * @param pattern           a <code>String</code> containing the domain name
  92.399 -     *                          within which this cookie is visible;
  92.400 -     *                          form is according to RFC 2965
  92.401 -     *
  92.402 -     * @see #getDomain
  92.403 -     *
  92.404 +     * @see  #getDomain
  92.405       */
  92.406 -
  92.407      public void setDomain(String pattern) {
  92.408          if (pattern != null)
  92.409              domain = pattern.toLowerCase();
  92.410 @@ -396,261 +344,187 @@
  92.411              domain = pattern;
  92.412      }
  92.413  
  92.414 -
  92.415 -
  92.416 -
  92.417 -
  92.418      /**
  92.419 -     * Returns the domain name set for this cookie. The form of
  92.420 -     * the domain name is set by RFC 2965.
  92.421 +     * Returns the domain name set for this cookie. The form of the domain name
  92.422 +     * is set by RFC 2965.
  92.423       *
  92.424 -     * @return                  a <code>String</code> containing the domain name
  92.425 +     * @return  a {@code String} containing the domain name
  92.426       *
  92.427 -     * @see #setDomain
  92.428 -     *
  92.429 +     * @see  #setDomain
  92.430       */
  92.431 -
  92.432      public String getDomain() {
  92.433          return domain;
  92.434      }
  92.435  
  92.436 -
  92.437      /**
  92.438       * Sets the maximum age of the cookie in seconds.
  92.439       *
  92.440 -     * <p>A positive value indicates that the cookie will expire
  92.441 +     * <p> A positive value indicates that the cookie will expire
  92.442       * after that many seconds have passed. Note that the value is
  92.443       * the <i>maximum</i> age when the cookie will expire, not the cookie's
  92.444       * current age.
  92.445       *
  92.446 -     * <p>A negative value means
  92.447 -     * that the cookie is not stored persistently and will be deleted
  92.448 -     * when the Web browser exits. A zero value causes the cookie
  92.449 -     * to be deleted.
  92.450 +     * <p> A negative value means that the cookie is not stored persistently
  92.451 +     * and will be deleted when the Web browser exits. A zero value causes the
  92.452 +     * cookie to be deleted.
  92.453       *
  92.454 -     * @param expiry            an integer specifying the maximum age of the
  92.455 -     *                          cookie in seconds; if zero, the cookie
  92.456 -     *                          should be discarded immediately;
  92.457 -     *                          otherwise, the cookie's max age is unspecified.
  92.458 +     * @param  expiry
  92.459 +     *         an integer specifying the maximum age of the cookie in seconds;
  92.460 +     *         if zero, the cookie should be discarded immediately; otherwise,
  92.461 +     *         the cookie's max age is unspecified.
  92.462       *
  92.463 -     * @see #getMaxAge
  92.464 -     *
  92.465 +     * @see  #getMaxAge
  92.466       */
  92.467      public void setMaxAge(long expiry) {
  92.468          maxAge = expiry;
  92.469      }
  92.470  
  92.471 -
  92.472 -
  92.473 -
  92.474      /**
  92.475 -     * Returns the maximum age of the cookie, specified in seconds.
  92.476 -     * By default, <code>-1</code> indicating the cookie will persist
  92.477 -     * until browser shutdown.
  92.478 +     * Returns the maximum age of the cookie, specified in seconds. By default,
  92.479 +     * {@code -1} indicating the cookie will persist until browser shutdown.
  92.480       *
  92.481 +     * @return  an integer specifying the maximum age of the cookie in seconds
  92.482       *
  92.483 -     * @return                  an integer specifying the maximum age of the
  92.484 -     *                          cookie in seconds
  92.485 -     *
  92.486 -     *
  92.487 -     * @see #setMaxAge
  92.488 -     *
  92.489 +     * @see  #setMaxAge
  92.490       */
  92.491 -
  92.492      public long getMaxAge() {
  92.493          return maxAge;
  92.494      }
  92.495  
  92.496 -
  92.497 -
  92.498 -
  92.499      /**
  92.500 -     * Specifies a path for the cookie
  92.501 -     * to which the client should return the cookie.
  92.502 +     * Specifies a path for the cookie to which the client should return
  92.503 +     * the cookie.
  92.504       *
  92.505 -     * <p>The cookie is visible to all the pages in the directory
  92.506 +     * <p> The cookie is visible to all the pages in the directory
  92.507       * you specify, and all the pages in that directory's subdirectories.
  92.508       * A cookie's path must include the servlet that set the cookie,
  92.509       * for example, <i>/catalog</i>, which makes the cookie
  92.510       * visible to all directories on the server under <i>/catalog</i>.
  92.511       *
  92.512 -     * <p>Consult RFC 2965 (available on the Internet) for more
  92.513 +     * <p> Consult RFC 2965 (available on the Internet) for more
  92.514       * information on setting path names for cookies.
  92.515       *
  92.516 +     * @param  uri
  92.517 +     *         a {@code String} specifying a path
  92.518       *
  92.519 -     * @param uri               a <code>String</code> specifying a path
  92.520 -     *
  92.521 -     *
  92.522 -     * @see #getPath
  92.523 -     *
  92.524 +     * @see  #getPath
  92.525       */
  92.526 -
  92.527      public void setPath(String uri) {
  92.528          path = uri;
  92.529      }
  92.530  
  92.531 -
  92.532 -
  92.533 -
  92.534      /**
  92.535 -     * Returns the path on the server
  92.536 -     * to which the browser returns this cookie. The
  92.537 -     * cookie is visible to all subpaths on the server.
  92.538 +     * Returns the path on the server to which the browser returns this cookie.
  92.539 +     * The cookie is visible to all subpaths on the server.
  92.540       *
  92.541 +     * @return  a {@code String} specifying a path that contains a servlet name,
  92.542 +     *          for example, <i>/catalog</i>
  92.543       *
  92.544 -     * @return          a <code>String</code> specifying a path that contains
  92.545 -     *                  a servlet name, for example, <i>/catalog</i>
  92.546 -     *
  92.547 -     * @see #setPath
  92.548 -     *
  92.549 +     * @see  #setPath
  92.550       */
  92.551 -
  92.552      public String getPath() {
  92.553          return path;
  92.554      }
  92.555  
  92.556 -
  92.557 -
  92.558 -
  92.559 -
  92.560      /**
  92.561       * Indicates whether the cookie should only be sent using a secure protocol,
  92.562       * such as HTTPS or SSL.
  92.563       *
  92.564 -     * <p>The default value is <code>false</code>.
  92.565 +     * <p> The default value is {@code false}.
  92.566       *
  92.567 -     * @param flag      If <code>true</code>, the cookie can only be sent over
  92.568 -     *                  a secure protocol like https.
  92.569 -     *                  If <code>false</code>, it can be sent over any protocol.
  92.570 +     * @param  flag
  92.571 +     *         If {@code true}, the cookie can only be sent over a secure
  92.572 +     *         protocol like HTTPS. If {@code false}, it can be sent over
  92.573 +     *         any protocol.
  92.574       *
  92.575 -     * @see #getSecure
  92.576 -     *
  92.577 +     * @see  #getSecure
  92.578       */
  92.579 -
  92.580      public void setSecure(boolean flag) {
  92.581          secure = flag;
  92.582      }
  92.583  
  92.584 -
  92.585 -
  92.586 -
  92.587      /**
  92.588 -     * Returns <code>true</code> if sending this cookie should be
  92.589 -     * restricted to a secure protocol, or <code>false</code> if the
  92.590 -     * it can be sent using any protocol.
  92.591 +     * Returns {@code true} if sending this cookie should be restricted to a
  92.592 +     * secure protocol, or {@code false} if the it can be sent using any
  92.593 +     * protocol.
  92.594       *
  92.595 -     * @return          <code>false</code> if the cookie can be sent over
  92.596 -     *                  any standard protocol; otherwise, <code>true</code>
  92.597 +     * @return  {@code false} if the cookie can be sent over any standard
  92.598 +     *          protocol; otherwise, <code>true</code>
  92.599       *
  92.600 -     * @see #setSecure
  92.601 -     *
  92.602 +     * @see  #setSecure
  92.603       */
  92.604 -
  92.605      public boolean getSecure() {
  92.606          return secure;
  92.607      }
  92.608  
  92.609 -
  92.610 -
  92.611 -
  92.612 -
  92.613      /**
  92.614       * Returns the name of the cookie. The name cannot be changed after
  92.615       * creation.
  92.616       *
  92.617 -     * @return          a <code>String</code> specifying the cookie's name
  92.618 -     *
  92.619 +     * @return  a {@code String} specifying the cookie's name
  92.620       */
  92.621 -
  92.622      public String getName() {
  92.623          return name;
  92.624      }
  92.625  
  92.626 -
  92.627 -
  92.628 -
  92.629 -
  92.630      /**
  92.631 -     *
  92.632       * Assigns a new value to a cookie after the cookie is created.
  92.633       * If you use a binary value, you may want to use BASE64 encoding.
  92.634       *
  92.635 -     * <p>With Version 0 cookies, values should not contain white
  92.636 -     * space, brackets, parentheses, equals signs, commas,
  92.637 -     * double quotes, slashes, question marks, at signs, colons,
  92.638 -     * and semicolons. Empty values may not behave the same way
  92.639 -     * on all browsers.
  92.640 +     * <p> With Version 0 cookies, values should not contain white space,
  92.641 +     * brackets, parentheses, equals signs, commas, double quotes, slashes,
  92.642 +     * question marks, at signs, colons, and semicolons. Empty values may not
  92.643 +     * behave the same way on all browsers.
  92.644       *
  92.645 -     * @param newValue          a <code>String</code> specifying the new value
  92.646 +     * @param  newValue
  92.647 +     *         a {@code String} specifying the new value
  92.648       *
  92.649 -     *
  92.650 -     * @see #getValue
  92.651 -     *
  92.652 +     * @see  #getValue
  92.653       */
  92.654 -
  92.655      public void setValue(String newValue) {
  92.656          value = newValue;
  92.657      }
  92.658  
  92.659 -
  92.660 -
  92.661 -
  92.662      /**
  92.663       * Returns the value of the cookie.
  92.664       *
  92.665 -     * @return                  a <code>String</code> containing the cookie's
  92.666 -     *                          present value
  92.667 +     * @return  a {@code String} containing the cookie's present value
  92.668       *
  92.669 -     * @see #setValue
  92.670 -     *
  92.671 +     * @see  #setValue
  92.672       */
  92.673 -
  92.674      public String getValue() {
  92.675          return value;
  92.676      }
  92.677  
  92.678 -
  92.679 -
  92.680 -
  92.681      /**
  92.682 -     * Returns the version of the protocol this cookie complies
  92.683 -     * with. Version 1 complies with RFC 2965/2109,
  92.684 -     * and version 0 complies with the original
  92.685 -     * cookie specification drafted by Netscape. Cookies provided
  92.686 -     * by a browser use and identify the browser's cookie version.
  92.687 +     * Returns the version of the protocol this cookie complies with. Version 1
  92.688 +     * complies with RFC 2965/2109, and version 0 complies with the original
  92.689 +     * cookie specification drafted by Netscape. Cookies provided by a browser
  92.690 +     * use and identify the browser's cookie version.
  92.691       *
  92.692 +     * @return  0 if the cookie complies with the original Netscape
  92.693 +     *          specification; 1 if the cookie complies with RFC 2965/2109
  92.694       *
  92.695 -     * @return                  0 if the cookie complies with the
  92.696 -     *                          original Netscape specification; 1
  92.697 -     *                          if the cookie complies with RFC 2965/2109
  92.698 -     *
  92.699 -     * @see #setVersion
  92.700 -     *
  92.701 +     * @see  #setVersion
  92.702       */
  92.703 -
  92.704      public int getVersion() {
  92.705          return version;
  92.706      }
  92.707  
  92.708 -
  92.709 -
  92.710 -
  92.711      /**
  92.712       * Sets the version of the cookie protocol this cookie complies
  92.713       * with. Version 0 complies with the original Netscape cookie
  92.714       * specification. Version 1 complies with RFC 2965/2109.
  92.715       *
  92.716 +     * @param  v
  92.717 +     *         0 if the cookie should comply with the original Netscape
  92.718 +     *         specification; 1 if the cookie should comply with RFC 2965/2109
  92.719       *
  92.720 -     * @param v                 0 if the cookie should comply with
  92.721 -     *                          the original Netscape specification;
  92.722 -     *                          1 if the cookie should comply with RFC 2965/2109
  92.723 +     * @throws  IllegalArgumentException
  92.724 +     *          if {@code v} is neither 0 nor 1
  92.725       *
  92.726 -     * @throws IllegalArgumentException if <tt>v</tt> is neither 0 nor 1
  92.727 -     *
  92.728 -     * @see #getVersion
  92.729 -     *
  92.730 +     * @see  #getVersion
  92.731       */
  92.732 -
  92.733      public void setVersion(int v) {
  92.734          if (v != 0 && v != 1) {
  92.735              throw new IllegalArgumentException("cookie version should be 0 or 1");
  92.736 @@ -664,11 +538,11 @@
  92.737       * attribute. This means that the cookie should not be accessible to
  92.738       * scripting engines, like javascript.
  92.739       *
  92.740 -     * @return {@code true} if this cookie should be considered http only.
  92.741 -     * @see #setHttpOnly(boolean)
  92.742 +     * @return  {@code true} if this cookie should be considered HTTPOnly
  92.743 +     *
  92.744 +     * @see  #setHttpOnly(boolean)
  92.745       */
  92.746 -    public boolean isHttpOnly()
  92.747 -    {
  92.748 +    public boolean isHttpOnly() {
  92.749          return httpOnly;
  92.750      }
  92.751  
  92.752 @@ -677,24 +551,25 @@
  92.753       * {@code true} it means the cookie should not be accessible to scripting
  92.754       * engines like javascript.
  92.755       *
  92.756 -     * @param httpOnly if {@code true} make the cookie HTTP only, i.e.
  92.757 -     *                 only visible as part of an HTTP request.
  92.758 -     * @see #isHttpOnly()
  92.759 +     * @param  httpOnly
  92.760 +     *         if {@code true} make the cookie HTTP only, i.e. only visible as
  92.761 +     *         part of an HTTP request.
  92.762 +     *
  92.763 +     * @see  #isHttpOnly()
  92.764       */
  92.765 -    public void setHttpOnly(boolean httpOnly)
  92.766 -    {
  92.767 +    public void setHttpOnly(boolean httpOnly) {
  92.768          this.httpOnly = httpOnly;
  92.769      }
  92.770  
  92.771      /**
  92.772 -     * The utility method to check whether a host name is in a domain
  92.773 -     * or not.
  92.774 +     * The utility method to check whether a host name is in a domain or not.
  92.775       *
  92.776 -     * <p>This concept is described in the cookie specification.
  92.777 +     * <p> This concept is described in the cookie specification.
  92.778       * To understand the concept, some terminologies need to be defined first:
  92.779       * <blockquote>
  92.780       * effective host name = hostname if host name contains dot<br>
  92.781 -     * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or = hostname.local if not
  92.782 +     * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  92.783 +     * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or = hostname.local if not
  92.784       * </blockquote>
  92.785       * <p>Host A's name domain-matches host B's if:
  92.786       * <blockquote><ul>
  92.787 @@ -731,9 +606,13 @@
  92.788       *   host is example.local, and example.local domain-matches .local.</li>
  92.789       * </ul></blockquote>
  92.790       *
  92.791 -     * @param domain    the domain name to check host name with
  92.792 -     * @param host      the host name in question
  92.793 -     * @return          <tt>true</tt> if they domain-matches; <tt>false</tt> if not
  92.794 +     * @param  domain
  92.795 +     *         the domain name to check host name with
  92.796 +     *
  92.797 +     * @param  host
  92.798 +     *         the host name in question
  92.799 +     *
  92.800 +     * @return  {@code true} if they domain-matches; {@code false} if not
  92.801       */
  92.802      public static boolean domainMatches(String domain, String host) {
  92.803          if (domain == null || host == null)
  92.804 @@ -745,7 +624,8 @@
  92.805          if (embeddedDotInDomain == 0)
  92.806              embeddedDotInDomain = domain.indexOf('.', 1);
  92.807          if (!isLocalDomain
  92.808 -            && (embeddedDotInDomain == -1 || embeddedDotInDomain == domain.length() - 1))
  92.809 +            && (embeddedDotInDomain == -1 ||
  92.810 +                embeddedDotInDomain == domain.length() - 1))
  92.811              return false;
  92.812  
  92.813          // if the host name contains no dot and the domain name
  92.814 @@ -779,7 +659,6 @@
  92.815          return false;
  92.816      }
  92.817  
  92.818 -
  92.819      /**
  92.820       * Constructs a cookie header string representation of this cookie,
  92.821       * which is in the format defined by corresponding cookie specification,
  92.822 @@ -796,17 +675,15 @@
  92.823          }
  92.824      }
  92.825  
  92.826 -
  92.827      /**
  92.828 -     * Test the equality of two http cookies.
  92.829 +     * Test the equality of two HTTP cookies.
  92.830       *
  92.831 -     * <p> The result is <tt>true</tt> only if two cookies
  92.832 -     * come from same domain (case-insensitive),
  92.833 -     * have same name (case-insensitive),
  92.834 -     * and have same path (case-sensitive).
  92.835 +     * <p> The result is {@code true} only if two cookies come from same domain
  92.836 +     * (case-insensitive), have same name (case-insensitive), and have same path
  92.837 +     * (case-sensitive).
  92.838       *
  92.839 -     * @return          <tt>true</tt> if 2 http cookies equal to each other;
  92.840 -     *                  otherwise, <tt>false</tt>
  92.841 +     * @return  {@code true} if two HTTP cookies equal to each other;
  92.842 +     *          otherwise, {@code false}
  92.843       */
  92.844      @Override
  92.845      public boolean equals(Object obj) {
  92.846 @@ -825,19 +702,17 @@
  92.847                 Objects.equals(getPath(), other.getPath());
  92.848      }
  92.849  
  92.850 -
  92.851      /**
  92.852 -     * Return hash code of this http cookie. The result is the sum of
  92.853 -     * hash code value of three significant components of this cookie:
  92.854 -     * name, domain, and path.
  92.855 -     * That is, the hash code is the value of the expression:
  92.856 +     * Returns the hash code of this HTTP cookie. The result is the sum of
  92.857 +     * hash code value of three significant components of this cookie: name,
  92.858 +     * domain, and path. That is, the hash code is the value of the expression:
  92.859       * <blockquote>
  92.860       * getName().toLowerCase().hashCode()<br>
  92.861       * + getDomain().toLowerCase().hashCode()<br>
  92.862       * + getPath().hashCode()
  92.863       * </blockquote>
  92.864       *
  92.865 -     * @return          this http cookie's hash code
  92.866 +     * @return  this HTTP cookie's hash code
  92.867       */
  92.868      @Override
  92.869      public int hashCode() {
  92.870 @@ -851,7 +726,7 @@
  92.871      /**
  92.872       * Create and return a copy of this object.
  92.873       *
  92.874 -     * @return          a clone of this http cookie
  92.875 +     * @return  a clone of this HTTP cookie
  92.876       */
  92.877      @Override
  92.878      public Object clone() {
  92.879 @@ -862,8 +737,7 @@
  92.880          }
  92.881      }
  92.882  
  92.883 -
  92.884 -    /* ---------------- Private operations -------------- */
  92.885 +    // ---------------- Private operations --------------
  92.886  
  92.887      // Note -- disabled for now to allow full Netscape compatibility
  92.888      // from RFC 2068, token special case characters
  92.889 @@ -872,15 +746,14 @@
  92.890      private static final String tspecials = ",;";
  92.891  
  92.892      /*
  92.893 -     * Tests a string and returns true if the string counts as a
  92.894 -     * token.
  92.895 +     * Tests a string and returns true if the string counts as a token.
  92.896       *
  92.897 -     * @param value             the <code>String</code> to be tested
  92.898 +     * @param  value
  92.899 +     *         the {@code String} to be tested
  92.900       *
  92.901 -     * @return                  <code>true</code> if the <code>String</code> is
  92.902 -     *                          a token; <code>false</code> if it is not
  92.903 +     * @return  {@code true} if the {@code String} is a token;
  92.904 +     *          {@code false} if it is not
  92.905       */
  92.906 -
  92.907      private static boolean isToken(String value) {
  92.908          int len = value.length();
  92.909  
  92.910 @@ -893,11 +766,12 @@
  92.911          return true;
  92.912      }
  92.913  
  92.914 -
  92.915      /*
  92.916 -     * @param name      the name to be tested
  92.917 -     * @return          <tt>true</tt> if the name is reserved by cookie
  92.918 -     *                  specification, <tt>false</tt> if it is not
  92.919 +     * @param  name
  92.920 +     *         the name to be tested
  92.921 +     *
  92.922 +     * @return  {@code true} if the name is reserved by cookie specification,
  92.923 +     *          {@code false} if it is not
  92.924       */
  92.925      private static boolean isReserved(String name) {
  92.926          if (name.equalsIgnoreCase("Comment")
  92.927 @@ -919,16 +793,16 @@
  92.928          return false;
  92.929      }
  92.930  
  92.931 -
  92.932      /*
  92.933       * Parse header string to cookie object.
  92.934       *
  92.935 -     * @param header    header string; should contain only one NAME=VALUE pair
  92.936 +     * @param  header
  92.937 +     *         header string; should contain only one NAME=VALUE pair
  92.938       *
  92.939 -     * @return          an HttpCookie being extracted
  92.940 +     * @return  an HttpCookie being extracted
  92.941       *
  92.942 -     * @throws IllegalArgumentException if header string violates the cookie
  92.943 -     *                                  specification
  92.944 +     * @throws  IllegalArgumentException
  92.945 +     *          if header string violates the cookie specification
  92.946       */
  92.947      private static HttpCookie parseInternal(String header)
  92.948      {
  92.949 @@ -974,69 +848,97 @@
  92.950          return cookie;
  92.951      }
  92.952  
  92.953 -
  92.954      /*
  92.955       * assign cookie attribute value to attribute name;
  92.956       * use a map to simulate method dispatch
  92.957       */
  92.958      static interface CookieAttributeAssignor {
  92.959 -            public void assign(HttpCookie cookie, String attrName, String attrValue);
  92.960 +            public void assign(HttpCookie cookie,
  92.961 +                               String attrName,
  92.962 +                               String attrValue);
  92.963      }
  92.964 -    static java.util.Map<String, CookieAttributeAssignor> assignors = null;
  92.965 +    static final java.util.Map<String, CookieAttributeAssignor> assignors =
  92.966 +            new java.util.HashMap<>();
  92.967      static {
  92.968 -        assignors = new java.util.HashMap<String, CookieAttributeAssignor>();
  92.969 -        assignors.put("comment", new CookieAttributeAssignor(){
  92.970 -                public void assign(HttpCookie cookie, String attrName, String attrValue) {
  92.971 -                    if (cookie.getComment() == null) cookie.setComment(attrValue);
  92.972 +        assignors.put("comment", new CookieAttributeAssignor() {
  92.973 +                public void assign(HttpCookie cookie,
  92.974 +                                   String attrName,
  92.975 +                                   String attrValue) {
  92.976 +                    if (cookie.getComment() == null)
  92.977 +                        cookie.setComment(attrValue);
  92.978                  }
  92.979              });
  92.980 -        assignors.put("commenturl", new CookieAttributeAssignor(){
  92.981 -                public void assign(HttpCookie cookie, String attrName, String attrValue) {
  92.982 -                    if (cookie.getCommentURL() == null) cookie.setCommentURL(attrValue);
  92.983 +        assignors.put("commenturl", new CookieAttributeAssignor() {
  92.984 +                public void assign(HttpCookie cookie,
  92.985 +                                   String attrName,
  92.986 +                                   String attrValue) {
  92.987 +                    if (cookie.getCommentURL() == null)
  92.988 +                        cookie.setCommentURL(attrValue);
  92.989                  }
  92.990              });
  92.991 -        assignors.put("discard", new CookieAttributeAssignor(){
  92.992 -                public void assign(HttpCookie cookie, String attrName, String attrValue) {
  92.993 +        assignors.put("discard", new CookieAttributeAssignor() {
  92.994 +                public void assign(HttpCookie cookie,
  92.995 +                                   String attrName,
  92.996 +                                   String attrValue) {
  92.997                      cookie.setDiscard(true);
  92.998                  }
  92.999              });
 92.1000          assignors.put("domain", new CookieAttributeAssignor(){
 92.1001 -                public void assign(HttpCookie cookie, String attrName, String attrValue) {
 92.1002 -                    if (cookie.getDomain() == null) cookie.setDomain(attrValue);
 92.1003 +                public void assign(HttpCookie cookie,
 92.1004 +                                   String attrName,
 92.1005 +                                   String attrValue) {
 92.1006 +                    if (cookie.getDomain() == null)
 92.1007 +                        cookie.setDomain(attrValue);
 92.1008                  }
 92.1009              });
 92.1010          assignors.put("max-age", new CookieAttributeAssignor(){
 92.1011 -                public void assign(HttpCookie cookie, String attrName, String attrValue) {
 92.1012 +                public void assign(HttpCookie cookie,
 92.1013 +                                   String attrName,
 92.1014 +                                   String attrValue) {
 92.1015                      try {
 92.1016                          long maxage = Long.parseLong(attrValue);
 92.1017 -                        if (cookie.getMaxAge() == MAX_AGE_UNSPECIFIED) cookie.setMaxAge(maxage);
 92.1018 +                        if (cookie.getMaxAge() == MAX_AGE_UNSPECIFIED)
 92.1019 +                            cookie.setMaxAge(maxage);
 92.1020                      } catch (NumberFormatException ignored) {
 92.1021 -                        throw new IllegalArgumentException("Illegal cookie max-age attribute");
 92.1022 +                        throw new IllegalArgumentException(
 92.1023 +                                "Illegal cookie max-age attribute");
 92.1024                      }
 92.1025                  }
 92.1026              });
 92.1027          assignors.put("path", new CookieAttributeAssignor(){
 92.1028 -                public void assign(HttpCookie cookie, String attrName, String attrValue) {
 92.1029 -                    if (cookie.getPath() == null) cookie.setPath(attrValue);
 92.1030 +                public void assign(HttpCookie cookie,
 92.1031 +                                   String attrName,
 92.1032 +                                   String attrValue) {
 92.1033 +                    if (cookie.getPath() == null)
 92.1034 +                        cookie.setPath(attrValue);
 92.1035                  }
 92.1036              });
 92.1037          assignors.put("port", new CookieAttributeAssignor(){
 92.1038 -                public void assign(HttpCookie cookie, String attrName, String attrValue) {
 92.1039 -                    if (cookie.getPortlist() == null) cookie.setPortlist(attrValue == null ? "" : attrValue);
 92.1040 +                public void assign(HttpCookie cookie,
 92.1041 +                                   String attrName,
 92.1042 +                                   String attrValue) {
 92.1043 +                    if (cookie.getPortlist() == null)
 92.1044 +                        cookie.setPortlist(attrValue == null ? "" : attrValue);
 92.1045                  }
 92.1046              });
 92.1047          assignors.put("secure", new CookieAttributeAssignor(){
 92.1048 -                public void assign(HttpCookie cookie, String attrName, String attrValue) {
 92.1049 +                public void assign(HttpCookie cookie,
 92.1050 +                                   String attrName,
 92.1051 +                                   String attrValue) {
 92.1052                      cookie.setSecure(true);
 92.1053                  }
 92.1054              });
 92.1055          assignors.put("httponly", new CookieAttributeAssignor(){
 92.1056 -                public void assign(HttpCookie cookie, String attrName, String attrValue) {
 92.1057 +                public void assign(HttpCookie cookie,
 92.1058 +                                   String attrName,
 92.1059 +                                   String attrValue) {
 92.1060                      cookie.setHttpOnly(true);
 92.1061                  }
 92.1062              });
 92.1063          assignors.put("version", new CookieAttributeAssignor(){
 92.1064 -                public void assign(HttpCookie cookie, String attrName, String attrValue) {
 92.1065 +                public void assign(HttpCookie cookie,
 92.1066 +                                   String attrName,
 92.1067 +                                   String attrValue) {
 92.1068                      try {
 92.1069                          int version = Integer.parseInt(attrValue);
 92.1070                          cookie.setVersion(version);
 92.1071 @@ -1046,7 +948,9 @@
 92.1072                  }
 92.1073              });
 92.1074          assignors.put("expires", new CookieAttributeAssignor(){ // Netscape only
 92.1075 -                public void assign(HttpCookie cookie, String attrName, String attrValue) {
 92.1076 +                public void assign(HttpCookie cookie,
 92.1077 +                                   String attrName,
 92.1078 +                                   String attrValue) {
 92.1079                      if (cookie.getMaxAge() == MAX_AGE_UNSPECIFIED) {
 92.1080                          cookie.setMaxAge(cookie.expiryDate2DeltaSeconds(attrValue));
 92.1081                      }
 92.1082 @@ -1054,8 +958,8 @@
 92.1083              });
 92.1084      }
 92.1085      private static void assignAttribute(HttpCookie cookie,
 92.1086 -                                       String attrName,
 92.1087 -                                       String attrValue)
 92.1088 +                                        String attrName,
 92.1089 +                                        String attrValue)
 92.1090      {
 92.1091          // strip off the surrounding "-sign if there's any
 92.1092          attrValue = stripOffSurroundingQuote(attrValue);
 92.1093 @@ -1073,11 +977,7 @@
 92.1094       * as Netscape spec, but without leading "Cookie:" token.
 92.1095       */
 92.1096      private String toNetscapeHeaderString() {
 92.1097 -        StringBuilder sb = new StringBuilder();
 92.1098 -
 92.1099 -        sb.append(getName() + "=" + getValue());
 92.1100 -
 92.1101 -        return sb.toString();
 92.1102 +        return getName() + "=" + getValue();
 92.1103      }
 92.1104  
 92.1105      /*
 92.1106 @@ -1101,15 +1001,16 @@
 92.1107      static final TimeZone GMT = TimeZone.getTimeZone("GMT");
 92.1108  
 92.1109      /*
 92.1110 -     * @param dateString        a date string in one of the formats
 92.1111 -     *                          defined in Netscape cookie spec
 92.1112 +     * @param  dateString
 92.1113 +     *         a date string in one of the formats defined in Netscape cookie spec
 92.1114       *
 92.1115 -     * @return                  delta seconds between this cookie's creation
 92.1116 -     *                          time and the time specified by dateString
 92.1117 +     * @return  delta seconds between this cookie's creation time and the time
 92.1118 +     *          specified by dateString
 92.1119       */
 92.1120      private long expiryDate2DeltaSeconds(String dateString) {
 92.1121          for (int i = 0; i < COOKIE_DATE_FORMATS.length; i++) {
 92.1122 -            SimpleDateFormat df = new SimpleDateFormat(COOKIE_DATE_FORMATS[i], Locale.US);
 92.1123 +            SimpleDateFormat df = new SimpleDateFormat(COOKIE_DATE_FORMATS[i],
 92.1124 +                                                       Locale.US);
 92.1125              df.setTimeZone(GMT);
 92.1126              try {
 92.1127                  Date date = df.parse(dateString);
 92.1128 @@ -1121,8 +1022,6 @@
 92.1129          return 0;
 92.1130      }
 92.1131  
 92.1132 -
 92.1133 -
 92.1134      /*
 92.1135       * try to guess the cookie version through set-cookie header string
 92.1136       */
 92.1137 @@ -1184,10 +1083,10 @@
 92.1138       *   2) but not the comma surrounding by double-quotes, which is the comma
 92.1139       *      inside port list or embeded URIs.
 92.1140       *
 92.1141 -     * @param header            the cookie header string to split
 92.1142 +     * @param  header
 92.1143 +     *         the cookie header string to split
 92.1144       *
 92.1145 -     * @return                  list of strings; never null
 92.1146 -     *
 92.1147 +     * @return  list of strings; never null
 92.1148       */
 92.1149      private static List<String> splitMultiCookies(String header) {
 92.1150          List<String> cookies = new java.util.ArrayList<String>();
 92.1151 @@ -1197,7 +1096,8 @@
 92.1152          for (p = 0, q = 0; p < header.length(); p++) {
 92.1153              char c = header.charAt(p);
 92.1154              if (c == '"') quoteCount++;
 92.1155 -            if (c == ',' && (quoteCount % 2 == 0)) {      // it is comma and not surrounding by double-quotes
 92.1156 +            if (c == ',' && (quoteCount % 2 == 0)) {
 92.1157 +                // it is comma and not surrounding by double-quotes
 92.1158                  cookies.add(header.substring(q, p));
 92.1159                  q = p + 1;
 92.1160              }
    93.1 --- a/src/share/classes/java/net/InetAddress.java	Tue Dec 06 16:31:58 2011 -0800
    93.2 +++ b/src/share/classes/java/net/InetAddress.java	Mon Dec 19 10:06:23 2011 -0800
    93.3 @@ -32,6 +32,7 @@
    93.4  import java.util.LinkedList;
    93.5  import java.util.List;
    93.6  import java.util.ArrayList;
    93.7 +import java.util.ServiceLoader;
    93.8  import java.security.AccessController;
    93.9  import java.io.ObjectStreamException;
   93.10  import java.io.IOException;
   93.11 @@ -39,7 +40,6 @@
   93.12  import sun.security.action.*;
   93.13  import sun.net.InetAddressCachePolicy;
   93.14  import sun.net.util.IPAddressUtil;
   93.15 -import sun.misc.Service;
   93.16  import sun.net.spi.nameservice.*;
   93.17  
   93.18  /**
   93.19 @@ -876,10 +876,9 @@
   93.20                  nameService = java.security.AccessController.doPrivileged(
   93.21                      new java.security.PrivilegedExceptionAction<NameService>() {
   93.22                          public NameService run() {
   93.23 -                            // sun.misc.Service.providers returns a raw Iterator
   93.24 -                            @SuppressWarnings("unchecked")
   93.25                              Iterator<NameServiceDescriptor> itr =
   93.26 -                                Service.providers(NameServiceDescriptor.class);
   93.27 +                                ServiceLoader.load(NameServiceDescriptor.class)
   93.28 +                                    .iterator();
   93.29                              while (itr.hasNext()) {
   93.30                                  NameServiceDescriptor nsd = itr.next();
   93.31                                  if (providerName.
    94.1 --- a/src/share/classes/java/rmi/MarshalledObject.java	Tue Dec 06 16:31:58 2011 -0800
    94.2 +++ b/src/share/classes/java/rmi/MarshalledObject.java	Mon Dec 19 10:06:23 2011 -0800
    94.3 @@ -156,6 +156,7 @@
    94.4              (locBytes == null ? null : new ByteArrayInputStream(locBytes));
    94.5          MarshalledObjectInputStream in =
    94.6              new MarshalledObjectInputStream(bin, lin);
    94.7 +        @SuppressWarnings("unchecked")
    94.8          T obj = (T) in.readObject();
    94.9          in.close();
   94.10          return obj;
   94.11 @@ -190,7 +191,7 @@
   94.12              return true;
   94.13  
   94.14          if (obj != null && obj instanceof MarshalledObject) {
   94.15 -            MarshalledObject other = (MarshalledObject) obj;
   94.16 +            MarshalledObject<?> other = (MarshalledObject<?>) obj;
   94.17  
   94.18              // if either is a ref to null, both must be
   94.19              if (objBytes == null || other.objBytes == null)
    95.1 --- a/src/share/classes/java/rmi/dgc/VMID.java	Tue Dec 06 16:31:58 2011 -0800
    95.2 +++ b/src/share/classes/java/rmi/dgc/VMID.java	Mon Dec 19 10:06:23 2011 -0800
    95.3 @@ -118,7 +118,7 @@
    95.4          StringBuffer result = new StringBuffer();
    95.5          if (addr != null)
    95.6              for (int i = 0; i < addr.length; ++ i) {
    95.7 -                int x = (int) (addr[i] & 0xFF);
    95.8 +                int x = addr[i] & 0xFF;
    95.9                  result.append((x < 0x10 ? "0" : "") +
   95.10                                Integer.toString(x, 16));
   95.11              }
    96.1 --- a/src/share/classes/java/rmi/server/LogStream.java	Tue Dec 06 16:31:58 2011 -0800
    96.2 +++ b/src/share/classes/java/rmi/server/LogStream.java	Mon Dec 19 10:06:23 2011 -0800
    96.3 @@ -39,7 +39,7 @@
    96.4  public class LogStream extends PrintStream {
    96.5  
    96.6      /** table mapping known log names to log stream objects */
    96.7 -    private static Hashtable    known = new Hashtable(5);
    96.8 +    private static Map<String,LogStream> known = new HashMap<>(5);
    96.9      /** default output stream for new logs */
   96.10      private static PrintStream  defaultStream = System.err;
   96.11  
   96.12 @@ -90,7 +90,7 @@
   96.13      public static LogStream log(String name) {
   96.14          LogStream stream;
   96.15          synchronized (known) {
   96.16 -            stream = (LogStream)known.get(name);
   96.17 +            stream = known.get(name);
   96.18              if (stream == null) {
   96.19                  stream = new LogStream(name, defaultStream);
   96.20              }
    97.1 --- a/src/share/classes/java/rmi/server/RemoteObject.java	Tue Dec 06 16:31:58 2011 -0800
    97.2 +++ b/src/share/classes/java/rmi/server/RemoteObject.java	Mon Dec 19 10:06:23 2011 -0800
    97.3 @@ -436,7 +436,7 @@
    97.4               */
    97.5              String internalRefClassName =
    97.6                  RemoteRef.packagePrefix + "." + refClassName;
    97.7 -            Class refClass = Class.forName(internalRefClassName);
    97.8 +            Class<?> refClass = Class.forName(internalRefClassName);
    97.9              try {
   97.10                  ref = (RemoteRef) refClass.newInstance();
   97.11  
    98.1 --- a/src/share/classes/java/sql/Date.java	Tue Dec 06 16:31:58 2011 -0800
    98.2 +++ b/src/share/classes/java/sql/Date.java	Mon Dec 19 10:06:23 2011 -0800
    98.3 @@ -150,6 +150,7 @@
    98.4       * <P>
    98.5       * @return a String in yyyy-mm-dd format
    98.6       */
    98.7 +    @SuppressWarnings("deprecation")
    98.8      public String toString () {
    98.9          int year = super.getYear() + 1900;
   98.10          int month = super.getMonth() + 1;
    99.1 --- a/src/share/classes/java/sql/DriverManager.java	Tue Dec 06 16:31:58 2011 -0800
    99.2 +++ b/src/share/classes/java/sql/DriverManager.java	Mon Dec 19 10:06:23 2011 -0800
    99.3 @@ -80,7 +80,7 @@
    99.4  
    99.5  
    99.6      // List of registered JDBC drivers
    99.7 -    private final static CopyOnWriteArrayList<DriverInfo> registeredDrivers = new CopyOnWriteArrayList<DriverInfo>();
    99.8 +    private final static CopyOnWriteArrayList<DriverInfo> registeredDrivers = new CopyOnWriteArrayList<>();
    99.9      private static volatile int loginTimeout = 0;
   99.10      private static volatile java.io.PrintWriter logWriter = null;
   99.11      private static volatile java.io.PrintStream logStream = null;
   99.12 @@ -357,7 +357,7 @@
   99.13       * @return the list of JDBC Drivers loaded by the caller's class loader
   99.14       */
   99.15      public static java.util.Enumeration<Driver> getDrivers() {
   99.16 -        java.util.Vector<Driver> result = new java.util.Vector<Driver>();
   99.17 +        java.util.Vector<Driver> result = new java.util.Vector<>();
   99.18  
   99.19          // Gets the classloader of the code that called this method, may
   99.20          // be null.
   99.21 @@ -621,15 +621,18 @@
   99.22          this.driver = driver;
   99.23      }
   99.24  
   99.25 +    @Override
   99.26      public boolean equals(Object other) {
   99.27          return (other instanceof DriverInfo)
   99.28                  && this.driver == ((DriverInfo) other).driver;
   99.29      }
   99.30  
   99.31 +    @Override
   99.32      public int hashCode() {
   99.33          return driver.hashCode();
   99.34      }
   99.35  
   99.36 +    @Override
   99.37      public String toString() {
   99.38          return ("driver[className="  + driver + "]");
   99.39      }
   100.1 --- a/src/share/classes/java/sql/Time.java	Tue Dec 06 16:31:58 2011 -0800
   100.2 +++ b/src/share/classes/java/sql/Time.java	Mon Dec 19 10:06:23 2011 -0800
   100.3 @@ -115,6 +115,7 @@
   100.4       *
   100.5       * @return a <code>String</code> in hh:mm:ss format
   100.6       */
   100.7 +    @SuppressWarnings("deprecation")
   100.8      public String toString () {
   100.9          int hour = super.getHours();
  100.10          int minute = super.getMinutes();
   101.1 --- a/src/share/classes/java/sql/Timestamp.java	Tue Dec 06 16:31:58 2011 -0800
   101.2 +++ b/src/share/classes/java/sql/Timestamp.java	Mon Dec 19 10:06:23 2011 -0800
   101.3 @@ -271,6 +271,7 @@
   101.4       * @return a <code>String</code> object in
   101.5       *           <code>yyyy-mm-dd hh:mm:ss.fffffffff</code> format
   101.6       */
   101.7 +    @SuppressWarnings("deprecation")
   101.8      public String toString () {
   101.9  
  101.10          int year = super.getYear() + 1900;
   102.1 --- a/src/share/classes/java/util/Currency.java	Tue Dec 06 16:31:58 2011 -0800
   102.2 +++ b/src/share/classes/java/util/Currency.java	Mon Dec 19 10:06:23 2011 -0800
   102.3 @@ -189,7 +189,7 @@
   102.4      private static final int VALID_FORMAT_VERSION = 1;
   102.5  
   102.6      static {
   102.7 -        AccessController.doPrivileged(new PrivilegedAction() {
   102.8 +        AccessController.doPrivileged(new PrivilegedAction<Object>() {
   102.9              public Object run() {
  102.10                  String homeDir = System.getProperty("java.home");
  102.11                  try {
  102.12 @@ -431,7 +431,9 @@
  102.13              }
  102.14          }
  102.15  
  102.16 -        return (Set<Currency>) available.clone();
  102.17 +        @SuppressWarnings("unchecked")
  102.18 +        Set<Currency> result = (Set<Currency>) available.clone();
  102.19 +        return result;
  102.20      }
  102.21  
  102.22      /**
   103.1 --- a/src/share/classes/java/util/Date.java	Tue Dec 06 16:31:58 2011 -0800
   103.2 +++ b/src/share/classes/java/util/Date.java	Mon Dec 19 10:06:23 2011 -0800
   103.3 @@ -1,5 +1,5 @@
   103.4  /*
   103.5 - * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
   103.6 + * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
   103.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   103.8   *
   103.9   * This code is free software; you can redistribute it and/or modify it
  103.10 @@ -770,7 +770,7 @@
  103.11       */
  103.12      @Deprecated
  103.13      public int getDay() {
  103.14 -        return normalize().getDayOfWeek() - gcal.SUNDAY;
  103.15 +        return normalize().getDayOfWeek() - BaseCalendar.SUNDAY;
  103.16      }
  103.17  
  103.18      /**
  103.19 @@ -1027,7 +1027,7 @@
  103.20          BaseCalendar.Date date = normalize();
  103.21          StringBuilder sb = new StringBuilder(28);
  103.22          int index = date.getDayOfWeek();
  103.23 -        if (index == gcal.SUNDAY) {
  103.24 +        if (index == BaseCalendar.SUNDAY) {
  103.25              index = 8;
  103.26          }
  103.27          convertToAbbr(sb, wtb[index]).append(' ');                        // EEE
  103.28 @@ -1039,7 +1039,7 @@
  103.29          CalendarUtils.sprintf0d(sb, date.getSeconds(), 2).append(' '); // ss
  103.30          TimeZone zi = date.getZone();
  103.31          if (zi != null) {
  103.32 -            sb.append(zi.getDisplayName(date.isDaylightTime(), zi.SHORT, Locale.US)); // zzz
  103.33 +            sb.append(zi.getDisplayName(date.isDaylightTime(), TimeZone.SHORT, Locale.US)); // zzz
  103.34          } else {
  103.35              sb.append("GMT");
  103.36          }
  103.37 @@ -1237,7 +1237,7 @@
  103.38              }
  103.39              GregorianCalendar gc = new GregorianCalendar(tz);
  103.40              gc.clear();
  103.41 -            gc.set(gc.MILLISECOND, ms);
  103.42 +            gc.set(GregorianCalendar.MILLISECOND, ms);
  103.43              gc.set(y, m-1, d, hh, mm, ss);
  103.44              fastTime = gc.getTimeInMillis();
  103.45              BaseCalendar cal = getCalendarSystem(fastTime);
   104.1 --- a/src/share/classes/java/util/Formatter.java	Tue Dec 06 16:31:58 2011 -0800
   104.2 +++ b/src/share/classes/java/util/Formatter.java	Mon Dec 19 10:06:23 2011 -0800
   104.3 @@ -2879,7 +2879,7 @@
   104.4          }
   104.5  
   104.6          public String toString() {
   104.7 -            StringBuilder sb = new StringBuilder('%');
   104.8 +            StringBuilder sb = new StringBuilder("%");
   104.9              // Flags.UPPERCASE is set internally for legal conversions.
  104.10              Flags dupf = f.dup().remove(Flags.UPPERCASE);
  104.11              sb.append(dupf.toString());
   105.1 --- a/src/share/classes/java/util/GregorianCalendar.java	Tue Dec 06 16:31:58 2011 -0800
   105.2 +++ b/src/share/classes/java/util/GregorianCalendar.java	Mon Dec 19 10:06:23 2011 -0800
   105.3 @@ -947,7 +947,7 @@
   105.4              }
   105.5  
   105.6              if (month >= 0) {
   105.7 -                set(MONTH, (int) (month % 12));
   105.8 +                set(MONTH, month % 12);
   105.9              } else {
  105.10                  // month < 0
  105.11                  month %= 12;
  105.12 @@ -1313,8 +1313,8 @@
  105.13                  }
  105.14  
  105.15                  // the first day of week of the month.
  105.16 -                long monthDay1st = calsys.getDayOfWeekDateOnOrBefore(month1 + 6,
  105.17 -                                                                     getFirstDayOfWeek());
  105.18 +                long monthDay1st = BaseCalendar.getDayOfWeekDateOnOrBefore(month1 + 6,
  105.19 +                                                                           getFirstDayOfWeek());
  105.20                  // if the week has enough days to form a week, the
  105.21                  // week starts from the previous month.
  105.22                  if ((int)(monthDay1st - month1) >= getMinimalDaysInFirstWeek()) {
  105.23 @@ -1407,7 +1407,7 @@
  105.24                      return;
  105.25                  }
  105.26                  long fd = getCurrentFixedDate();
  105.27 -                long dowFirst = calsys.getDayOfWeekDateOnOrBefore(fd, getFirstDayOfWeek());
  105.28 +                long dowFirst = BaseCalendar.getDayOfWeekDateOnOrBefore(fd, getFirstDayOfWeek());
  105.29                  fd += amount;
  105.30                  if (fd < dowFirst) {
  105.31                      fd += 7;
  105.32 @@ -1926,7 +1926,7 @@
  105.33       * Returns the millisecond offset from the beginning of this
  105.34       * year. This Calendar object must have been normalized.
  105.35       */
  105.36 -    private final long getYearOffsetInMillis() {
  105.37 +    private long getYearOffsetInMillis() {
  105.38          long t = (internalGet(DAY_OF_YEAR) - 1) * 24;
  105.39          t += internalGet(HOUR_OF_DAY);
  105.40          t *= 60;
  105.41 @@ -2485,8 +2485,8 @@
  105.42                          if (cdate.isLeapYear()) {
  105.43                              nextJan1++;
  105.44                          }
  105.45 -                        long nextJan1st = calsys.getDayOfWeekDateOnOrBefore(nextJan1 + 6,
  105.46 -                                                                            getFirstDayOfWeek());
  105.47 +                        long nextJan1st = BaseCalendar.getDayOfWeekDateOnOrBefore(nextJan1 + 6,
  105.48 +                                                                                  getFirstDayOfWeek());
  105.49                          int ndays = (int)(nextJan1st - nextJan1);
  105.50                          if (ndays >= getMinimalDaysInFirstWeek() && fixedDate >= (nextJan1st - 7)) {
  105.51                              // The first days forms a week in which the date is included.
  105.52 @@ -2518,8 +2518,8 @@
  105.53                          calForJan1 = gcal;
  105.54                      }
  105.55  
  105.56 -                    long nextJan1st = calForJan1.getDayOfWeekDateOnOrBefore(nextJan1 + 6,
  105.57 -                                                                            getFirstDayOfWeek());
  105.58 +                    long nextJan1st = BaseCalendar.getDayOfWeekDateOnOrBefore(nextJan1 + 6,
  105.59 +                                                                              getFirstDayOfWeek());
  105.60                      int ndays = (int)(nextJan1st - nextJan1);
  105.61                      if (ndays >= getMinimalDaysInFirstWeek() && fixedDate >= (nextJan1st - 7)) {
  105.62                          // The first days forms a week in which the date is included.
  105.63 @@ -2543,11 +2543,11 @@
  105.64       * @param fixedDate the fixed date of the last day of the period
  105.65       * @return the number of weeks of the given period
  105.66       */
  105.67 -    private final int getWeekNumber(long fixedDay1, long fixedDate) {
  105.68 +    private int getWeekNumber(long fixedDay1, long fixedDate) {
  105.69          // We can always use `gcal' since Julian and Gregorian are the
  105.70          // same thing for this calculation.
  105.71 -        long fixedDay1st = gcal.getDayOfWeekDateOnOrBefore(fixedDay1 + 6,
  105.72 -                                                           getFirstDayOfWeek());
  105.73 +        long fixedDay1st = Gregorian.getDayOfWeekDateOnOrBefore(fixedDay1 + 6,
  105.74 +                                                                getFirstDayOfWeek());
  105.75          int ndays = (int)(fixedDay1st - fixedDay1);
  105.76          assert ndays <= 7;
  105.77          if (ndays >= getMinimalDaysInFirstWeek()) {
  105.78 @@ -2818,16 +2818,16 @@
  105.79                  }
  105.80              } else {
  105.81                  if (isFieldSet(fieldMask, WEEK_OF_MONTH)) {
  105.82 -                    long firstDayOfWeek = cal.getDayOfWeekDateOnOrBefore(fixedDate + 6,
  105.83 -                                                                         getFirstDayOfWeek());
  105.84 +                    long firstDayOfWeek = BaseCalendar.getDayOfWeekDateOnOrBefore(fixedDate + 6,
  105.85 +                                                                                  getFirstDayOfWeek());
  105.86                      // If we have enough days in the first week, then
  105.87                      // move to the previous week.
  105.88                      if ((firstDayOfWeek - fixedDate) >= getMinimalDaysInFirstWeek()) {
  105.89                          firstDayOfWeek -= 7;
  105.90                      }
  105.91                      if (isFieldSet(fieldMask, DAY_OF_WEEK)) {
  105.92 -                        firstDayOfWeek = cal.getDayOfWeekDateOnOrBefore(firstDayOfWeek + 6,
  105.93 -                                                                        internalGet(DAY_OF_WEEK));
  105.94 +                        firstDayOfWeek = BaseCalendar.getDayOfWeekDateOnOrBefore(firstDayOfWeek + 6,
  105.95 +                                                                                 internalGet(DAY_OF_WEEK));
  105.96                      }
  105.97                      // In lenient mode, we treat days of the previous
  105.98                      // months as a part of the specified
  105.99 @@ -2850,15 +2850,15 @@
 105.100                          dowim = 1;
 105.101                      }
 105.102                      if (dowim >= 0) {
 105.103 -                        fixedDate = cal.getDayOfWeekDateOnOrBefore(fixedDate + (7 * dowim) - 1,
 105.104 -                                                                   dayOfWeek);
 105.105 +                        fixedDate = BaseCalendar.getDayOfWeekDateOnOrBefore(fixedDate + (7 * dowim) - 1,
 105.106 +                                                                            dayOfWeek);
 105.107                      } else {
 105.108                          // Go to the first day of the next week of
 105.109                          // the specified week boundary.
 105.110                          int lastDate = monthLength(month, year) + (7 * (dowim + 1));
 105.111                          // Then, get the day of week date on or before the last date.
 105.112 -                        fixedDate = cal.getDayOfWeekDateOnOrBefore(fixedDate + lastDate - 1,
 105.113 -                                                                   dayOfWeek);
 105.114 +                        fixedDate = BaseCalendar.getDayOfWeekDateOnOrBefore(fixedDate + lastDate - 1,
 105.115 +                                                                            dayOfWeek);
 105.116                      }
 105.117                  }
 105.118              }
 105.119 @@ -2877,8 +2877,8 @@
 105.120                  fixedDate += internalGet(DAY_OF_YEAR);
 105.121                  fixedDate--;
 105.122              } else {
 105.123 -                long firstDayOfWeek = cal.getDayOfWeekDateOnOrBefore(fixedDate + 6,
 105.124 -                                                                     getFirstDayOfWeek());
 105.125 +                long firstDayOfWeek = BaseCalendar.getDayOfWeekDateOnOrBefore(fixedDate + 6,
 105.126 +                                                                              getFirstDayOfWeek());
 105.127                  // If we have enough days in the first week, then move
 105.128                  // to the previous week.
 105.129                  if ((firstDayOfWeek - fixedDate) >= getMinimalDaysInFirstWeek()) {
 105.130 @@ -2887,8 +2887,8 @@
 105.131                  if (isFieldSet(fieldMask, DAY_OF_WEEK)) {
 105.132                      int dayOfWeek = internalGet(DAY_OF_WEEK);
 105.133                      if (dayOfWeek != getFirstDayOfWeek()) {
 105.134 -                        firstDayOfWeek = cal.getDayOfWeekDateOnOrBefore(firstDayOfWeek + 6,
 105.135 -                                                                        dayOfWeek);
 105.136 +                        firstDayOfWeek = BaseCalendar.getDayOfWeekDateOnOrBefore(firstDayOfWeek + 6,
 105.137 +                                                                                 dayOfWeek);
 105.138                      }
 105.139                  }
 105.140                  fixedDate = firstDayOfWeek + 7 * ((long)internalGet(WEEK_OF_YEAR) - 1);
 105.141 @@ -2903,7 +2903,7 @@
 105.142       * in sync). Otherwise, a cloned object is returned after calling
 105.143       * complete() in lenient mode.
 105.144       */
 105.145 -    private final GregorianCalendar getNormalizedCalendar() {
 105.146 +    private GregorianCalendar getNormalizedCalendar() {
 105.147          GregorianCalendar gc;
 105.148          if (isFullyNormalized()) {
 105.149              gc = this;
 105.150 @@ -2920,7 +2920,7 @@
 105.151       * Returns the Julian calendar system instance (singleton). 'jcal'
 105.152       * and 'jeras' are set upon the return.
 105.153       */
 105.154 -    synchronized private static final BaseCalendar getJulianCalendarSystem() {
 105.155 +    synchronized private static BaseCalendar getJulianCalendarSystem() {
 105.156          if (jcal == null) {
 105.157              jcal = (JulianCalendar) CalendarSystem.forName("julian");
 105.158              jeras = jcal.getEras();
 105.159 @@ -2958,7 +2958,7 @@
 105.160       * or Julian).
 105.161       * @param fixedDate the fixed date representation of the date
 105.162       */
 105.163 -    private final long getFixedDateJan1(BaseCalendar.Date date, long fixedDate) {
 105.164 +    private long getFixedDateJan1(BaseCalendar.Date date, long fixedDate) {
 105.165          assert date.getNormalizedYear() == gregorianCutoverYear ||
 105.166              date.getNormalizedYear() == gregorianCutoverYearJulian;
 105.167          if (gregorianCutoverYear != gregorianCutoverYearJulian) {
 105.168 @@ -2984,7 +2984,7 @@
 105.169       * or Julian).
 105.170       * @param fixedDate the fixed date representation of the date
 105.171       */
 105.172 -    private final long getFixedDateMonth1(BaseCalendar.Date date, long fixedDate) {
 105.173 +    private long getFixedDateMonth1(BaseCalendar.Date date, long fixedDate) {
 105.174          assert date.getNormalizedYear() == gregorianCutoverYear ||
 105.175              date.getNormalizedYear() == gregorianCutoverYearJulian;
 105.176          BaseCalendar.Date gCutover = getGregorianCutoverDate();
 105.177 @@ -3023,7 +3023,7 @@
 105.178       *
 105.179       * @param fd the fixed date
 105.180       */
 105.181 -    private final BaseCalendar.Date getCalendarDate(long fd) {
 105.182 +    private BaseCalendar.Date getCalendarDate(long fd) {
 105.183          BaseCalendar cal = (fd >= gregorianCutoverDate) ? gcal : getJulianCalendarSystem();
 105.184          BaseCalendar.Date d = (BaseCalendar.Date) cal.newCalendarDate(TimeZone.NO_TIMEZONE);
 105.185          cal.getCalendarDateFromFixedDate(d, fd);
 105.186 @@ -3034,7 +3034,7 @@
 105.187       * Returns the Gregorian cutover date as a BaseCalendar.Date. The
 105.188       * date is a Gregorian date.
 105.189       */
 105.190 -    private final BaseCalendar.Date getGregorianCutoverDate() {
 105.191 +    private BaseCalendar.Date getGregorianCutoverDate() {
 105.192          return getCalendarDate(gregorianCutoverDate);
 105.193      }
 105.194  
 105.195 @@ -3042,7 +3042,7 @@
 105.196       * Returns the day before the Gregorian cutover date as a
 105.197       * BaseCalendar.Date. The date is a Julian date.
 105.198       */
 105.199 -    private final BaseCalendar.Date getLastJulianDate() {
 105.200 +    private BaseCalendar.Date getLastJulianDate() {
 105.201          return getCalendarDate(gregorianCutoverDate - 1);
 105.202      }
 105.203  
 105.204 @@ -3052,7 +3052,7 @@
 105.205       *
 105.206       * @see #isLeapYear(int)
 105.207       */
 105.208 -    private final int monthLength(int month, int year) {
 105.209 +    private int monthLength(int month, int year) {
 105.210          return isLeapYear(year) ? LEAP_MONTH_LENGTH[month] : MONTH_LENGTH[month];
 105.211      }
 105.212  
 105.213 @@ -3062,7 +3062,7 @@
 105.214       *
 105.215       * @see #isLeapYear(int)
 105.216       */
 105.217 -    private final int monthLength(int month) {
 105.218 +    private int monthLength(int month) {
 105.219          int year = internalGet(YEAR);
 105.220          if (internalGetEra() == BCE) {
 105.221              year = 1 - year;
 105.222 @@ -3070,7 +3070,7 @@
 105.223          return monthLength(month, year);
 105.224      }
 105.225  
 105.226 -    private final int actualMonthLength() {
 105.227 +    private int actualMonthLength() {
 105.228          int year = cdate.getNormalizedYear();
 105.229          if (year != gregorianCutoverYear && year != gregorianCutoverYearJulian) {
 105.230              return calsys.getMonthLength(cdate);
 105.231 @@ -3094,7 +3094,7 @@
 105.232       * Returns the length (in days) of the specified year. The year
 105.233       * must be normalized.
 105.234       */
 105.235 -    private final int yearLength(int year) {
 105.236 +    private int yearLength(int year) {
 105.237          return isLeapYear(year) ? 366 : 365;
 105.238      }
 105.239  
 105.240 @@ -3102,7 +3102,7 @@
 105.241       * Returns the length (in days) of the year provided by
 105.242       * internalGet(YEAR).
 105.243       */
 105.244 -    private final int yearLength() {
 105.245 +    private int yearLength() {
 105.246          int year = internalGet(YEAR);
 105.247          if (internalGetEra() == BCE) {
 105.248              year = 1 - year;
 105.249 @@ -3116,7 +3116,7 @@
 105.250       * 3, we want it to go to Feb 28.  Adjustments which might run into this
 105.251       * problem call this method to retain the proper month.
 105.252       */
 105.253 -    private final void pinDayOfMonth() {
 105.254 +    private void pinDayOfMonth() {
 105.255          int year = internalGet(YEAR);
 105.256          int monthLen;
 105.257          if (year > gregorianCutoverYear || year < gregorianCutoverYearJulian) {
 105.258 @@ -3135,14 +3135,14 @@
 105.259       * Returns the fixed date value of this object. The time value and
 105.260       * calendar fields must be in synch.
 105.261       */
 105.262 -    private final long getCurrentFixedDate() {
 105.263 +    private long getCurrentFixedDate() {
 105.264          return (calsys == gcal) ? cachedFixedDate : calsys.getFixedDate(cdate);
 105.265      }
 105.266  
 105.267      /**
 105.268       * Returns the new value after 'roll'ing the specified value and amount.
 105.269       */
 105.270 -    private static final int getRolledValue(int value, int amount, int min, int max) {
 105.271 +    private static int getRolledValue(int value, int amount, int min, int max) {
 105.272          assert value >= min && value <= max;
 105.273          int range = max - min + 1;
 105.274          amount %= range;
 105.275 @@ -3160,7 +3160,7 @@
 105.276       * Returns the ERA.  We need a special method for this because the
 105.277       * default ERA is CE, but a zero (unset) ERA is BCE.
 105.278       */
 105.279 -    private final int internalGetEra() {
 105.280 +    private int internalGetEra() {
 105.281          return isSet(ERA) ? internalGet(ERA) : CE;
 105.282      }
 105.283  
   106.1 --- a/src/share/classes/java/util/JapaneseImperialCalendar.java	Tue Dec 06 16:31:58 2011 -0800
   106.2 +++ b/src/share/classes/java/util/JapaneseImperialCalendar.java	Mon Dec 19 10:06:23 2011 -0800
   106.3 @@ -1,5 +1,5 @@
   106.4  /*
   106.5 - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
   106.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
   106.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   106.8   *
   106.9   * This code is free software; you can redistribute it and/or modify it
  106.10 @@ -260,8 +260,9 @@
  106.11              // max value could be one year short. For example, if it's
  106.12              // Showa 63 January 8, 63 is the actual max value since
  106.13              // Showa 64 January 8 doesn't exist.
  106.14 -            if (!(lgd.getMonth() == BaseCalendar.JANUARY && lgd.getDayOfMonth() == 1))
  106.15 +            if (!(lgd.getMonth() == BaseCalendar.JANUARY && lgd.getDayOfMonth() == 1)) {
  106.16                  y--;
  106.17 +            }
  106.18              year = Math.min(y, year);
  106.19          }
  106.20          LEAST_MAX_VALUES[YEAR] = year; // Max year could be smaller than this value.
  106.21 @@ -294,7 +295,7 @@
  106.22       * @param zone the given time zone.
  106.23       * @param aLocale the given locale.
  106.24       */
  106.25 -    public JapaneseImperialCalendar(TimeZone zone, Locale aLocale) {
  106.26 +    JapaneseImperialCalendar(TimeZone zone, Locale aLocale) {
  106.27          super(zone, aLocale);
  106.28          jdate = jcal.newCalendarDate(zone);
  106.29          setTimeInMillis(System.currentTimeMillis());
  106.30 @@ -792,8 +793,8 @@
  106.31                  }
  106.32  
  106.33                  // the first day of week of the month.
  106.34 -                long monthDay1st = jcal.getDayOfWeekDateOnOrBefore(month1 + 6,
  106.35 -                                                                   getFirstDayOfWeek());
  106.36 +                long monthDay1st = LocalGregorianCalendar.getDayOfWeekDateOnOrBefore(month1 + 6,
  106.37 +                                                                                     getFirstDayOfWeek());
  106.38                  // if the week has enough days to form a week, the
  106.39                  // week starts from the previous month.
  106.40                  if ((int)(monthDay1st - month1) >= getMinimalDaysInFirstWeek()) {
  106.41 @@ -884,7 +885,7 @@
  106.42                      return;
  106.43                  }
  106.44                  long fd = cachedFixedDate;
  106.45 -                long dowFirst = jcal.getDayOfWeekDateOnOrBefore(fd, getFirstDayOfWeek());
  106.46 +                long dowFirst = LocalGregorianCalendar.getDayOfWeekDateOnOrBefore(fd, getFirstDayOfWeek());
  106.47                  fd += amount;
  106.48                  if (fd < dowFirst) {
  106.49                      fd += 7;
  106.50 @@ -963,8 +964,9 @@
  106.51                      Era era = eras[index];
  106.52                      name = (style == SHORT) ? era.getAbbreviation() : era.getName();
  106.53                  } else {
  106.54 -                    if (field == DAY_OF_WEEK)
  106.55 +                    if (field == DAY_OF_WEEK) {
  106.56                          --index;
  106.57 +                    }
  106.58                      name = strings[index];
  106.59                  }
  106.60              }
  106.61 @@ -1000,7 +1002,7 @@
  106.62      private Map<String,Integer> getDisplayNamesImpl(int field, int style, Locale locale) {
  106.63          ResourceBundle rb = LocaleData.getDateFormatData(locale);
  106.64          String key = getKey(field, style);
  106.65 -        Map<String,Integer> map = new HashMap<String,Integer>();
  106.66 +        Map<String,Integer> map = new HashMap<>();
  106.67          if (key != null) {
  106.68              String[] strings = rb.getStringArray(key);
  106.69              if (field == YEAR) {
  106.70 @@ -1392,8 +1394,8 @@
  106.71                          jcal.normalize(jd);
  106.72                          long jan1 = jcal.getFixedDate(d);
  106.73                          long nextJan1 = jcal.getFixedDate(jd);
  106.74 -                        long nextJan1st = jcal.getDayOfWeekDateOnOrBefore(nextJan1 + 6,
  106.75 -                                                                          getFirstDayOfWeek());
  106.76 +                        long nextJan1st = LocalGregorianCalendar.getDayOfWeekDateOnOrBefore(nextJan1 + 6,
  106.77 +                                                                                            getFirstDayOfWeek());
  106.78                          int ndays = (int)(nextJan1st - nextJan1);
  106.79                          if (ndays >= getMinimalDaysInFirstWeek()) {
  106.80                              nextJan1st -= 7;
  106.81 @@ -1523,7 +1525,7 @@
  106.82       * beyond the limit. The given CalendarDate object must have been
  106.83       * normalized before calling this method.
  106.84       */
  106.85 -    private final long getYearOffsetInMillis(CalendarDate date) {
  106.86 +    private long getYearOffsetInMillis(CalendarDate date) {
  106.87          long t = (jcal.getDayOfYear(date) - 1) * ONE_DAY;
  106.88          return t + date.getTimeOfDay() - date.getZoneOffset();
  106.89      }
  106.90 @@ -1755,7 +1757,7 @@
  106.91                                  d.setMonth(pd.getMonth()).setDayOfMonth(pd.getDayOfMonth());
  106.92                              }
  106.93                          } else {
  106.94 -                            d.setMonth(jcal.JANUARY).setDayOfMonth(1);
  106.95 +                            d.setMonth(LocalGregorianCalendar.JANUARY).setDayOfMonth(1);
  106.96                          }
  106.97                          jcal.normalize(d);
  106.98                          prevJan1 = jcal.getFixedDate(d);
  106.99 @@ -1780,8 +1782,8 @@
 106.100                          if (jdate.isLeapYear()) {
 106.101                              nextJan1++;
 106.102                          }
 106.103 -                        long nextJan1st = jcal.getDayOfWeekDateOnOrBefore(nextJan1 + 6,
 106.104 -                                                                          getFirstDayOfWeek());
 106.105 +                        long nextJan1st = LocalGregorianCalendar.getDayOfWeekDateOnOrBefore(nextJan1 + 6,
 106.106 +                                                                                            getFirstDayOfWeek());
 106.107                          int ndays = (int)(nextJan1st - nextJan1);
 106.108                          if (ndays >= getMinimalDaysInFirstWeek() && fixedDate >= (nextJan1st - 7)) {
 106.109                              // The first days forms a week in which the date is included.
 106.110 @@ -1793,7 +1795,7 @@
 106.111                      long nextJan1;
 106.112                      if (jdate.getYear() == 1) {
 106.113                          d.addYear(+1);
 106.114 -                        d.setMonth(jcal.JANUARY).setDayOfMonth(1);
 106.115 +                        d.setMonth(LocalGregorianCalendar.JANUARY).setDayOfMonth(1);
 106.116                          nextJan1 = jcal.getFixedDate(d);
 106.117                      } else {
 106.118                          int nextEraIndex = getEraIndex(d) + 1;
 106.119 @@ -1803,8 +1805,8 @@
 106.120                          jcal.normalize(d);
 106.121                          nextJan1 = jcal.getFixedDate(d);
 106.122                      }
 106.123 -                    long nextJan1st = jcal.getDayOfWeekDateOnOrBefore(nextJan1 + 6,
 106.124 -                                                                      getFirstDayOfWeek());
 106.125 +                    long nextJan1st = LocalGregorianCalendar.getDayOfWeekDateOnOrBefore(nextJan1 + 6,
 106.126 +                                                                                        getFirstDayOfWeek());
 106.127                      int ndays = (int)(nextJan1st - nextJan1);
 106.128                      if (ndays >= getMinimalDaysInFirstWeek() && fixedDate >= (nextJan1st - 7)) {
 106.129                          // The first days forms a week in which the date is included.
 106.130 @@ -1828,11 +1830,11 @@
 106.131       * @param fixedDate the fixed date of the last day of the period
 106.132       * @return the number of weeks of the given period
 106.133       */
 106.134 -    private final int getWeekNumber(long fixedDay1, long fixedDate) {
 106.135 +    private int getWeekNumber(long fixedDay1, long fixedDate) {
 106.136          // We can always use `jcal' since Julian and Gregorian are the
 106.137          // same thing for this calculation.
 106.138 -        long fixedDay1st = jcal.getDayOfWeekDateOnOrBefore(fixedDay1 + 6,
 106.139 -                                                           getFirstDayOfWeek());
 106.140 +        long fixedDay1st = LocalGregorianCalendar.getDayOfWeekDateOnOrBefore(fixedDay1 + 6,
 106.141 +                                                                             getFirstDayOfWeek());
 106.142          int ndays = (int)(fixedDay1st - fixedDay1);
 106.143          assert ndays <= 7;
 106.144          if (ndays >= getMinimalDaysInFirstWeek()) {
 106.145 @@ -2026,10 +2028,12 @@
 106.146          if (year == MIN_VALUES[YEAR]) {
 106.147              CalendarDate dx = jcal.getCalendarDate(Long.MIN_VALUE, getZone());
 106.148              int m = dx.getMonth() - 1;
 106.149 -            if (month < m)
 106.150 +            if (month < m) {
 106.151                  month = m;
 106.152 -            if (month == m)
 106.153 +            }
 106.154 +            if (month == m) {
 106.155                  firstDayOfMonth = dx.getDayOfMonth();
 106.156 +            }
 106.157          }
 106.158  
 106.159          LocalGregorianCalendar.Date date = jcal.newCalendarDate(TimeZone.NO_TIMEZONE);
 106.160 @@ -2058,16 +2062,16 @@
 106.161                  }
 106.162              } else {
 106.163                  if (isFieldSet(fieldMask, WEEK_OF_MONTH)) {
 106.164 -                    long firstDayOfWeek = jcal.getDayOfWeekDateOnOrBefore(fixedDate + 6,
 106.165 -                                                                          getFirstDayOfWeek());
 106.166 +                    long firstDayOfWeek = LocalGregorianCalendar.getDayOfWeekDateOnOrBefore(fixedDate + 6,
 106.167 +                                                                                            getFirstDayOfWeek());
 106.168                      // If we have enough days in the first week, then
 106.169                      // move to the previous week.
 106.170                      if ((firstDayOfWeek - fixedDate) >= getMinimalDaysInFirstWeek()) {
 106.171                          firstDayOfWeek -= 7;
 106.172                      }
 106.173                      if (isFieldSet(fieldMask, DAY_OF_WEEK)) {
 106.174 -                        firstDayOfWeek = jcal.getDayOfWeekDateOnOrBefore(firstDayOfWeek + 6,
 106.175 -                                                                         internalGet(DAY_OF_WEEK));
 106.176 +                        firstDayOfWeek = LocalGregorianCalendar.getDayOfWeekDateOnOrBefore(firstDayOfWeek + 6,
 106.177 +                                                                                           internalGet(DAY_OF_WEEK));
 106.178                      }
 106.179                      // In lenient mode, we treat days of the previous
 106.180                      // months as a part of the specified
 106.181 @@ -2090,15 +2094,15 @@
 106.182                          dowim = 1;
 106.183                      }
 106.184                      if (dowim >= 0) {
 106.185 -                        fixedDate = jcal.getDayOfWeekDateOnOrBefore(fixedDate + (7 * dowim) - 1,
 106.186 -                                                                    dayOfWeek);
 106.187 +                        fixedDate = LocalGregorianCalendar.getDayOfWeekDateOnOrBefore(fixedDate + (7 * dowim) - 1,
 106.188 +                                                                                      dayOfWeek);
 106.189                      } else {
 106.190                          // Go to the first day of the next week of
 106.191                          // the specified week boundary.
 106.192                          int lastDate = monthLength(month, year) + (7 * (dowim + 1));
 106.193                          // Then, get the day of week date on or before the last date.
 106.194 -                        fixedDate = jcal.getDayOfWeekDateOnOrBefore(fixedDate + lastDate - 1,
 106.195 -                                                                    dayOfWeek);
 106.196 +                        fixedDate = LocalGregorianCalendar.getDayOfWeekDateOnOrBefore(fixedDate + lastDate - 1,
 106.197 +                                                                                      dayOfWeek);
 106.198                      }
 106.199                  }
 106.200              }
 106.201 @@ -2112,8 +2116,8 @@
 106.202                  fixedDate += internalGet(DAY_OF_YEAR);
 106.203                  fixedDate--;
 106.204              } else {
 106.205 -                long firstDayOfWeek = jcal.getDayOfWeekDateOnOrBefore(fixedDate + 6,
 106.206 -                                                                      getFirstDayOfWeek());
 106.207 +                long firstDayOfWeek = LocalGregorianCalendar.getDayOfWeekDateOnOrBefore(fixedDate + 6,
 106.208 +                                                                                        getFirstDayOfWeek());
 106.209                  // If we have enough days in the first week, then move
 106.210                  // to the previous week.
 106.211                  if ((firstDayOfWeek - fixedDate) >= getMinimalDaysInFirstWeek()) {
 106.212 @@ -2122,8 +2126,8 @@
 106.213                  if (isFieldSet(fieldMask, DAY_OF_WEEK)) {
 106.214                      int dayOfWeek = internalGet(DAY_OF_WEEK);
 106.215                      if (dayOfWeek != getFirstDayOfWeek()) {
 106.216 -                        firstDayOfWeek = jcal.getDayOfWeekDateOnOrBefore(firstDayOfWeek + 6,
 106.217 -                                                                         dayOfWeek);
 106.218 +                        firstDayOfWeek = LocalGregorianCalendar.getDayOfWeekDateOnOrBefore(firstDayOfWeek + 6,
 106.219 +                                                                                           dayOfWeek);
 106.220                      }
 106.221                  }
 106.222                  fixedDate = firstDayOfWeek + 7 * ((long)internalGet(WEEK_OF_YEAR) - 1);
 106.223 @@ -2140,7 +2144,7 @@
 106.224       * calculated. The date has to be in the cut-over year.
 106.225       * @param fixedDate the fixed date representation of the date
 106.226       */
 106.227 -    private final long getFixedDateJan1(LocalGregorianCalendar.Date date, long fixedDate) {
 106.228 +    private long getFixedDateJan1(LocalGregorianCalendar.Date date, long fixedDate) {
 106.229          Era era = date.getEra();
 106.230          if (date.getEra() != null && date.getYear() == 1) {
 106.231              for (int eraIndex = getEraIndex(date); eraIndex > 0; eraIndex--) {
 106.232 @@ -2154,7 +2158,7 @@
 106.233              }
 106.234          }
 106.235          CalendarDate d = gcal.newCalendarDate(TimeZone.NO_TIMEZONE);
 106.236 -        d.setDate(date.getNormalizedYear(), gcal.JANUARY, 1);
 106.237 +        d.setDate(date.getNormalizedYear(), Gregorian.JANUARY, 1);
 106.238          return gcal.getFixedDate(d);
 106.239      }
 106.240  
 106.241 @@ -2166,7 +2170,7 @@
 106.242       * calculated. The date must be in the era transition year.
 106.243       * @param fixedDate the fixed date representation of the date
 106.244       */
 106.245 -    private final long getFixedDateMonth1(LocalGregorianCalendar.Date date,
 106.246 +    private long getFixedDateMonth1(LocalGregorianCalendar.Date date,
 106.247                                            long fixedDate) {
 106.248          int eraIndex = getTransitionEraIndex(date);
 106.249          if (eraIndex != -1) {
 106.250 @@ -2187,7 +2191,7 @@
 106.251       *
 106.252       * @param fd the fixed date
 106.253       */
 106.254 -    private static final LocalGregorianCalendar.Date getCalendarDate(long fd) {
 106.255 +    private static LocalGregorianCalendar.Date getCalendarDate(long fd) {
 106.256          LocalGregorianCalendar.Date d = jcal.newCalendarDate(TimeZone.NO_TIMEZONE);
 106.257          jcal.getCalendarDateFromFixedDate(d, fd);
 106.258          return d;
 106.259 @@ -2199,7 +2203,7 @@
 106.260       *
 106.261       * @see #isLeapYear(int)
 106.262       */
 106.263 -    private final int monthLength(int month, int gregorianYear) {
 106.264 +    private int monthLength(int month, int gregorianYear) {
 106.265          return CalendarUtils.isGregorianLeapYear(gregorianYear) ?
 106.266              GregorianCalendar.LEAP_MONTH_LENGTH[month] : GregorianCalendar.MONTH_LENGTH[month];
 106.267      }
 106.268 @@ -2210,13 +2214,13 @@
 106.269       *
 106.270       * @see #isLeapYear(int)
 106.271       */
 106.272 -    private final int monthLength(int month) {
 106.273 +    private int monthLength(int month) {
 106.274          assert jdate.isNormalized();
 106.275          return jdate.isLeapYear() ?
 106.276              GregorianCalendar.LEAP_MONTH_LENGTH[month] : GregorianCalendar.MONTH_LENGTH[month];
 106.277      }
 106.278  
 106.279 -    private final int actualMonthLength() {
 106.280 +    private int actualMonthLength() {
 106.281          int length = jcal.getMonthLength(jdate);
 106.282          int eraIndex = getTransitionEraIndex(jdate);
 106.283          if (eraIndex == -1) {
 106.284 @@ -2239,7 +2243,7 @@
 106.285       * January 3, then the era index for Heisei is returned. If the
 106.286       * given date is not in any transition month, then -1 is returned.
 106.287       */
 106.288 -    private static final int getTransitionEraIndex(LocalGregorianCalendar.Date date) {
 106.289 +    private static int getTransitionEraIndex(LocalGregorianCalendar.Date date) {
 106.290          int eraIndex = getEraIndex(date);
 106.291          CalendarDate transitionDate = eras[eraIndex].getSinceDate();
 106.292          if (transitionDate.getYear() == date.getNormalizedYear() &&
 106.293 @@ -2256,7 +2260,7 @@
 106.294          return -1;
 106.295      }
 106.296  
 106.297 -    private final boolean isTransitionYear(int normalizedYear) {
 106.298 +    private boolean isTransitionYear(int normalizedYear) {
 106.299          for (int i = eras.length - 1; i > 0; i--) {
 106.300              int transitionYear = eras[i].getSinceDate().getYear();
 106.301              if (normalizedYear == transitionYear) {
 106.302 @@ -2269,7 +2273,7 @@
 106.303          return false;
 106.304      }
 106.305  
 106.306 -    private static final int getEraIndex(LocalGregorianCalendar.Date date) {
 106.307 +    private static int getEraIndex(LocalGregorianCalendar.Date date) {
 106.308          Era era = date.getEra();
 106.309          for (int i = eras.length - 1; i > 0; i--) {
 106.310              if (eras[i] == era) {
 106.311 @@ -2284,7 +2288,7 @@
 106.312       * in sync). Otherwise, a cloned object is returned after calling
 106.313       * complete() in lenient mode.
 106.314       */
 106.315 -    private final JapaneseImperialCalendar getNormalizedCalendar() {
 106.316 +    private JapaneseImperialCalendar getNormalizedCalendar() {
 106.317          JapaneseImperialCalendar jc;
 106.318          if (isFullyNormalized()) {
 106.319              jc = this;
 106.320 @@ -2303,7 +2307,7 @@
 106.321       * 3, we want it to go to Feb 28.  Adjustments which might run into this
 106.322       * problem call this method to retain the proper month.
 106.323       */
 106.324 -    private final void pinDayOfMonth(LocalGregorianCalendar.Date date) {
 106.325 +    private void pinDayOfMonth(LocalGregorianCalendar.Date date) {
 106.326          int year = date.getYear();
 106.327          int dom = date.getDayOfMonth();
 106.328          if (year != getMinimum(YEAR)) {
 106.329 @@ -2347,7 +2351,7 @@
 106.330      /**
 106.331       * Returns the new value after 'roll'ing the specified value and amount.
 106.332       */
 106.333 -    private static final int getRolledValue(int value, int amount, int min, int max) {
 106.334 +    private static int getRolledValue(int value, int amount, int min, int max) {
 106.335          assert value >= min && value <= max;
 106.336          int range = max - min + 1;
 106.337          amount %= range;
 106.338 @@ -2365,7 +2369,7 @@
 106.339       * Returns the ERA.  We need a special method for this because the
 106.340       * default ERA is the current era, but a zero (unset) ERA means before Meiji.
 106.341       */
 106.342 -    private final int internalGetEra() {
 106.343 +    private int internalGetEra() {
 106.344          return isSet(ERA) ? internalGet(ERA) : eras.length - 1;
 106.345      }
 106.346  
   107.1 --- a/src/share/classes/java/util/PropertyPermission.java	Tue Dec 06 16:31:58 2011 -0800
   107.2 +++ b/src/share/classes/java/util/PropertyPermission.java	Mon Dec 19 10:06:23 2011 -0800
   107.3 @@ -305,7 +305,7 @@
   107.4                  switch(a[i-matchlen]) {
   107.5                  case ',':
   107.6                      seencomma = true;
   107.7 -                    /*FALLTHROUGH*/
   107.8 +                    break;
   107.9                  case ' ': case '\r': case '\n':
  107.10                  case '\f': case '\t':
  107.11                      break;
  107.12 @@ -442,7 +442,7 @@
  107.13       * Key is property name; value is PropertyPermission.
  107.14       * Not serialized; see serialization section at end of class.
  107.15       */
  107.16 -    private transient Map perms;
  107.17 +    private transient Map<String, Permission> perms;
  107.18  
  107.19      /**
  107.20       * Boolean saying if "*" is in the collection.
  107.21 @@ -458,7 +458,7 @@
  107.22       */
  107.23  
  107.24      public PropertyPermissionCollection() {
  107.25 -        perms = new HashMap(32);     // Capacity for default policy
  107.26 +        perms = new HashMap<>(32);     // Capacity for default policy
  107.27          all_allowed = false;
  107.28      }
  107.29  
  107.30 @@ -593,7 +593,7 @@
  107.31       * @return an enumeration of all the PropertyPermission objects.
  107.32       */
  107.33  
  107.34 -    public Enumeration elements() {
  107.35 +    public Enumeration<Permission> elements() {
  107.36          // Convert Iterator of Map values into an Enumeration
  107.37          synchronized (this) {
  107.38              return Collections.enumeration(perms.values());
  107.39 @@ -633,7 +633,7 @@
  107.40          // Don't call out.defaultWriteObject()
  107.41  
  107.42          // Copy perms into a Hashtable
  107.43 -        Hashtable permissions = new Hashtable(perms.size()*2);
  107.44 +        Hashtable<String, Permission> permissions = new Hashtable<>(perms.size()*2);
  107.45          synchronized (this) {
  107.46              permissions.putAll(perms);
  107.47          }
  107.48 @@ -660,8 +660,10 @@
  107.49          all_allowed = gfields.get("all_allowed", false);
  107.50  
  107.51          // Get permissions
  107.52 -        Hashtable permissions = (Hashtable)gfields.get("permissions", null);
  107.53 -        perms = new HashMap(permissions.size()*2);
  107.54 +        @SuppressWarnings("unchecked")
  107.55 +        Hashtable<String, Permission> permissions =
  107.56 +            (Hashtable<String, Permission>)gfields.get("permissions", null);
  107.57 +        perms = new HashMap<>(permissions.size()*2);
  107.58          perms.putAll(permissions);
  107.59      }
  107.60  }
   108.1 --- a/src/share/classes/java/util/ResourceBundle.java	Tue Dec 06 16:31:58 2011 -0800
   108.2 +++ b/src/share/classes/java/util/ResourceBundle.java	Mon Dec 19 10:06:23 2011 -0800
   108.3 @@ -294,7 +294,7 @@
   108.4      /**
   108.5       * Queue for reference objects referring to class loaders or bundles.
   108.6       */
   108.7 -    private static final ReferenceQueue referenceQueue = new ReferenceQueue();
   108.8 +    private static final ReferenceQueue<Object> referenceQueue = new ReferenceQueue<>();
   108.9  
  108.10      /**
  108.11       * The parent bundle of this bundle.
  108.12 @@ -389,12 +389,13 @@
  108.13              if (parent != null) {
  108.14                  obj = parent.getObject(key);
  108.15              }
  108.16 -            if (obj == null)
  108.17 +            if (obj == null) {
  108.18                  throw new MissingResourceException("Can't find resource for bundle "
  108.19                                                     +this.getClass().getName()
  108.20                                                     +", key "+key,
  108.21                                                     this.getClass().getName(),
  108.22                                                     key);
  108.23 +            }
  108.24          }
  108.25          return obj;
  108.26      }
  108.27 @@ -418,7 +419,7 @@
  108.28      private static ClassLoader getLoader() {
  108.29          Class[] stack = getClassContext();
  108.30          /* Magic number 2 identifies our caller's caller */
  108.31 -        Class c = stack[2];
  108.32 +        Class<?> c = stack[2];
  108.33          ClassLoader cl = (c == null) ? null : c.getClassLoader();
  108.34          if (cl == null) {
  108.35              // When the caller's loader is the boot class loader, cl is null
  108.36 @@ -488,7 +489,7 @@
  108.37       * null, but the base name and the locale must have a non-null
  108.38       * value.
  108.39       */
  108.40 -    private static final class CacheKey implements Cloneable {
  108.41 +    private static class CacheKey implements Cloneable {
  108.42          // These three are the actual keys for lookup in Map.
  108.43          private String name;
  108.44          private Locale locale;
  108.45 @@ -583,8 +584,7 @@
  108.46                          // treat it as unequal
  108.47                          && (loader != null)
  108.48                          && (loader == otherEntry.loaderRef.get());
  108.49 -            } catch (NullPointerException e) {
  108.50 -            } catch (ClassCastException e) {
  108.51 +            } catch (    NullPointerException | ClassCastException e) {
  108.52              }
  108.53              return false;
  108.54          }
  108.55 @@ -669,11 +669,11 @@
  108.56       * garbage collected when nobody else is using them. The ResourceBundle
  108.57       * class has no reason to keep class loaders alive.
  108.58       */
  108.59 -    private static final class LoaderReference extends WeakReference<ClassLoader>
  108.60 -                                               implements CacheKeyReference {
  108.61 +    private static class LoaderReference extends WeakReference<ClassLoader>
  108.62 +                                         implements CacheKeyReference {
  108.63          private CacheKey cacheKey;
  108.64  
  108.65 -        LoaderReference(ClassLoader referent, ReferenceQueue q, CacheKey key) {
  108.66 +        LoaderReference(ClassLoader referent, ReferenceQueue<Object> q, CacheKey key) {
  108.67              super(referent, q);
  108.68              cacheKey = key;
  108.69          }
  108.70 @@ -687,11 +687,11 @@
  108.71       * References to bundles are soft references so that they can be garbage
  108.72       * collected when they have no hard references.
  108.73       */
  108.74 -    private static final class BundleReference extends SoftReference<ResourceBundle>
  108.75 -                                               implements CacheKeyReference {
  108.76 +    private static class BundleReference extends SoftReference<ResourceBundle>
  108.77 +                                         implements CacheKeyReference {
  108.78          private CacheKey cacheKey;
  108.79  
  108.80 -        BundleReference(ResourceBundle referent, ReferenceQueue q, CacheKey key) {
  108.81 +        BundleReference(ResourceBundle referent, ReferenceQueue<Object> q, CacheKey key) {
  108.82              super(referent, q);
  108.83              cacheKey = key;
  108.84          }
  108.85 @@ -1331,8 +1331,8 @@
  108.86       * Checks if the given <code>List</code> is not null, not empty,
  108.87       * not having null in its elements.
  108.88       */
  108.89 -    private static final boolean checkList(List a) {
  108.90 -        boolean valid = (a != null && a.size() != 0);
  108.91 +    private static boolean checkList(List<?> a) {
  108.92 +        boolean valid = (a != null && !a.isEmpty());
  108.93          if (valid) {
  108.94              int size = a.size();
  108.95              for (int i = 0; valid && i < size; i++) {
  108.96 @@ -1342,12 +1342,12 @@
  108.97          return valid;
  108.98      }
  108.99  
 108.100 -    private static final ResourceBundle findBundle(CacheKey cacheKey,
 108.101 -                                                   List<Locale> candidateLocales,
 108.102 -                                                   List<String> formats,
 108.103 -                                                   int index,
 108.104 -                                                   Control control,
 108.105 -                                                   ResourceBundle baseBundle) {
 108.106 +    private static ResourceBundle findBundle(CacheKey cacheKey,
 108.107 +                                             List<Locale> candidateLocales,
 108.108 +                                             List<String> formats,
 108.109 +                                             int index,
 108.110 +                                             Control control,
 108.111 +                                             ResourceBundle baseBundle) {
 108.112          Locale targetLocale = candidateLocales.get(index);
 108.113          ResourceBundle parent = null;
 108.114          if (index != candidateLocales.size() - 1) {
 108.115 @@ -1419,10 +1419,10 @@
 108.116          return parent;
 108.117      }
 108.118  
 108.119 -    private static final ResourceBundle loadBundle(CacheKey cacheKey,
 108.120 -                                                   List<String> formats,
 108.121 -                                                   Control control,
 108.122 -                                                   boolean reload) {
 108.123 +    private static ResourceBundle loadBundle(CacheKey cacheKey,
 108.124 +                                             List<String> formats,
 108.125 +                                             Control control,
 108.126 +                                             boolean reload) {
 108.127  
 108.128          // Here we actually load the bundle in the order of formats
 108.129          // specified by the getFormats() value.
 108.130 @@ -1459,7 +1459,7 @@
 108.131          return bundle;
 108.132      }
 108.133  
 108.134 -    private static final boolean isValidBundle(ResourceBundle bundle) {
 108.135 +    private static boolean isValidBundle(ResourceBundle bundle) {
 108.136          return bundle != null && bundle != NONEXISTENT_BUNDLE;
 108.137      }
 108.138  
 108.139 @@ -1467,7 +1467,7 @@
 108.140       * Determines whether any of resource bundles in the parent chain,
 108.141       * including the leaf, have expired.
 108.142       */
 108.143 -    private static final boolean hasValidParentChain(ResourceBundle bundle) {
 108.144 +    private static boolean hasValidParentChain(ResourceBundle bundle) {
 108.145          long now = System.currentTimeMillis();
 108.146          while (bundle != null) {
 108.147              if (bundle.expired) {
 108.148 @@ -1488,9 +1488,9 @@
 108.149      /**
 108.150       * Throw a MissingResourceException with proper message
 108.151       */
 108.152 -    private static final void throwMissingResourceException(String baseName,
 108.153 -                                                            Locale locale,
 108.154 -                                                            Throwable cause) {
 108.155 +    private static void throwMissingResourceException(String baseName,
 108.156 +                                                      Locale locale,
 108.157 +                                                      Throwable cause) {
 108.158          // If the cause is a MissingResourceException, avoid creating
 108.159          // a long chain. (6355009)
 108.160          if (cause instanceof MissingResourceException) {
 108.161 @@ -1513,8 +1513,8 @@
 108.162       * cache or its parent has expired. <code>bundle.expire</code> is true
 108.163       * upon return if the bundle in the cache has expired.
 108.164       */
 108.165 -    private static final ResourceBundle findBundleInCache(CacheKey cacheKey,
 108.166 -                                                          Control control) {
 108.167 +    private static ResourceBundle findBundleInCache(CacheKey cacheKey,
 108.168 +                                                    Control control) {
 108.169          BundleReference bundleRef = cacheList.get(cacheKey);
 108.170          if (bundleRef == null) {
 108.171              return null;
 108.172 @@ -1620,9 +1620,9 @@
 108.173       * the bundle before this call, the one found in the cache is
 108.174       * returned.
 108.175       */
 108.176 -    private static final ResourceBundle putBundleInCache(CacheKey cacheKey,
 108.177 -                                                         ResourceBundle bundle,
 108.178 -                                                         Control control) {
 108.179 +    private static ResourceBundle putBundleInCache(CacheKey cacheKey,
 108.180 +                                                   ResourceBundle bundle,
 108.181 +                                                   Control control) {
 108.182          setExpirationTime(cacheKey, control);
 108.183          if (cacheKey.expirationTime != Control.TTL_DONT_CACHE) {
 108.184              CacheKey key = (CacheKey) cacheKey.clone();
 108.185 @@ -1653,7 +1653,7 @@
 108.186          return bundle;
 108.187      }
 108.188  
 108.189 -    private static final void setExpirationTime(CacheKey cacheKey, Control control) {
 108.190 +    private static void setExpirationTime(CacheKey cacheKey, Control control) {
 108.191          long ttl = control.getTimeToLive(cacheKey.getName(),
 108.192                                           cacheKey.getLocale());
 108.193          if (ttl >= 0) {
 108.194 @@ -2350,18 +2350,27 @@
 108.195                      if (script.length() == 0 && region.length() > 0) {
 108.196                          // Supply script for users who want to use zh_Hans/zh_Hant
 108.197                          // as bundle names (recommended for Java7+)
 108.198 -                        if (region.equals("TW") || region.equals("HK") || region.equals("MO")) {
 108.199 +                        switch (region) {
 108.200 +                        case "TW":
 108.201 +                        case "HK":
 108.202 +                        case "MO":
 108.203                              script = "Hant";
 108.204 -                        } else if (region.equals("CN") || region.equals("SG")) {
 108.205 +                            break;
 108.206 +                        case "CN":
 108.207 +                        case "SG":
 108.208                              script = "Hans";
 108.209 +                            break;
 108.210                          }
 108.211                      } else if (script.length() > 0 && region.length() == 0) {
 108.212                          // Supply region(country) for users who still package Chinese
 108.213                          // bundles using old convension.
 108.214 -                        if (script.equals("Hans")) {
 108.215 +                        switch (script) {
 108.216 +                        case "Hans":
 108.217                              region = "CN";
 108.218 -                        } else if (script.equals("Hant")) {
 108.219 +                            break;
 108.220 +                        case "Hant":
 108.221                              region = "TW";
 108.222 +                            break;
 108.223                          }
 108.224                      }
 108.225                  }
 108.226 @@ -2562,6 +2571,7 @@
 108.227              ResourceBundle bundle = null;
 108.228              if (format.equals("java.class")) {
 108.229                  try {
 108.230 +                    @SuppressWarnings("unchecked")
 108.231                      Class<? extends ResourceBundle> bundleClass
 108.232                          = (Class<? extends ResourceBundle>)loader.loadClass(bundleName);
 108.233  
   109.1 --- a/src/share/classes/java/util/concurrent/atomic/AtomicBoolean.java	Tue Dec 06 16:31:58 2011 -0800
   109.2 +++ b/src/share/classes/java/util/concurrent/atomic/AtomicBoolean.java	Mon Dec 19 10:06:23 2011 -0800
   109.3 @@ -54,10 +54,10 @@
   109.4      private static final long valueOffset;
   109.5  
   109.6      static {
   109.7 -      try {
   109.8 -        valueOffset = unsafe.objectFieldOffset
   109.9 -            (AtomicBoolean.class.getDeclaredField("value"));
  109.10 -      } catch (Exception ex) { throw new Error(ex); }
  109.11 +        try {
  109.12 +            valueOffset = unsafe.objectFieldOffset
  109.13 +                (AtomicBoolean.class.getDeclaredField("value"));
  109.14 +        } catch (Exception ex) { throw new Error(ex); }
  109.15      }
  109.16  
  109.17      private volatile int value;
   110.1 --- a/src/share/classes/java/util/concurrent/atomic/AtomicInteger.java	Tue Dec 06 16:31:58 2011 -0800
   110.2 +++ b/src/share/classes/java/util/concurrent/atomic/AtomicInteger.java	Mon Dec 19 10:06:23 2011 -0800
   110.3 @@ -57,10 +57,10 @@
   110.4      private static final long valueOffset;
   110.5  
   110.6      static {
   110.7 -      try {
   110.8 -        valueOffset = unsafe.objectFieldOffset
   110.9 -            (AtomicInteger.class.getDeclaredField("value"));
  110.10 -      } catch (Exception ex) { throw new Error(ex); }
  110.11 +        try {
  110.12 +            valueOffset = unsafe.objectFieldOffset
  110.13 +                (AtomicInteger.class.getDeclaredField("value"));
  110.14 +        } catch (Exception ex) { throw new Error(ex); }
  110.15      }
  110.16  
  110.17      private volatile int value;
  110.18 @@ -247,8 +247,7 @@
  110.19  
  110.20  
  110.21      /**
  110.22 -     * Returns the value of this {@code AtomicInteger} as an
  110.23 -     * {@code int}.
  110.24 +     * Returns the value of this {@code AtomicInteger} as an {@code int}.
  110.25       */
  110.26      public int intValue() {
  110.27          return get();
   111.1 --- a/src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java	Tue Dec 06 16:31:58 2011 -0800
   111.2 +++ b/src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java	Mon Dec 19 10:06:23 2011 -0800
   111.3 @@ -35,7 +35,6 @@
   111.4  
   111.5  package java.util.concurrent.atomic;
   111.6  import sun.misc.Unsafe;
   111.7 -import java.util.*;
   111.8  
   111.9  /**
  111.10   * An {@code int} array in which elements may be updated atomically.
   112.1 --- a/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java	Tue Dec 06 16:31:58 2011 -0800
   112.2 +++ b/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java	Mon Dec 19 10:06:23 2011 -0800
   112.3 @@ -135,7 +135,6 @@
   112.4       */
   112.5      public abstract void lazySet(T obj, int newValue);
   112.6  
   112.7 -
   112.8      /**
   112.9       * Gets the current value held in the field of the given object managed
  112.10       * by this updater.
  112.11 @@ -266,11 +265,11 @@
  112.12          private static final Unsafe unsafe = Unsafe.getUnsafe();
  112.13          private final long offset;
  112.14          private final Class<T> tclass;
  112.15 -        private final Class cclass;
  112.16 +        private final Class<?> cclass;
  112.17  
  112.18          AtomicIntegerFieldUpdaterImpl(Class<T> tclass, String fieldName) {
  112.19              Field field = null;
  112.20 -            Class caller = null;
  112.21 +            Class<?> caller = null;
  112.22              int modifiers = 0;
  112.23              try {
  112.24                  field = tclass.getDeclaredField(fieldName);
  112.25 @@ -283,7 +282,7 @@
  112.26                  throw new RuntimeException(ex);
  112.27              }
  112.28  
  112.29 -            Class fieldt = field.getType();
  112.30 +            Class<?> fieldt = field.getType();
  112.31              if (fieldt != int.class)
  112.32                  throw new IllegalArgumentException("Must be integer type");
  112.33  
   113.1 --- a/src/share/classes/java/util/concurrent/atomic/AtomicLong.java	Tue Dec 06 16:31:58 2011 -0800
   113.2 +++ b/src/share/classes/java/util/concurrent/atomic/AtomicLong.java	Mon Dec 19 10:06:23 2011 -0800
   113.3 @@ -71,10 +71,10 @@
   113.4      private static native boolean VMSupportsCS8();
   113.5  
   113.6      static {
   113.7 -      try {
   113.8 -        valueOffset = unsafe.objectFieldOffset
   113.9 -            (AtomicLong.class.getDeclaredField("value"));
  113.10 -      } catch (Exception ex) { throw new Error(ex); }
  113.11 +        try {
  113.12 +            valueOffset = unsafe.objectFieldOffset
  113.13 +                (AtomicLong.class.getDeclaredField("value"));
  113.14 +        } catch (Exception ex) { throw new Error(ex); }
  113.15      }
  113.16  
  113.17      private volatile long value;
  113.18 @@ -270,8 +270,7 @@
  113.19      }
  113.20  
  113.21      /**
  113.22 -     * Returns the value of this {@code AtomicLong} as a {@code long}
  113.23 -     * value.
  113.24 +     * Returns the value of this {@code AtomicLong} as a {@code long}.
  113.25       */
  113.26      public long longValue() {
  113.27          return get();
  113.28 @@ -287,8 +286,8 @@
  113.29      }
  113.30  
  113.31      /**
  113.32 -     * Returns the value of this {@code AtomicLong} as a {@code
  113.33 -     * double} after a widening primitive conversion.
  113.34 +     * Returns the value of this {@code AtomicLong} as a {@code double}
  113.35 +     * after a widening primitive conversion.
  113.36       * @jls 5.1.2 Widening Primitive Conversions
  113.37       */
  113.38      public double doubleValue() {
   114.1 --- a/src/share/classes/java/util/concurrent/atomic/AtomicLongArray.java	Tue Dec 06 16:31:58 2011 -0800
   114.2 +++ b/src/share/classes/java/util/concurrent/atomic/AtomicLongArray.java	Mon Dec 19 10:06:23 2011 -0800
   114.3 @@ -35,7 +35,6 @@
   114.4  
   114.5  package java.util.concurrent.atomic;
   114.6  import sun.misc.Unsafe;
   114.7 -import java.util.*;
   114.8  
   114.9  /**
  114.10   * A {@code long} array in which elements may be updated atomically.
  114.11 @@ -136,7 +135,6 @@
  114.12          unsafe.putOrderedLong(array, checkedByteOffset(i), newValue);
  114.13      }
  114.14  
  114.15 -
  114.16      /**
  114.17       * Atomically sets the element at position {@code i} to the given value
  114.18       * and returns the old value.
   115.1 --- a/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java	Tue Dec 06 16:31:58 2011 -0800
   115.2 +++ b/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java	Mon Dec 19 10:06:23 2011 -0800
   115.3 @@ -265,11 +265,11 @@
   115.4          private static final Unsafe unsafe = Unsafe.getUnsafe();
   115.5          private final long offset;
   115.6          private final Class<T> tclass;
   115.7 -        private final Class cclass;
   115.8 +        private final Class<?> cclass;
   115.9  
  115.10          CASUpdater(Class<T> tclass, String fieldName) {
  115.11              Field field = null;
  115.12 -            Class caller = null;
  115.13 +            Class<?> caller = null;
  115.14              int modifiers = 0;
  115.15              try {
  115.16                  field = tclass.getDeclaredField(fieldName);
  115.17 @@ -282,7 +282,7 @@
  115.18                  throw new RuntimeException(ex);
  115.19              }
  115.20  
  115.21 -            Class fieldt = field.getType();
  115.22 +            Class<?> fieldt = field.getType();
  115.23              if (fieldt != long.class)
  115.24                  throw new IllegalArgumentException("Must be long type");
  115.25  
  115.26 @@ -348,11 +348,11 @@
  115.27          private static final Unsafe unsafe = Unsafe.getUnsafe();
  115.28          private final long offset;
  115.29          private final Class<T> tclass;
  115.30 -        private final Class cclass;
  115.31 +        private final Class<?> cclass;
  115.32  
  115.33          LockedUpdater(Class<T> tclass, String fieldName) {
  115.34              Field field = null;
  115.35 -            Class caller = null;
  115.36 +            Class<?> caller = null;
  115.37              int modifiers = 0;
  115.38              try {
  115.39                  field = tclass.getDeclaredField(fieldName);
  115.40 @@ -365,7 +365,7 @@
  115.41                  throw new RuntimeException(ex);
  115.42              }
  115.43  
  115.44 -            Class fieldt = field.getType();
  115.45 +            Class<?> fieldt = field.getType();
  115.46              if (fieldt != long.class)
  115.47                  throw new IllegalArgumentException("Must be long type");
  115.48  
   116.1 --- a/src/share/classes/java/util/concurrent/atomic/AtomicReference.java	Tue Dec 06 16:31:58 2011 -0800
   116.2 +++ b/src/share/classes/java/util/concurrent/atomic/AtomicReference.java	Mon Dec 19 10:06:23 2011 -0800
   116.3 @@ -51,10 +51,10 @@
   116.4      private static final long valueOffset;
   116.5  
   116.6      static {
   116.7 -      try {
   116.8 -        valueOffset = unsafe.objectFieldOffset
   116.9 -            (AtomicReference.class.getDeclaredField("value"));
  116.10 -      } catch (Exception ex) { throw new Error(ex); }
  116.11 +        try {
  116.12 +            valueOffset = unsafe.objectFieldOffset
  116.13 +                (AtomicReference.class.getDeclaredField("value"));
  116.14 +        } catch (Exception ex) { throw new Error(ex); }
  116.15      }
  116.16  
  116.17      private volatile V value;
   117.1 --- a/src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java	Tue Dec 06 16:31:58 2011 -0800
   117.2 +++ b/src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java	Mon Dec 19 10:06:23 2011 -0800
   117.3 @@ -113,6 +113,7 @@
   117.4          return getRaw(checkedByteOffset(i));
   117.5      }
   117.6  
   117.7 +    @SuppressWarnings("unchecked")
   117.8      private E getRaw(long offset) {
   117.9          return (E) unsafe.getObjectVolatile(array, offset);
  117.10      }
  117.11 @@ -150,7 +151,7 @@
  117.12      public final E getAndSet(int i, E newValue) {
  117.13          long offset = checkedByteOffset(i);
  117.14          while (true) {
  117.15 -            E current = (E) getRaw(offset);
  117.16 +            E current = getRaw(offset);
  117.17              if (compareAndSetRaw(offset, current, newValue))
  117.18                  return current;
  117.19          }
   118.1 --- a/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java	Tue Dec 06 16:31:58 2011 -0800
   118.2 +++ b/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java	Mon Dec 19 10:06:23 2011 -0800
   118.3 @@ -183,7 +183,7 @@
   118.4          private final long offset;
   118.5          private final Class<T> tclass;
   118.6          private final Class<V> vclass;
   118.7 -        private final Class cclass;
   118.8 +        private final Class<?> cclass;
   118.9  
  118.10          /*
  118.11           * Internal type checks within all update methods contain
  118.12 @@ -201,8 +201,8 @@
  118.13                                          Class<V> vclass,
  118.14                                          String fieldName) {
  118.15              Field field = null;
  118.16 -            Class fieldClass = null;
  118.17 -            Class caller = null;
  118.18 +            Class<?> fieldClass = null;
  118.19 +            Class<?> caller = null;
  118.20              int modifiers = 0;
  118.21              try {
  118.22                  field = tclass.getDeclaredField(fieldName);
  118.23 @@ -280,6 +280,7 @@
  118.24              unsafe.putOrderedObject(obj, offset, newValue);
  118.25          }
  118.26  
  118.27 +        @SuppressWarnings("unchecked")
  118.28          public V get(T obj) {
  118.29              if (obj == null || obj.getClass() != tclass || cclass != null)
  118.30                  targetCheck(obj);
   119.1 --- a/src/share/classes/java/util/concurrent/atomic/AtomicStampedReference.java	Tue Dec 06 16:31:58 2011 -0800
   119.2 +++ b/src/share/classes/java/util/concurrent/atomic/AtomicStampedReference.java	Mon Dec 19 10:06:23 2011 -0800
   119.3 @@ -155,7 +155,6 @@
   119.4               casPair(current, Pair.of(newReference, newStamp)));
   119.5      }
   119.6  
   119.7 -
   119.8      /**
   119.9       * Unconditionally sets the value of both the reference and stamp.
  119.10       *
   120.1 --- a/src/share/classes/java/util/jar/JarVerifier.java	Tue Dec 06 16:31:58 2011 -0800
   120.2 +++ b/src/share/classes/java/util/jar/JarVerifier.java	Mon Dec 19 10:06:23 2011 -0800
   120.3 @@ -90,7 +90,7 @@
   120.4      private Object csdomain = new Object();
   120.5  
   120.6      /** collect -DIGEST-MANIFEST values for blacklist */
   120.7 -    private List manifestDigests;
   120.8 +    private List<Object> manifestDigests;
   120.9  
  120.10      public JarVerifier(byte rawBytes[]) {
  120.11          manifestRawBytes = rawBytes;
  120.12 @@ -99,7 +99,7 @@
  120.13          sigFileData = new Hashtable(11);
  120.14          pendingBlocks = new ArrayList();
  120.15          baos = new ByteArrayOutputStream();
  120.16 -        manifestDigests = new ArrayList();
  120.17 +        manifestDigests = new ArrayList<>();
  120.18      }
  120.19  
  120.20      /**
  120.21 @@ -872,7 +872,7 @@
  120.22          eagerValidation = eager;
  120.23      }
  120.24  
  120.25 -    public synchronized List getManifestDigests() {
  120.26 +    public synchronized List<Object> getManifestDigests() {
  120.27          return Collections.unmodifiableList(manifestDigests);
  120.28      }
  120.29  
   121.1 --- a/src/share/classes/java/util/jar/JavaUtilJarAccessImpl.java	Tue Dec 06 16:31:58 2011 -0800
   121.2 +++ b/src/share/classes/java/util/jar/JavaUtilJarAccessImpl.java	Mon Dec 19 10:06:23 2011 -0800
   121.3 @@ -57,7 +57,7 @@
   121.4          jar.setEagerValidation(eager);
   121.5      }
   121.6  
   121.7 -    public List getManifestDigests(JarFile jar) {
   121.8 +    public List<Object> getManifestDigests(JarFile jar) {
   121.9          return jar.getManifestDigests();
  121.10      }
  121.11  }
   122.1 --- a/src/share/classes/java/util/zip/Adler32.java	Tue Dec 06 16:31:58 2011 -0800
   122.2 +++ b/src/share/classes/java/util/zip/Adler32.java	Mon Dec 19 10:06:23 2011 -0800
   122.3 @@ -25,16 +25,23 @@
   122.4  
   122.5  package java.util.zip;
   122.6  
   122.7 +import java.nio.ByteBuffer;
   122.8 +import sun.nio.ch.DirectBuffer;
   122.9 +
  122.10  /**
  122.11   * A class that can be used to compute the Adler-32 checksum of a data
  122.12   * stream. An Adler-32 checksum is almost as reliable as a CRC-32 but
  122.13   * can be computed much faster.
  122.14   *
  122.15 + * <p> Passing a {@code null} argument to a method in this class will cause
  122.16 + * a {@link NullPointerException} to be thrown.
  122.17 + *
  122.18   * @see         Checksum
  122.19   * @author      David Connelly
  122.20   */
  122.21  public
  122.22  class Adler32 implements Checksum {
  122.23 +
  122.24      private int adler = 1;
  122.25  
  122.26      /**
  122.27 @@ -75,6 +82,39 @@
  122.28          adler = updateBytes(adler, b, 0, b.length);
  122.29      }
  122.30  
  122.31 +
  122.32 +    /**
  122.33 +     * Updates the checksum with the bytes from the specified buffer.
  122.34 +     *
  122.35 +     * The checksum is updated using
  122.36 +     * buffer.{@link java.nio.Buffer#remaining() remaining()}
  122.37 +     * bytes starting at
  122.38 +     * buffer.{@link java.nio.Buffer#position() position()}
  122.39 +     * Upon return, the buffer's position will be updated to its
  122.40 +     * limit; its limit will not have been changed.
  122.41 +     *
  122.42 +     * @param buffer the ByteBuffer to update the checksum with
  122.43 +     * @since 1.8
  122.44 +     */
  122.45 +    public void update(ByteBuffer buffer) {
  122.46 +        int pos = buffer.position();
  122.47 +        int limit = buffer.limit();
  122.48 +        assert (pos <= limit);
  122.49 +        int rem = limit - pos;
  122.50 +        if (rem <= 0)
  122.51 +            return;
  122.52 +        if (buffer instanceof DirectBuffer) {
  122.53 +            adler = updateByteBuffer(adler, ((DirectBuffer)buffer).address(), pos, rem);
  122.54 +        } else if (buffer.hasArray()) {
  122.55 +            adler = updateBytes(adler, buffer.array(), pos + buffer.arrayOffset(), rem);
  122.56 +        } else {
  122.57 +            byte[] b = new byte[rem];
  122.58 +            buffer.get(b);
  122.59 +            adler = updateBytes(adler, b, 0, b.length);
  122.60 +        }
  122.61 +        buffer.position(limit);
  122.62 +    }
  122.63 +
  122.64      /**
  122.65       * Resets the checksum to initial value.
  122.66       */
  122.67 @@ -92,4 +132,6 @@
  122.68      private native static int update(int adler, int b);
  122.69      private native static int updateBytes(int adler, byte[] b, int off,
  122.70                                            int len);
  122.71 +    private native static int updateByteBuffer(int adler, long addr,
  122.72 +                                               int off, int len);
  122.73  }
   123.1 --- a/src/share/classes/java/util/zip/CRC32.java	Tue Dec 06 16:31:58 2011 -0800
   123.2 +++ b/src/share/classes/java/util/zip/CRC32.java	Mon Dec 19 10:06:23 2011 -0800
   123.3 @@ -25,9 +25,15 @@
   123.4  
   123.5  package java.util.zip;
   123.6  
   123.7 +import java.nio.ByteBuffer;
   123.8 +import sun.nio.ch.DirectBuffer;
   123.9 +
  123.10  /**
  123.11   * A class that can be used to compute the CRC-32 of a data stream.
  123.12   *
  123.13 + * <p> Passing a {@code null} argument to a method in this class will cause
  123.14 + * a {@link NullPointerException} to be thrown.
  123.15 + *
  123.16   * @see         Checksum
  123.17   * @author      David Connelly
  123.18   */
  123.19 @@ -75,6 +81,38 @@
  123.20      }
  123.21  
  123.22      /**
  123.23 +     * Updates the checksum with the bytes from the specified buffer.
  123.24 +     *
  123.25 +     * The checksum is updated using
  123.26 +     * buffer.{@link java.nio.Buffer#remaining() remaining()}
  123.27 +     * bytes starting at
  123.28 +     * buffer.{@link java.nio.Buffer#position() position()}
  123.29 +     * Upon return, the buffer's position will
  123.30 +     * be updated to its limit; its limit will not have been changed.
  123.31 +     *
  123.32 +     * @param buffer the ByteBuffer to update the checksum with
  123.33 +     * @since 1.8
  123.34 +     */
  123.35 +    public void update(ByteBuffer buffer) {
  123.36 +        int pos = buffer.position();
  123.37 +        int limit = buffer.limit();
  123.38 +        assert (pos <= limit);
  123.39 +        int rem = limit - pos;
  123.40 +        if (rem <= 0)
  123.41 +            return;
  123.42 +        if (buffer instanceof DirectBuffer) {
  123.43 +            crc = updateByteBuffer(crc, ((DirectBuffer)buffer).address(), pos, rem);
  123.44 +        } else if (buffer.hasArray()) {
  123.45 +            crc = updateBytes(crc, buffer.array(), pos + buffer.arrayOffset(), rem);
  123.46 +        } else {
  123.47 +            byte[] b = new byte[rem];
  123.48 +            buffer.get(b);
  123.49 +            crc = updateBytes(crc, b, 0, b.length);
  123.50 +        }
  123.51 +        buffer.position(limit);
  123.52 +    }
  123.53 +
  123.54 +    /**
  123.55       * Resets CRC-32 to initial value.
  123.56       */
  123.57      public void reset() {
  123.58 @@ -90,4 +128,7 @@
  123.59  
  123.60      private native static int update(int crc, int b);
  123.61      private native static int updateBytes(int crc, byte[] b, int off, int len);
  123.62 +
  123.63 +    private native static int updateByteBuffer(int adler, long addr,
  123.64 +                                               int off, int len);
  123.65  }
   124.1 --- a/src/share/classes/javax/script/ScriptEngineManager.java	Tue Dec 06 16:31:58 2011 -0800
   124.2 +++ b/src/share/classes/javax/script/ScriptEngineManager.java	Mon Dec 19 10:06:23 2011 -0800
   124.3 @@ -25,11 +25,9 @@
   124.4  
   124.5  package javax.script;
   124.6  import java.util.*;
   124.7 -import java.net.URL;
   124.8 -import java.io.*;
   124.9  import java.security.*;
  124.10 -import sun.misc.Service;
  124.11 -import sun.misc.ServiceConfigurationError;
  124.12 +import java.util.ServiceLoader;
  124.13 +import java.util.ServiceConfigurationError;
  124.14  import sun.reflect.Reflection;
  124.15  import sun.security.util.SecurityConstants;
  124.16  
  124.17 @@ -102,13 +100,15 @@
  124.18      }
  124.19  
  124.20      private void initEngines(final ClassLoader loader) {
  124.21 -        Iterator itr = null;
  124.22 +        Iterator<ScriptEngineFactory> itr = null;
  124.23          try {
  124.24 +            ServiceLoader<ScriptEngineFactory> sl;
  124.25              if (loader != null) {
  124.26 -                itr = Service.providers(ScriptEngineFactory.class, loader);
  124.27 +                sl = ServiceLoader.load(ScriptEngineFactory.class, loader);
  124.28              } else {
  124.29 -                itr = Service.installedProviders(ScriptEngineFactory.class);
  124.30 +                sl = ServiceLoader.loadInstalled(ScriptEngineFactory.class);
  124.31              }
  124.32 +            itr = sl.iterator();
  124.33          } catch (ServiceConfigurationError err) {
  124.34              System.err.println("Can't find ScriptEngineFactory providers: " +
  124.35                            err.getMessage());
  124.36 @@ -124,7 +124,7 @@
  124.37          try {
  124.38              while (itr.hasNext()) {
  124.39                  try {
  124.40 -                    ScriptEngineFactory fact = (ScriptEngineFactory) itr.next();
  124.41 +                    ScriptEngineFactory fact = itr.next();
  124.42                      engineSpis.add(fact);
  124.43                  } catch (ServiceConfigurationError err) {
  124.44                      System.err.println("ScriptEngineManager providers.next(): "
  124.45 @@ -441,7 +441,7 @@
  124.46      // Note that this code is same as ClassLoader.getCallerClassLoader().
  124.47      // But, that method is package private and hence we can't call here.
  124.48      private ClassLoader getCallerClassLoader() {
  124.49 -        Class caller = Reflection.getCallerClass(3);
  124.50 +        Class<?> caller = Reflection.getCallerClass(3);
  124.51          if (caller == null) {
  124.52              return null;
  124.53          }
   125.1 --- a/src/share/classes/javax/security/auth/kerberos/ServicePermission.java	Tue Dec 06 16:31:58 2011 -0800
   125.2 +++ b/src/share/classes/javax/security/auth/kerberos/ServicePermission.java	Mon Dec 19 10:06:23 2011 -0800
   125.3 @@ -369,7 +369,7 @@
   125.4                  switch(a[i-matchlen]) {
   125.5                  case ',':
   125.6                      seencomma = true;
   125.7 -                    /*FALLTHROUGH*/
   125.8 +                    break;
   125.9                  case ' ': case '\r': case '\n':
  125.10                  case '\f': case '\t':
  125.11                      break;
   126.1 --- a/src/share/classes/javax/sql/StatementEvent.java	Tue Dec 06 16:31:58 2011 -0800
   126.2 +++ b/src/share/classes/javax/sql/StatementEvent.java	Mon Dec 19 10:06:23 2011 -0800
   126.3 @@ -42,6 +42,7 @@
   126.4   */
   126.5  public class StatementEvent extends EventObject {
   126.6  
   126.7 +        static final long serialVersionUID = -8089573731826608315L;
   126.8          private SQLException            exception;
   126.9          private PreparedStatement       statement;
  126.10  
   127.1 --- a/src/share/classes/javax/sql/rowset/BaseRowSet.java	Tue Dec 06 16:31:58 2011 -0800
   127.2 +++ b/src/share/classes/javax/sql/rowset/BaseRowSet.java	Mon Dec 19 10:06:23 2011 -0800
   127.3 @@ -1,5 +1,5 @@
   127.4  /*
   127.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
   127.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
   127.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   127.8   *
   127.9   * This code is free software; you can redistribute it and/or modify it
  127.10 @@ -619,8 +619,8 @@
  127.11          checkforRowSetInterface();
  127.12          if (listeners.isEmpty() == false) {
  127.13              RowSetEvent event = new RowSetEvent((RowSet)this);
  127.14 -            for (Iterator i = listeners.iterator(); i.hasNext(); ) {
  127.15 -                ((RowSetListener)i.next()).cursorMoved(event);
  127.16 +            for (RowSetListener rsl : listeners) {
  127.17 +                rsl.cursorMoved(event);
  127.18              }
  127.19          }
  127.20      }
  127.21 @@ -644,8 +644,8 @@
  127.22          checkforRowSetInterface();
  127.23          if (listeners.isEmpty() == false) {
  127.24                  RowSetEvent event = new RowSetEvent((RowSet)this);
  127.25 -                for (Iterator i = listeners.iterator(); i.hasNext(); ) {
  127.26 -                        ((RowSetListener)i.next()).rowChanged(event);
  127.27 +                for (RowSetListener rsl : listeners) {
  127.28 +                    rsl.rowChanged(event);
  127.29                  }
  127.30          }
  127.31      }
  127.32 @@ -669,8 +669,8 @@
  127.33          checkforRowSetInterface();
  127.34          if (listeners.isEmpty() == false) {
  127.35                  RowSetEvent event = new RowSetEvent((RowSet)this);
  127.36 -                for (Iterator i = listeners.iterator(); i.hasNext(); ) {
  127.37 -                        ((RowSetListener)i.next()).rowSetChanged(event);
  127.38 +                for (RowSetListener rsl : listeners) {
  127.39 +                    rsl.rowSetChanged(event);
  127.40                  }
  127.41          }
  127.42  }
   128.1 --- a/src/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java	Tue Dec 06 16:31:58 2011 -0800
   128.2 +++ b/src/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java	Mon Dec 19 10:06:23 2011 -0800
   128.3 @@ -97,7 +97,7 @@
   128.4       */
   128.5      private void checkColType(int SQLType) throws SQLException {
   128.6          try {
   128.7 -            Class c = java.sql.Types.class;
   128.8 +            Class<?> c = java.sql.Types.class;
   128.9              Field[] publicFields = c.getFields();
  128.10              int fieldValue = 0;
  128.11              for (int i = 0; i < publicFields.length; i++) {
  128.12 @@ -1091,5 +1091,7 @@
  128.13           *@serial
  128.14           */
  128.15          public boolean writable = true;
  128.16 +
  128.17 +        static final long serialVersionUID = 5490834817919311283L;
  128.18      }
  128.19  }
   129.1 --- a/src/share/classes/javax/sql/rowset/RowSetProvider.java	Tue Dec 06 16:31:58 2011 -0800
   129.2 +++ b/src/share/classes/javax/sql/rowset/RowSetProvider.java	Mon Dec 19 10:06:23 2011 -0800
   129.3 @@ -181,7 +181,7 @@
   129.4  
   129.5          trace("***In newInstance()");
   129.6          try {
   129.7 -            Class providerClass = getFactoryClass(factoryClassName, cl, false);
   129.8 +            Class<?> providerClass = getFactoryClass(factoryClassName, cl, false);
   129.9              RowSetFactory instance = (RowSetFactory) providerClass.newInstance();
  129.10              if (debug) {
  129.11                  trace("Created new instance of " + providerClass +
  129.12 @@ -229,7 +229,7 @@
  129.13       * context class loader followed by the current class loader.
  129.14       *  @return The class which was loaded
  129.15       */
  129.16 -    static private Class getFactoryClass(String factoryClassName, ClassLoader cl,
  129.17 +    static private Class<?> getFactoryClass(String factoryClassName, ClassLoader cl,
  129.18              boolean doFallback) throws ClassNotFoundException {
  129.19          try {
  129.20              if (cl == null) {
   130.1 --- a/src/share/classes/javax/sql/rowset/serial/SQLInputImpl.java	Tue Dec 06 16:31:58 2011 -0800
   130.2 +++ b/src/share/classes/javax/sql/rowset/serial/SQLInputImpl.java	Mon Dec 19 10:06:23 2011 -0800
   130.3 @@ -1,5 +1,5 @@
   130.4  /*
   130.5 - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
   130.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
   130.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   130.8   *
   130.9   * This code is free software; you can redistribute it and/or modify it
  130.10 @@ -22,13 +22,9 @@
  130.11   * or visit www.oracle.com if you need additional information or have any
  130.12   * questions.
  130.13   */
  130.14 -
  130.15  package javax.sql.rowset.serial;
  130.16  
  130.17  import java.sql.*;
  130.18 -import javax.sql.*;
  130.19 -import java.io.*;
  130.20 -import java.math.*;
  130.21  import java.util.Map;
  130.22  
  130.23  /**
  130.24 @@ -91,7 +87,7 @@
  130.25       * <code>SQLData</code> (the Java class that defines how the UDT
  130.26       * will be mapped).
  130.27       */
  130.28 -    private Map map;
  130.29 +    private Map<String,Class<?>> map;
  130.30  
  130.31  
  130.32      /**
  130.33 @@ -279,7 +275,7 @@
  130.34  
  130.35          if (attrib == null) {
  130.36              lastValueWasNull = true;
  130.37 -            return (int)0;
  130.38 +            return 0;
  130.39          } else {
  130.40              lastValueWasNull = false;
  130.41              return attrib.intValue();
  130.42 @@ -591,7 +587,7 @@
  130.43       * position; or if there are no further values in the stream.
  130.44       */
  130.45      public Object readObject() throws SQLException {
  130.46 -        Object attrib = (Object)getNextAttribute();
  130.47 +        Object attrib = getNextAttribute();
  130.48  
  130.49          if (attrib == null) {
  130.50              lastValueWasNull = true;
  130.51 @@ -601,7 +597,7 @@
  130.52              if (attrib instanceof Struct) {
  130.53                  Struct s = (Struct)attrib;
  130.54                  // look up the class in the map
  130.55 -                Class c = (Class)map.get(s.getSQLTypeName());
  130.56 +                Class<?> c = map.get(s.getSQLTypeName());
  130.57                  if (c != null) {
  130.58                      // create new instance of the class
  130.59                      SQLData obj = null;
  130.60 @@ -620,10 +616,10 @@
  130.61                      SQLInputImpl sqlInput = new SQLInputImpl(attribs, map);
  130.62                      // read the values...
  130.63                      obj.readSQL(sqlInput, s.getSQLTypeName());
  130.64 -                    return (Object)obj;
  130.65 +                    return obj;
  130.66                  }
  130.67              }
  130.68 -            return (Object)attrib;
  130.69 +            return attrib;
  130.70          }
  130.71      }
  130.72  
   131.1 --- a/src/share/classes/javax/sql/rowset/serial/SQLOutputImpl.java	Tue Dec 06 16:31:58 2011 -0800
   131.2 +++ b/src/share/classes/javax/sql/rowset/serial/SQLOutputImpl.java	Mon Dec 19 10:06:23 2011 -0800
   131.3 @@ -60,6 +60,7 @@
   131.4       * A reference to an existing vector that
   131.5       * contains the attributes of a <code>Struct</code> object.
   131.6       */
   131.7 +    @SuppressWarnings("rawtypes")
   131.8      private Vector attribs;
   131.9  
  131.10      /**
  131.11 @@ -70,6 +71,7 @@
  131.12       * method will in turn call the appropriate
  131.13       * <code>SQLOutputImpl</code> writer methods.
  131.14       */
  131.15 +    @SuppressWarnings("rawtypes")
  131.16      private Map map;
  131.17  
  131.18      /**
  131.19 @@ -121,6 +123,7 @@
  131.20       *        use by a <code>SQLData</code> object attempting to write the attribute
  131.21       *        values of a UDT to the database.
  131.22       */
  131.23 +    @SuppressWarnings("unchecked")
  131.24      public void writeString(String x) throws SQLException {
  131.25          //System.out.println("Adding :"+x);
  131.26          attribs.add(x);
  131.27 @@ -136,6 +139,7 @@
  131.28       *        use by a <code>SQLData</code> object attempting to write the attribute
  131.29       *        values of a UDT to the database.
  131.30       */
  131.31 +    @SuppressWarnings("unchecked")
  131.32      public void writeBoolean(boolean x) throws SQLException {
  131.33          attribs.add(Boolean.valueOf(x));
  131.34      }
  131.35 @@ -150,6 +154,7 @@
  131.36       *        use by a <code>SQLData</code> object attempting to write the attribute
  131.37       *        values of a UDT to the database.
  131.38       */
  131.39 +    @SuppressWarnings("unchecked")
  131.40      public void writeByte(byte x) throws SQLException {
  131.41          attribs.add(Byte.valueOf(x));
  131.42      }
  131.43 @@ -164,6 +169,7 @@
  131.44       *        use by a <code>SQLData</code> object attempting to write the attribute
  131.45       *        values of a UDT to the database.
  131.46       */
  131.47 +    @SuppressWarnings("unchecked")
  131.48      public void writeShort(short x) throws SQLException {
  131.49          attribs.add(Short.valueOf(x));
  131.50      }
  131.51 @@ -178,6 +184,7 @@
  131.52       *        use by a <code>SQLData</code> object attempting to write the attribute
  131.53       *        values of a UDT to the database.
  131.54       */
  131.55 +    @SuppressWarnings("unchecked")
  131.56      public void writeInt(int x) throws SQLException {
  131.57          attribs.add(Integer.valueOf(x));
  131.58      }
  131.59 @@ -192,6 +199,7 @@
  131.60       *        use by a <code>SQLData</code> object attempting to write the attribute
  131.61       *        values of a UDT to the database.
  131.62       */
  131.63 +    @SuppressWarnings("unchecked")
  131.64      public void writeLong(long x) throws SQLException {
  131.65          attribs.add(Long.valueOf(x));
  131.66      }
  131.67 @@ -206,6 +214,7 @@
  131.68       *        use by a <code>SQLData</code> object attempting to write the attribute
  131.69       *        values of a UDT to the database.
  131.70       */
  131.71 +    @SuppressWarnings("unchecked")
  131.72      public void writeFloat(float x) throws SQLException {
  131.73          attribs.add(new Float(x));
  131.74      }
  131.75 @@ -220,6 +229,7 @@
  131.76       *        use by a <code>SQLData</code> object attempting to write the attribute
  131.77       *        values of a UDT to the database.
  131.78       */
  131.79 +    @SuppressWarnings("unchecked")
  131.80      public void writeDouble(double x) throws SQLException{
  131.81          attribs.add(new Double(x));
  131.82      }
  131.83 @@ -234,6 +244,7 @@
  131.84       *        use by a <code>SQLData</code> object attempting to write the attribute
  131.85       *        values of a UDT to the database.
  131.86       */
  131.87 +    @SuppressWarnings("unchecked")
  131.88      public void writeBigDecimal(java.math.BigDecimal x) throws SQLException{
  131.89          attribs.add(x);
  131.90      }
  131.91 @@ -249,6 +260,7 @@
  131.92       *        use by a <code>SQLData</code> object attempting to write the attribute
  131.93       *        values of a UDT to the database.
  131.94       */
  131.95 +    @SuppressWarnings("unchecked")
  131.96      public void writeBytes(byte[] x) throws SQLException {
  131.97          attribs.add(x);
  131.98      }
  131.99 @@ -263,6 +275,7 @@
 131.100       *        use by a <code>SQLData</code> object attempting to write the attribute
 131.101       *        values of a UDT to the database.
 131.102       */
 131.103 +    @SuppressWarnings("unchecked")
 131.104      public void writeDate(java.sql.Date x) throws SQLException {
 131.105          attribs.add(x);
 131.106      }
 131.107 @@ -277,6 +290,7 @@
 131.108       *        use by a <code>SQLData</code> object attempting to write the attribute
 131.109       *        values of a UDT to the database.
 131.110       */
 131.111 +    @SuppressWarnings("unchecked")
 131.112      public void writeTime(java.sql.Time x) throws SQLException {
 131.113          attribs.add(x);
 131.114      }
 131.115 @@ -291,6 +305,7 @@
 131.116       *        use by a <code>SQLData</code> object attempting to write the attribute
 131.117       *        values of a UDT to the database.
 131.118       */
 131.119 +    @SuppressWarnings("unchecked")
 131.120      public void writeTimestamp(java.sql.Timestamp x) throws SQLException {
 131.121          attribs.add(x);
 131.122      }
 131.123 @@ -305,6 +320,7 @@
 131.124       *        use by a <code>SQLData</code> object attempting to write the attribute
 131.125       *        values of a UDT to the database.
 131.126       */
 131.127 +    @SuppressWarnings("unchecked")
 131.128      public void writeCharacterStream(java.io.Reader x) throws SQLException {
 131.129           BufferedReader bufReader = new BufferedReader(x);
 131.130           try {
 131.131 @@ -334,6 +350,7 @@
 131.132       *        use by a <code>SQLData</code> object attempting to write the attribute
 131.133       *        values of a UDT to the database.
 131.134       */
 131.135 +    @SuppressWarnings("unchecked")
 131.136      public void writeAsciiStream(java.io.InputStream x) throws SQLException {
 131.137           BufferedReader bufReader = new BufferedReader(new InputStreamReader(x));
 131.138           try {
 131.139 @@ -363,6 +380,7 @@
 131.140       *        use by a <code>SQLData</code> object attempting to write the attribute
 131.141       *        values of a UDT to the database.
 131.142       */
 131.143 +    @SuppressWarnings("unchecked")
 131.144      public void writeBinaryStream(java.io.InputStream x) throws SQLException {
 131.145           BufferedReader bufReader = new BufferedReader(new InputStreamReader(x));
 131.146           try {
 131.147 @@ -414,6 +432,7 @@
 131.148       *        use by a <code>SQLData</code> object attempting to write the attribute
 131.149       *        values of a UDT to the database.
 131.150       */
 131.151 +    @SuppressWarnings("unchecked")
 131.152      public void writeObject(SQLData x) throws SQLException {
 131.153  
 131.154          /*
 131.155 @@ -434,7 +453,7 @@
 131.156           * the name of this class otherwise we don't know
 131.157           * what to re-instantiate during readSQL()
 131.158           */
 131.159 -        attribs.add(new SerialStruct((SQLData)x, map));
 131.160 +        attribs.add(new SerialStruct(x, map));
 131.161      }
 131.162  
 131.163      /**
 131.164 @@ -448,6 +467,7 @@
 131.165       *        use by a <code>SQLData</code> object attempting to write the attribute
 131.166       *        values of a UDT to the database.
 131.167       */
 131.168 +    @SuppressWarnings("unchecked")
 131.169      public void writeRef(Ref x) throws SQLException {
 131.170          if (x == null) {
 131.171              attribs.add(x);
 131.172 @@ -467,6 +487,7 @@
 131.173       *        use by a <code>SQLData</code> object attempting to write the attribute
 131.174       *        values of a UDT to the database.
 131.175       */
 131.176 +    @SuppressWarnings("unchecked")
 131.177      public void writeBlob(Blob x) throws SQLException {
 131.178          if (x == null) {
 131.179              attribs.add(x);
 131.180 @@ -486,6 +507,7 @@
 131.181       *        use by a <code>SQLData</code> object attempting to write the attribute
 131.182       *        values of a UDT to the database.
 131.183       */
 131.184 +    @SuppressWarnings("unchecked")
 131.185      public void writeClob(Clob x) throws SQLException {
 131.186          if (x == null) {
 131.187              attribs.add(x);
 131.188 @@ -511,6 +533,7 @@
 131.189       *        use by a <code>SQLData</code> object attempting to write the attribute
 131.190       *        values of a UDT to the database.
 131.191       */
 131.192 +    @SuppressWarnings("unchecked")
 131.193      public void writeStruct(Struct x) throws SQLException {
 131.194          SerialStruct s = new SerialStruct(x,map);;
 131.195          attribs.add(s);
 131.196 @@ -528,6 +551,7 @@
 131.197       *        use by a <code>SQLData</code> object attempting to write the attribute
 131.198       *        values of a UDT to the database.
 131.199       */
 131.200 +    @SuppressWarnings("unchecked")
 131.201      public void writeArray(Array x) throws SQLException {
 131.202          if (x == null) {
 131.203              attribs.add(x);
 131.204 @@ -547,6 +571,7 @@
 131.205       *        use by a <code>SQLData</code> object attempting to write the attribute
 131.206       *        values of a UDT to the database.
 131.207       */
 131.208 +    @SuppressWarnings("unchecked")
 131.209      public void writeURL(java.net.URL url) throws SQLException {
 131.210          if (url == null) {
 131.211              attribs.add(url);
 131.212 @@ -570,6 +595,7 @@
 131.213     * @exception SQLException if a database access error occurs
 131.214     * @since 1.6
 131.215     */
 131.216 +   @SuppressWarnings("unchecked")
 131.217     public void writeNString(String x) throws SQLException {
 131.218          throw new UnsupportedOperationException("Operation not supported");
 131.219      }
 131.220 @@ -583,6 +609,7 @@
 131.221     * @exception SQLException if a database access error occurs
 131.222     * @since 1.6
 131.223     */
 131.224 +   @SuppressWarnings("unchecked")
 131.225     public void writeNClob(NClob x) throws SQLException {
 131.226          throw new UnsupportedOperationException("Operation not supported");
 131.227      }
 131.228 @@ -597,6 +624,7 @@
 131.229     * @exception SQLException if a database access error occurs
 131.230     * @since 1.6
 131.231     */
 131.232 +   @SuppressWarnings("unchecked")
 131.233     public void writeRowId(RowId x) throws SQLException {
 131.234          throw new UnsupportedOperationException("Operation not supported");
 131.235      }
 131.236 @@ -611,6 +639,7 @@
 131.237     * @exception SQLException if a database access error occurs
 131.238     * @since 1.6
 131.239     */
 131.240 +   @SuppressWarnings("unchecked")
 131.241     public void writeSQLXML(SQLXML x) throws SQLException {
 131.242          throw new UnsupportedOperationException("Operation not supported");
 131.243      }
   132.1 --- a/src/share/classes/javax/sql/rowset/serial/SerialArray.java	Tue Dec 06 16:31:58 2011 -0800
   132.2 +++ b/src/share/classes/javax/sql/rowset/serial/SerialArray.java	Mon Dec 19 10:06:23 2011 -0800
   132.3 @@ -186,10 +186,8 @@
   132.4  
   132.5              case java.sql.Types.JAVA_OBJECT:
   132.6                  for (int i = 0; i < len; i++) {
   132.7 -                elements[i] = new SerialJavaObject((Object)elements[i]);
   132.8 +                elements[i] = new SerialJavaObject(elements[i]);
   132.9              }
  132.10 -        default:
  132.11 -            ;
  132.12          }
  132.13    }
  132.14  
  132.15 @@ -285,11 +283,10 @@
  132.16  
  132.17          case java.sql.Types.JAVA_OBJECT:
  132.18              for (int i = 0; i < len; i++) {
  132.19 -                elements[i] = new SerialJavaObject((Object)elements[i]);
  132.20 +                elements[i] = new SerialJavaObject(elements[i]);
  132.21              }
  132.22 +            break;
  132.23  
  132.24 -        default:
  132.25 -            ;
  132.26          }
  132.27  
  132.28  
   133.1 --- a/src/share/classes/javax/sql/rowset/serial/SerialBlob.java	Tue Dec 06 16:31:58 2011 -0800
   133.2 +++ b/src/share/classes/javax/sql/rowset/serial/SerialBlob.java	Mon Dec 19 10:06:23 2011 -0800
   133.3 @@ -207,7 +207,7 @@
   133.4       */
   133.5      public java.io.InputStream getBinaryStream() throws SerialException {
   133.6           InputStream stream = new ByteArrayInputStream(buf);
   133.7 -         return (java.io.InputStream)stream;
   133.8 +         return stream;
   133.9      }
  133.10  
  133.11      /**
   134.1 --- a/src/share/classes/javax/sql/rowset/serial/SerialJavaObject.java	Tue Dec 06 16:31:58 2011 -0800
   134.2 +++ b/src/share/classes/javax/sql/rowset/serial/SerialJavaObject.java	Mon Dec 19 10:06:23 2011 -0800
   134.3 @@ -142,14 +142,14 @@
   134.4       * object. When there are multiple warnings, each warning is chained to the
   134.5       * previous warning.
   134.6       */
   134.7 -    java.util.Vector chain;
   134.8 +    java.util.Vector<RowSetWarning> chain;
   134.9  
  134.10      /**
  134.11       * Registers the given warning.
  134.12       */
  134.13      private void setWarning(RowSetWarning e) {
  134.14          if (chain == null) {
  134.15 -            chain = new java.util.Vector();
  134.16 +            chain = new java.util.Vector<>();
  134.17          }
  134.18          chain.add(e);
  134.19      }
   135.1 --- a/src/share/classes/javax/sql/rowset/serial/SerialRef.java	Tue Dec 06 16:31:58 2011 -0800
   135.2 +++ b/src/share/classes/javax/sql/rowset/serial/SerialRef.java	Mon Dec 19 10:06:23 2011 -0800
   135.3 @@ -109,7 +109,7 @@
   135.4      public Object getObject(java.util.Map<String,Class<?>> map)
   135.5          throws SerialException
   135.6      {
   135.7 -        map = new Hashtable(map);
   135.8 +        map = new Hashtable<String, Class<?>>(map);
   135.9          if (object != null) {
  135.10              return map.get(object);
  135.11          } else {
   136.1 --- a/src/share/classes/javax/sql/rowset/serial/SerialStruct.java	Tue Dec 06 16:31:58 2011 -0800
   136.2 +++ b/src/share/classes/javax/sql/rowset/serial/SerialStruct.java	Mon Dec 19 10:06:23 2011 -0800
   136.3 @@ -139,7 +139,7 @@
   136.4          //set the type name
   136.5          SQLTypeName = in.getSQLTypeName();
   136.6  
   136.7 -        Vector tmp = new Vector();
   136.8 +        Vector<Object> tmp = new Vector<>();
   136.9          in.writeSQL(new SQLOutputImpl(tmp, map));
  136.10          attribs = tmp.toArray();
  136.11  
  136.12 @@ -220,7 +220,7 @@
  136.13       *        that defines how the UDT is to be mapped
  136.14       * @throws SerialException if an error occurs
  136.15       */
  136.16 -    private void mapToSerial(Map map) throws SerialException {
  136.17 +    private void mapToSerial(Map<String,Class<?>> map) throws SerialException {
  136.18  
  136.19          try {
  136.20  
   137.1 --- a/src/share/classes/javax/sql/rowset/spi/SyncFactory.java	Tue Dec 06 16:31:58 2011 -0800
   137.2 +++ b/src/share/classes/javax/sql/rowset/spi/SyncFactory.java	Mon Dec 19 10:06:23 2011 -0800
   137.3 @@ -257,7 +257,7 @@
   137.4       * See section 2.0 of the class comment for <code>SyncFactory</code> for an
   137.5       * explanation of how a provider can be added to this registry.
   137.6       */
   137.7 -    private static Hashtable implementations;
   137.8 +    private static Hashtable<String, SyncProvider> implementations;
   137.9      /**
  137.10       * Internal sync object used to maintain the SPI as a singleton
  137.11       */
  137.12 @@ -344,7 +344,7 @@
  137.13          Properties properties = new Properties();
  137.14  
  137.15          if (implementations == null) {
  137.16 -            implementations = new Hashtable();
  137.17 +            implementations = new Hashtable<>();
  137.18  
  137.19              try {
  137.20  
  137.21 @@ -445,7 +445,7 @@
  137.22          String key = null;
  137.23          String[] propertyNames = null;
  137.24  
  137.25 -        for (Enumeration e = p.propertyNames(); e.hasMoreElements();) {
  137.26 +        for (Enumeration<?> e = p.propertyNames(); e.hasMoreElements();) {
  137.27  
  137.28              String str = (String) e.nextElement();
  137.29  
  137.30 @@ -541,7 +541,7 @@
  137.31          }
  137.32  
  137.33          // Attempt to invoke classname from registered SyncProvider list
  137.34 -        Class c = null;
  137.35 +        Class<?> c = null;
  137.36          try {
  137.37              ClassLoader cl = Thread.currentThread().getContextClassLoader();
  137.38  
  137.39 @@ -740,7 +740,7 @@
  137.40       */
  137.41      private static Properties parseJNDIContext() throws NamingException {
  137.42  
  137.43 -        NamingEnumeration bindings = ic.listBindings("");
  137.44 +        NamingEnumeration<?> bindings = ic.listBindings("");
  137.45          Properties properties = new Properties();
  137.46  
  137.47          // Hunt one level below context for available SyncProvider objects
  137.48 @@ -755,7 +755,7 @@
  137.49       * scan the current context using a re-entrant call to this method until all
  137.50       * bindings have been enumerated.
  137.51       */
  137.52 -    private static void enumerateBindings(NamingEnumeration bindings,
  137.53 +    private static void enumerateBindings(NamingEnumeration<?> bindings,
  137.54              Properties properties) throws NamingException {
  137.55  
  137.56          boolean syncProviderObj = false; // move to parameters ?
   138.1 --- a/src/share/classes/javax/swing/text/DefaultCaret.java	Tue Dec 06 16:31:58 2011 -0800
   138.2 +++ b/src/share/classes/javax/swing/text/DefaultCaret.java	Mon Dec 19 10:06:23 2011 -0800
   138.3 @@ -403,6 +403,10 @@
   138.4       * @see MouseListener#mouseClicked
   138.5       */
   138.6      public void mouseClicked(MouseEvent e) {
   138.7 +        if (getComponent() == null) {
   138.8 +            return;
   138.9 +        }
  138.10 +
  138.11          int nclicks = SwingUtilities2.getAdjustedClickCount(getComponent(), e);
  138.12  
  138.13          if (! e.isConsumed()) {
   139.1 --- a/src/share/classes/sun/awt/im/CompositionArea.java	Tue Dec 06 16:31:58 2011 -0800
   139.2 +++ b/src/share/classes/sun/awt/im/CompositionArea.java	Mon Dec 19 10:06:23 2011 -0800
   139.3 @@ -313,4 +313,7 @@
   139.4            compositionWindow.pack();
   139.5      }
   139.6  
   139.7 +    // Proclaim serial compatibility with 1.7.0
   139.8 +    private static final long serialVersionUID = -1057247068746557444L;
   139.9 +
  139.10  }
   140.1 --- a/src/share/classes/sun/awt/im/CompositionAreaHandler.java	Tue Dec 06 16:31:58 2011 -0800
   140.2 +++ b/src/share/classes/sun/awt/im/CompositionAreaHandler.java	Mon Dec 19 10:06:23 2011 -0800
   140.3 @@ -257,7 +257,7 @@
   140.4       */
   140.5      InputMethodRequests getClientInputMethodRequests() {
   140.6          if (clientComponent != null) {
   140.7 -            return (InputMethodRequests) clientComponent.getInputMethodRequests();
   140.8 +            return clientComponent.getInputMethodRequests();
   140.9          }
  140.10  
  140.11          return null;
   141.1 --- a/src/share/classes/sun/awt/im/InputContext.java	Tue Dec 06 16:31:58 2011 -0800
   141.2 +++ b/src/share/classes/sun/awt/im/InputContext.java	Mon Dec 19 10:06:23 2011 -0800
   141.3 @@ -79,7 +79,7 @@
   141.4      private boolean inputMethodCreationFailed;
   141.5  
   141.6      // holding bin for previously used input method instances, but not the current one
   141.7 -    private HashMap usedInputMethods;
   141.8 +    private HashMap<InputMethodLocator, InputMethod> usedInputMethods;
   141.9  
  141.10      // the current client component is kept until the user focusses on a different
  141.11      // client component served by the same input context. When that happens, we call
  141.12 @@ -106,7 +106,7 @@
  141.13      // cache location notification
  141.14      private Rectangle clientWindowLocation = null;
  141.15      // holding the state of clientWindowNotificationEnabled of only non-current input methods
  141.16 -    private HashMap perInputMethodState;
  141.17 +    private HashMap<InputMethod, Boolean> perInputMethodState;
  141.18  
  141.19      // Input Method selection hot key stuff
  141.20      private static AWTKeyStroke inputMethodSelectionKey;
  141.21 @@ -219,6 +219,7 @@
  141.22      /**
  141.23       * @see java.awt.im.InputContext#dispatchEvent
  141.24       */
  141.25 +    @SuppressWarnings("fallthrough")
  141.26      public void dispatchEvent(AWTEvent event) {
  141.27  
  141.28          if (event instanceof InputMethodEvent) {
  141.29 @@ -394,7 +395,7 @@
  141.30              isInputMethodActive = true;
  141.31  
  141.32              if (perInputMethodState != null) {
  141.33 -                Boolean state = (Boolean) perInputMethodState.remove(inputMethod);
  141.34 +                Boolean state = perInputMethodState.remove(inputMethod);
  141.35                  if (state != null) {
  141.36                      clientWindowNotificationEnabled = state.booleanValue();
  141.37                  }
  141.38 @@ -549,10 +550,10 @@
  141.39  
  141.40              // keep the input method instance around for future use
  141.41              if (usedInputMethods == null) {
  141.42 -                usedInputMethods = new HashMap(5);
  141.43 +                usedInputMethods = new HashMap<>(5);
  141.44              }
  141.45              if (perInputMethodState == null) {
  141.46 -                perInputMethodState = new HashMap(5);
  141.47 +                perInputMethodState = new HashMap<>(5);
  141.48              }
  141.49              usedInputMethods.put(inputMethodLocator.deriveLocator(null), inputMethod);
  141.50              perInputMethodState.put(inputMethod,
  141.51 @@ -689,10 +690,10 @@
  141.52          }
  141.53          inputMethodLocator = null;
  141.54          if (usedInputMethods != null && !usedInputMethods.isEmpty()) {
  141.55 -            Iterator iterator = usedInputMethods.values().iterator();
  141.56 +            Iterator<InputMethod> iterator = usedInputMethods.values().iterator();
  141.57              usedInputMethods = null;
  141.58              while (iterator.hasNext()) {
  141.59 -                ((InputMethod) iterator.next()).dispose();
  141.60 +                iterator.next().dispose();
  141.61              }
  141.62          }
  141.63  
  141.64 @@ -830,13 +831,13 @@
  141.65  
  141.66          // see whether we have a previously used input method
  141.67          if (usedInputMethods != null) {
  141.68 -            inputMethodInstance = (InputMethod) usedInputMethods.remove(locator.deriveLocator(null));
  141.69 +            inputMethodInstance = usedInputMethods.remove(locator.deriveLocator(null));
  141.70              if (inputMethodInstance != null) {
  141.71                  if (locale != null) {
  141.72                      inputMethodInstance.setLocale(locale);
  141.73                  }
  141.74                  inputMethodInstance.setCharacterSubsets(characterSubsets);
  141.75 -                Boolean state = (Boolean) perInputMethodState.remove(inputMethodInstance);
  141.76 +                Boolean state = perInputMethodState.remove(inputMethodInstance);
  141.77                  if (state != null) {
  141.78                      enableClientWindowNotification(inputMethodInstance, state.booleanValue());
  141.79                  }
  141.80 @@ -919,7 +920,7 @@
  141.81          // method becomes the current one.
  141.82          if (requester != inputMethod) {
  141.83              if (perInputMethodState == null) {
  141.84 -                perInputMethodState = new HashMap(5);
  141.85 +                perInputMethodState = new HashMap<>(5);
  141.86              }
  141.87              perInputMethodState.put(requester, Boolean.valueOf(enable));
  141.88              return;
  141.89 @@ -1029,7 +1030,7 @@
  141.90       * Initializes the input method selection key definition in preference trees
  141.91       */
  141.92      private void initializeInputMethodSelectionKey() {
  141.93 -        AccessController.doPrivileged(new PrivilegedAction() {
  141.94 +        AccessController.doPrivileged(new PrivilegedAction<Object>() {
  141.95              public Object run() {
  141.96                  // Look in user's tree
  141.97                  Preferences root = Preferences.userRoot();
   142.1 --- a/src/share/classes/sun/awt/im/InputMethodContext.java	Tue Dec 06 16:31:58 2011 -0800
   142.2 +++ b/src/share/classes/sun/awt/im/InputMethodContext.java	Mon Dec 19 10:06:23 2011 -0800
   142.3 @@ -72,12 +72,11 @@
   142.4      static {
   142.5          // check whether we should use below-the-spot input
   142.6          // get property from command line
   142.7 -        String inputStyle = (String) AccessController.doPrivileged
   142.8 +        String inputStyle = AccessController.doPrivileged
   142.9                  (new GetPropertyAction("java.awt.im.style", null));
  142.10          // get property from awt.properties file
  142.11          if (inputStyle == null) {
  142.12 -            inputStyle = Toolkit.getDefaultToolkit().
  142.13 -                    getProperty("java.awt.im.style", null);
  142.14 +            inputStyle = Toolkit.getProperty("java.awt.im.style", null);
  142.15          }
  142.16          belowTheSpotInputRequested = "below-the-spot".equals(inputStyle);
  142.17      }
   143.1 --- a/src/share/classes/sun/awt/im/InputMethodJFrame.java	Tue Dec 06 16:31:58 2011 -0800
   143.2 +++ b/src/share/classes/sun/awt/im/InputMethodJFrame.java	Mon Dec 19 10:06:23 2011 -0800
   143.3 @@ -68,4 +68,7 @@
   143.4              return super.getInputContext();
   143.5          }
   143.6      }
   143.7 +
   143.8 +    // Proclaim serial compatibility with 1.7.0
   143.9 +    private static final long serialVersionUID = -4705856747771842549L;
  143.10  }
   144.1 --- a/src/share/classes/sun/awt/im/InputMethodManager.java	Tue Dec 06 16:31:58 2011 -0800
   144.2 +++ b/src/share/classes/sun/awt/im/InputMethodManager.java	Mon Dec 19 10:06:23 2011 -0800
   144.3 @@ -270,7 +270,7 @@
   144.4      // IM preference stuff
   144.5      private static final String preferredIMNode = "/sun/awt/im/preferredInputMethod";
   144.6      private static final String descriptorKey = "descriptor";
   144.7 -    private Hashtable preferredLocatorCache = new Hashtable();
   144.8 +    private Hashtable<String, InputMethodLocator> preferredLocatorCache = new Hashtable<>();
   144.9      private Preferences userRoot;
  144.10  
  144.11      ExecutableInputMethodManager() {
  144.12 @@ -430,7 +430,7 @@
  144.13          synchronized (javaInputMethodLocatorList) {
  144.14              javaInputMethodLocatorList.clear();
  144.15              try {
  144.16 -                AccessController.doPrivileged(new PrivilegedExceptionAction() {
  144.17 +                AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
  144.18                      public Object run() {
  144.19                          for (InputMethodDescriptor descriptor :
  144.20                              ServiceLoader.loadInstalled(InputMethodDescriptor.class)) {
  144.21 @@ -611,7 +611,7 @@
  144.22          }
  144.23  
  144.24          // look for the cached preference first.
  144.25 -        preferredLocator = (InputMethodLocator)preferredLocatorCache.get(locale.toString().intern());
  144.26 +        preferredLocator = preferredLocatorCache.get(locale.toString().intern());
  144.27          if (preferredLocator != null) {
  144.28              return preferredLocator;
  144.29          }
  144.30 @@ -767,8 +767,8 @@
  144.31      }
  144.32  
  144.33      private Preferences getUserRoot() {
  144.34 -        return (Preferences)AccessController.doPrivileged(new PrivilegedAction() {
  144.35 -            public Object run() {
  144.36 +        return AccessController.doPrivileged(new PrivilegedAction<Preferences>() {
  144.37 +            public Preferences run() {
  144.38                  return Preferences.userRoot();
  144.39              }
  144.40          });
   145.1 --- a/src/share/classes/sun/awt/im/SimpleInputMethodWindow.java	Tue Dec 06 16:31:58 2011 -0800
   145.2 +++ b/src/share/classes/sun/awt/im/SimpleInputMethodWindow.java	Mon Dec 19 10:06:23 2011 -0800
   145.3 @@ -61,4 +61,7 @@
   145.4              return super.getInputContext();
   145.5          }
   145.6      }
   145.7 +
   145.8 +    // Proclaim serial compatibility with 1.7.0
   145.9 +    private static final long serialVersionUID = 5093376647036461555L;
  145.10  }
   146.1 --- a/src/share/classes/sun/awt/image/BufImgSurfaceData.java	Tue Dec 06 16:31:58 2011 -0800
   146.2 +++ b/src/share/classes/sun/awt/image/BufImgSurfaceData.java	Mon Dec 19 10:06:23 2011 -0800
   146.3 @@ -323,8 +323,8 @@
   146.4      }
   146.5  
   146.6      public RenderLoops getRenderLoops(SunGraphics2D sg2d) {
   146.7 -        if (sg2d.paintState <= sg2d.PAINT_ALPHACOLOR &&
   146.8 -            sg2d.compositeState <= sg2d.COMP_ISCOPY)
   146.9 +        if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR &&
  146.10 +            sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY)
  146.11          {
  146.12              return solidloops;
  146.13          }
   147.1 --- a/src/share/classes/sun/instrument/InstrumentationImpl.java	Tue Dec 06 16:31:58 2011 -0800
   147.2 +++ b/src/share/classes/sun/instrument/InstrumentationImpl.java	Mon Dec 19 10:06:23 2011 -0800
   147.3 @@ -136,7 +136,7 @@
   147.4      }
   147.5  
   147.6      public void
   147.7 -    retransformClasses(Class<?>[] classes) {
   147.8 +    retransformClasses(Class<?>... classes) {
   147.9          if (!isRetransformClassesSupported()) {
  147.10              throw new UnsupportedOperationException(
  147.11                "retransformClasses is not supported in this environment");
  147.12 @@ -150,7 +150,7 @@
  147.13      }
  147.14  
  147.15      public void
  147.16 -    redefineClasses(ClassDefinition[]   definitions)
  147.17 +    redefineClasses(ClassDefinition...  definitions)
  147.18              throws  ClassNotFoundException {
  147.19          if (!isRedefineClassesSupported()) {
  147.20              throw new UnsupportedOperationException("redefineClasses is not supported in this environment");
  147.21 @@ -321,7 +321,7 @@
  147.22  
  147.23          try {
  147.24              m = javaAgentClass.getDeclaredMethod( methodname,
  147.25 -                                 new Class[] {
  147.26 +                                 new Class<?>[] {
  147.27                                       String.class,
  147.28                                       java.lang.instrument.Instrumentation.class
  147.29                                   }
  147.30 @@ -336,7 +336,7 @@
  147.31              // now try the declared 1-arg method
  147.32              try {
  147.33                  m = javaAgentClass.getDeclaredMethod(methodname,
  147.34 -                                                 new Class[] { String.class });
  147.35 +                                                 new Class<?>[] { String.class });
  147.36              } catch (NoSuchMethodException x) {
  147.37                  // ignore this exception because we'll try
  147.38                  // two arg inheritance next
  147.39 @@ -347,7 +347,7 @@
  147.40              // now try the inherited 2-arg method
  147.41              try {
  147.42                  m = javaAgentClass.getMethod( methodname,
  147.43 -                                 new Class[] {
  147.44 +                                 new Class<?>[] {
  147.45                                       String.class,
  147.46                                       java.lang.instrument.Instrumentation.class
  147.47                                   }
  147.48 @@ -363,7 +363,7 @@
  147.49              // finally try the inherited 1-arg method
  147.50              try {
  147.51                  m = javaAgentClass.getMethod(methodname,
  147.52 -                                             new Class[] { String.class });
  147.53 +                                             new Class<?>[] { String.class });
  147.54              } catch (NoSuchMethodException x) {
  147.55                  // none of the methods exists so we throw the
  147.56                  // first NoSuchMethodException as per 5.0
  147.57 @@ -411,7 +411,7 @@
  147.58      private byte[]
  147.59      transform(  ClassLoader         loader,
  147.60                  String              classname,
  147.61 -                Class               classBeingRedefined,
  147.62 +                Class<?>            classBeingRedefined,
  147.63                  ProtectionDomain    protectionDomain,
  147.64                  byte[]              classfileBuffer,
  147.65                  boolean             isRetransformer) {
   148.1 --- a/src/share/classes/sun/instrument/TransformerManager.java	Tue Dec 06 16:31:58 2011 -0800
   148.2 +++ b/src/share/classes/sun/instrument/TransformerManager.java	Mon Dec 19 10:06:23 2011 -0800
   148.3 @@ -169,7 +169,7 @@
   148.4      public byte[]
   148.5      transform(  ClassLoader         loader,
   148.6                  String              classname,
   148.7 -                Class               classBeingRedefined,
   148.8 +                Class<?>            classBeingRedefined,
   148.9                  ProtectionDomain    protectionDomain,
  148.10                  byte[]              classfileBuffer) {
  148.11          boolean someoneTouchedTheBytecode = false;
   149.1 --- a/src/share/classes/sun/java2d/SunGraphics2D.java	Tue Dec 06 16:31:58 2011 -0800
   149.2 +++ b/src/share/classes/sun/java2d/SunGraphics2D.java	Mon Dec 19 10:06:23 2011 -0800
   149.3 @@ -941,7 +941,7 @@
   149.4                  }
   149.5              }
   149.6          }
   149.7 -        Class paintClass = paint.getClass();
   149.8 +        Class<? extends Paint> paintClass = paint.getClass();
   149.9          if (paintClass == GradientPaint.class) {
  149.10              paintState = PAINT_GRADIENT;
  149.11          } else if (paintClass == LinearGradientPaint.class) {
  149.12 @@ -1280,7 +1280,7 @@
  149.13          interpolationHint = -1;
  149.14          interpolationType = AffineTransformOp.TYPE_NEAREST_NEIGHBOR;
  149.15          boolean customHintPresent = false;
  149.16 -        Iterator iter = hints.keySet().iterator();
  149.17 +        Iterator<?> iter = hints.keySet().iterator();
  149.18          while (iter.hasNext()) {
  149.19              Object key = iter.next();
  149.20              if (key == SunHints.KEY_RENDERING ||
  149.21 @@ -1311,7 +1311,7 @@
  149.22       */
  149.23      public void addRenderingHints(Map<?,?> hints) {
  149.24          boolean customHintPresent = false;
  149.25 -        Iterator iter = hints.keySet().iterator();
  149.26 +        Iterator<?> iter = hints.keySet().iterator();
  149.27          while (iter.hasNext()) {
  149.28              Object key = iter.next();
  149.29              if (key == SunHints.KEY_RENDERING ||
   150.1 --- a/src/share/classes/sun/java2d/SurfaceData.java	Tue Dec 06 16:31:58 2011 -0800
   150.2 +++ b/src/share/classes/sun/java2d/SurfaceData.java	Mon Dec 19 10:06:23 2011 -0800
   150.3 @@ -520,8 +520,8 @@
   150.4      }
   150.5  
   150.6      public boolean canRenderParallelograms(SunGraphics2D sg2d) {
   150.7 -        if (sg2d.paintState <= sg2d.PAINT_ALPHACOLOR) {
   150.8 -            if (sg2d.compositeState == sg2d.COMP_XOR) {
   150.9 +        if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR) {
  150.10 +            if (sg2d.compositeState == SunGraphics2D.COMP_XOR) {
  150.11                  if (havePgramXORLoop == LOOP_UNKNOWN) {
  150.12                      FillParallelogram loop =
  150.13                          FillParallelogram.locate(SurfaceType.AnyColor,
  150.14 @@ -531,9 +531,9 @@
  150.15                          (loop != null) ? LOOP_FOUND : LOOP_NOTFOUND;
  150.16                  }
  150.17                  return havePgramXORLoop == LOOP_FOUND;
  150.18 -            } else if (sg2d.compositeState <= sg2d.COMP_ISCOPY &&
  150.19 +            } else if (sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY &&
  150.20                         sg2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON &&
  150.21 -                       sg2d.clipState != sg2d.CLIP_SHAPE)
  150.22 +                       sg2d.clipState != SunGraphics2D.CLIP_SHAPE)
  150.23              {
  150.24                  if (havePgramSolidLoop == LOOP_UNKNOWN) {
  150.25                      FillParallelogram loop =
  150.26 @@ -551,8 +551,8 @@
  150.27  
  150.28      public void validatePipe(SunGraphics2D sg2d) {
  150.29          sg2d.imagepipe = imagepipe;
  150.30 -        if (sg2d.compositeState == sg2d.COMP_XOR) {
  150.31 -            if (sg2d.paintState > sg2d.PAINT_ALPHACOLOR) {
  150.32 +        if (sg2d.compositeState == SunGraphics2D.COMP_XOR) {
  150.33 +            if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR) {
  150.34                  sg2d.drawpipe = paintViaShape;
  150.35                  sg2d.fillpipe = paintViaShape;
  150.36                  sg2d.shapepipe = paintShape;
  150.37 @@ -576,7 +576,7 @@
  150.38                      converter = colorViaShape;
  150.39                      sg2d.shapepipe = colorPrimitives;
  150.40                  }
  150.41 -                if (sg2d.clipState == sg2d.CLIP_SHAPE) {
  150.42 +                if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
  150.43                      sg2d.drawpipe = converter;
  150.44                      sg2d.fillpipe = converter;
  150.45                      // REMIND: We should not be changing text strategies
  150.46 @@ -589,11 +589,11 @@
  150.47                      // which is not defined for XOR.
  150.48                      sg2d.textpipe = outlineTextRenderer;
  150.49                  } else {
  150.50 -                    if (sg2d.transformState >= sg2d.TRANSFORM_TRANSLATESCALE) {
  150.51 +                    if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
  150.52                          sg2d.drawpipe = converter;
  150.53                          sg2d.fillpipe = converter;
  150.54                      } else {
  150.55 -                        if (sg2d.strokeState != sg2d.STROKE_THIN) {
  150.56 +                        if (sg2d.strokeState != SunGraphics2D.STROKE_THIN) {
  150.57                              sg2d.drawpipe = converter;
  150.58                          } else {
  150.59                              sg2d.drawpipe = colorPrimitives;
  150.60 @@ -604,9 +604,9 @@
  150.61                  }
  150.62                  // assert(sg2d.surfaceData == this);
  150.63              }
  150.64 -        } else if (sg2d.compositeState == sg2d.COMP_CUSTOM) {
  150.65 +        } else if (sg2d.compositeState == SunGraphics2D.COMP_CUSTOM) {
  150.66              if (sg2d.antialiasHint == SunHints.INTVAL_ANTIALIAS_ON) {
  150.67 -                if (sg2d.clipState == sg2d.CLIP_SHAPE) {
  150.68 +                if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
  150.69                      sg2d.drawpipe = AAClipCompViaShape;
  150.70                      sg2d.fillpipe = AAClipCompViaShape;
  150.71                      sg2d.shapepipe = AAClipCompViaShape;
  150.72 @@ -621,7 +621,7 @@
  150.73                  sg2d.drawpipe = compViaShape;
  150.74                  sg2d.fillpipe = compViaShape;
  150.75                  sg2d.shapepipe = compShape;
  150.76 -                if (sg2d.clipState == sg2d.CLIP_SHAPE) {
  150.77 +                if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
  150.78                      sg2d.textpipe = clipCompText;
  150.79                  } else {
  150.80                      sg2d.textpipe = compText;
  150.81 @@ -631,7 +631,7 @@
  150.82              sg2d.alphafill = getMaskFill(sg2d);
  150.83              // assert(sg2d.surfaceData == this);
  150.84              if (sg2d.alphafill != null) {
  150.85 -                if (sg2d.clipState == sg2d.CLIP_SHAPE) {
  150.86 +                if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
  150.87                      sg2d.drawpipe = AAClipColorViaShape;
  150.88                      sg2d.fillpipe = AAClipColorViaShape;
  150.89                      sg2d.shapepipe = AAClipColorViaShape;
  150.90 @@ -644,8 +644,8 @@
  150.91                      sg2d.drawpipe = converter;
  150.92                      sg2d.fillpipe = converter;
  150.93                      sg2d.shapepipe = converter;
  150.94 -                    if (sg2d.paintState > sg2d.PAINT_ALPHACOLOR ||
  150.95 -                        sg2d.compositeState > sg2d.COMP_ISCOPY)
  150.96 +                    if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR ||
  150.97 +                        sg2d.compositeState > SunGraphics2D.COMP_ISCOPY)
  150.98                      {
  150.99                          sg2d.textpipe = colorText;
 150.100                      } else {
 150.101 @@ -653,7 +653,7 @@
 150.102                      }
 150.103                  }
 150.104              } else {
 150.105 -                if (sg2d.clipState == sg2d.CLIP_SHAPE) {
 150.106 +                if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
 150.107                      sg2d.drawpipe = AAClipPaintViaShape;
 150.108                      sg2d.fillpipe = AAClipPaintViaShape;
 150.109                      sg2d.shapepipe = AAClipPaintViaShape;
 150.110 @@ -665,9 +665,9 @@
 150.111                      sg2d.textpipe = paintText;
 150.112                  }
 150.113              }
 150.114 -        } else if (sg2d.paintState > sg2d.PAINT_ALPHACOLOR ||
 150.115 -                   sg2d.compositeState > sg2d.COMP_ISCOPY ||
 150.116 -                   sg2d.clipState == sg2d.CLIP_SHAPE)
 150.117 +        } else if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR ||
 150.118 +                   sg2d.compositeState > SunGraphics2D.COMP_ISCOPY ||
 150.119 +                   sg2d.clipState == SunGraphics2D.CLIP_SHAPE)
 150.120          {
 150.121              sg2d.drawpipe = paintViaShape;
 150.122              sg2d.fillpipe = paintViaShape;
 150.123 @@ -675,13 +675,13 @@
 150.124              sg2d.alphafill = getMaskFill(sg2d);
 150.125              // assert(sg2d.surfaceData == this);
 150.126              if (sg2d.alphafill != null) {
 150.127 -                if (sg2d.clipState == sg2d.CLIP_SHAPE) {
 150.128 +                if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
 150.129                      sg2d.textpipe = clipColorText;
 150.130                  } else {
 150.131                      sg2d.textpipe = colorText;
 150.132                  }
 150.133              } else {
 150.134 -                if (sg2d.clipState == sg2d.CLIP_SHAPE) {
 150.135 +                if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
 150.136                      sg2d.textpipe = clipPaintText;
 150.137                  } else {
 150.138                      sg2d.textpipe = paintText;
 150.139 @@ -700,11 +700,11 @@
 150.140                  converter = colorViaShape;
 150.141                  sg2d.shapepipe = colorPrimitives;
 150.142              }
 150.143 -            if (sg2d.transformState >= sg2d.TRANSFORM_TRANSLATESCALE) {
 150.144 +            if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
 150.145                  sg2d.drawpipe = converter;
 150.146                  sg2d.fillpipe = converter;
 150.147              } else {
 150.148 -                if (sg2d.strokeState != sg2d.STROKE_THIN) {
 150.149 +                if (sg2d.strokeState != SunGraphics2D.STROKE_THIN) {
 150.150                      sg2d.drawpipe = converter;
 150.151                  } else {
 150.152                      sg2d.drawpipe = colorPrimitives;
 150.153 @@ -817,7 +817,7 @@
 150.154  
 150.155      private static CompositeType getFillCompositeType(SunGraphics2D sg2d) {
 150.156          CompositeType compType = sg2d.imageComp;
 150.157 -        if (sg2d.compositeState == sg2d.COMP_ISCOPY) {
 150.158 +        if (sg2d.compositeState == SunGraphics2D.COMP_ISCOPY) {
 150.159              if (compType == CompositeType.SrcOverNoEa) {
 150.160                  compType = CompositeType.OpaqueSrcOverNoEa;
 150.161              } else {
   151.1 --- a/src/share/classes/sun/java2d/SurfaceDataProxy.java	Tue Dec 06 16:31:58 2011 -0800
   151.2 +++ b/src/share/classes/sun/java2d/SurfaceDataProxy.java	Mon Dec 19 10:06:23 2011 -0800
   151.3 @@ -71,7 +71,7 @@
   151.4  
   151.5      static {
   151.6          cachingAllowed = true;
   151.7 -        String manimg = (String)AccessController.doPrivileged(
   151.8 +        String manimg = AccessController.doPrivileged(
   151.9              new GetPropertyAction("sun.java2d.managedimages"));
  151.10          if (manimg != null && manimg.equals("false")) {
  151.11              cachingAllowed = false;
  151.12 @@ -79,7 +79,7 @@
  151.13          }
  151.14  
  151.15          defaultThreshold = 1;
  151.16 -        String num = (String)AccessController.doPrivileged(
  151.17 +        String num = AccessController.doPrivileged(
  151.18              new GetPropertyAction("sun.java2d.accthreshold"));
  151.19          if (num != null) {
  151.20              try {
   152.1 --- a/src/share/classes/sun/java2d/loops/GraphicsPrimitive.java	Tue Dec 06 16:31:58 2011 -0800
   152.2 +++ b/src/share/classes/sun/java2d/loops/GraphicsPrimitive.java	Mon Dec 19 10:06:23 2011 -0800
   152.3 @@ -328,7 +328,7 @@
   152.4  
   152.5      static {
   152.6          GetPropertyAction gpa = new GetPropertyAction("sun.java2d.trace");
   152.7 -        String trace = (String)AccessController.doPrivileged(gpa);
   152.8 +        String trace = AccessController.doPrivileged(gpa);
   152.9          if (trace != null) {
  152.10              boolean verbose = false;
  152.11              int traceflags = 0;
  152.12 @@ -391,9 +391,9 @@
  152.13      private static PrintStream getTraceOutputFile() {
  152.14          if (traceout == null) {
  152.15              if (tracefile != null) {
  152.16 -                Object o =
  152.17 -                    AccessController.doPrivileged(new PrivilegedAction() {
  152.18 -                        public Object run() {
  152.19 +                FileOutputStream o = AccessController.doPrivileged(
  152.20 +                    new PrivilegedAction<FileOutputStream>() {
  152.21 +                        public FileOutputStream run() {
  152.22                              try {
  152.23                                  return new FileOutputStream(tracefile);
  152.24                              } catch (FileNotFoundException e) {
  152.25 @@ -402,7 +402,7 @@
  152.26                          }
  152.27                      });
  152.28                  if (o != null) {
  152.29 -                    traceout = new PrintStream((OutputStream) o);
  152.30 +                    traceout = new PrintStream(o);
  152.31                  } else {
  152.32                      traceout = System.err;
  152.33                  }
  152.34 @@ -415,8 +415,8 @@
  152.35  
  152.36      public static class TraceReporter extends Thread {
  152.37          public static void setShutdownHook() {
  152.38 -            AccessController.doPrivileged(new PrivilegedAction() {
  152.39 -                public Object run() {
  152.40 +            AccessController.doPrivileged(new PrivilegedAction<Void>() {
  152.41 +                public Void run() {
  152.42                      TraceReporter t = new TraceReporter();
  152.43                      t.setContextClassLoader(null);
  152.44                      Runtime.getRuntime().addShutdownHook(t);
   153.1 --- a/src/share/classes/sun/java2d/loops/SurfaceType.java	Tue Dec 06 16:31:58 2011 -0800
   153.2 +++ b/src/share/classes/sun/java2d/loops/SurfaceType.java	Mon Dec 19 10:06:23 2011 -0800
   153.3 @@ -56,7 +56,7 @@
   153.4  public final class SurfaceType {
   153.5  
   153.6      private static int unusedUID = 1;
   153.7 -    private static HashMap surfaceUIDMap = new HashMap(100);
   153.8 +    private static HashMap<String, Integer> surfaceUIDMap = new HashMap<>(100);
   153.9  
  153.10      /*
  153.11       * CONSTANTS USED BY ALL PRIMITIVES TO DESCRIBE THE SURFACES
  153.12 @@ -402,7 +402,7 @@
  153.13      }
  153.14  
  153.15      public synchronized static final int makeUniqueID(String desc) {
  153.16 -        Integer i = (Integer) surfaceUIDMap.get((Object) desc);
  153.17 +        Integer i = surfaceUIDMap.get(desc);
  153.18  
  153.19          if (i == null) {
  153.20              if (unusedUID > 255) {
   154.1 --- a/src/share/classes/sun/java2d/opengl/OGLBufImgOps.java	Tue Dec 06 16:31:58 2011 -0800
   154.2 +++ b/src/share/classes/sun/java2d/opengl/OGLBufImgOps.java	Mon Dec 19 10:06:23 2011 -0800
   154.3 @@ -78,12 +78,12 @@
   154.4          }
   154.5  
   154.6          SurfaceData srcData =
   154.7 -            dstData.getSourceSurfaceData(img, sg.TRANSFORM_ISIDENT,
   154.8 +            dstData.getSourceSurfaceData(img, SunGraphics2D.TRANSFORM_ISIDENT,
   154.9                                           CompositeType.SrcOver, null);
  154.10          if (!(srcData instanceof OGLSurfaceData)) {
  154.11              // REMIND: this hack tries to ensure that we have a cached texture
  154.12              srcData =
  154.13 -                dstData.getSourceSurfaceData(img, sg.TRANSFORM_ISIDENT,
  154.14 +                dstData.getSourceSurfaceData(img, SunGraphics2D.TRANSFORM_ISIDENT,
  154.15                                               CompositeType.SrcOver, null);
  154.16              if (!(srcData instanceof OGLSurfaceData)) {
  154.17                  return false;
   155.1 --- a/src/share/classes/sun/java2d/opengl/OGLDrawImage.java	Tue Dec 06 16:31:58 2011 -0800
   155.2 +++ b/src/share/classes/sun/java2d/opengl/OGLDrawImage.java	Mon Dec 19 10:06:23 2011 -0800
   155.3 @@ -60,7 +60,7 @@
   155.4              SurfaceData dstData = sg.surfaceData;
   155.5              SurfaceData srcData =
   155.6                  dstData.getSourceSurfaceData(img,
   155.7 -                                             sg.TRANSFORM_GENERIC,
   155.8 +                                             SunGraphics2D.TRANSFORM_GENERIC,
   155.9                                               sg.imageComp,
  155.10                                               bgColor);
  155.11  
   156.1 --- a/src/share/classes/sun/java2d/opengl/OGLPaints.java	Tue Dec 06 16:31:58 2011 -0800
   156.2 +++ b/src/share/classes/sun/java2d/opengl/OGLPaints.java	Mon Dec 19 10:06:23 2011 -0800
   156.3 @@ -123,14 +123,16 @@
   156.4              }
   156.5  
   156.6              SurfaceData srcData =
   156.7 -                dstData.getSourceSurfaceData(bi, sg2d.TRANSFORM_ISIDENT,
   156.8 +                dstData.getSourceSurfaceData(bi,
   156.9 +                                             SunGraphics2D.TRANSFORM_ISIDENT,
  156.10                                               CompositeType.SrcOver, null);
  156.11              if (!(srcData instanceof OGLSurfaceData)) {
  156.12                  // REMIND: this is a hack that attempts to cache the system
  156.13                  //         memory image from the TexturePaint instance into an
  156.14                  //         OpenGL texture...
  156.15                  srcData =
  156.16 -                    dstData.getSourceSurfaceData(bi, sg2d.TRANSFORM_ISIDENT,
  156.17 +                    dstData.getSourceSurfaceData(bi,
  156.18 +                                                 SunGraphics2D.TRANSFORM_ISIDENT,
  156.19                                                   CompositeType.SrcOver, null);
  156.20                  if (!(srcData instanceof OGLSurfaceData)) {
  156.21                      return false;
   157.1 --- a/src/share/classes/sun/java2d/opengl/OGLSurfaceData.java	Tue Dec 06 16:31:58 2011 -0800
   157.2 +++ b/src/share/classes/sun/java2d/opengl/OGLSurfaceData.java	Mon Dec 19 10:06:23 2011 -0800
   157.3 @@ -428,18 +428,18 @@
   157.4          // by the CompositeType.SrcNoEa (any color) test below.)
   157.5  
   157.6          if (/* CompositeType.SrcNoEa (any color) */
   157.7 -            (sg2d.compositeState <= sg2d.COMP_ISCOPY &&
   157.8 -             sg2d.paintState <= sg2d.PAINT_ALPHACOLOR)        ||
   157.9 +            (sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY &&
  157.10 +             sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR)         ||
  157.11  
  157.12              /* CompositeType.SrcOver (any color) */
  157.13 -            (sg2d.compositeState == sg2d.COMP_ALPHA    &&
  157.14 -             sg2d.paintState <= sg2d.PAINT_ALPHACOLOR &&
  157.15 +            (sg2d.compositeState == SunGraphics2D.COMP_ALPHA   &&
  157.16 +             sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR &&
  157.17               (((AlphaComposite)sg2d.composite).getRule() ==
  157.18 -              AlphaComposite.SRC_OVER))                       ||
  157.19 +              AlphaComposite.SRC_OVER))                                 ||
  157.20  
  157.21              /* CompositeType.Xor (any color) */
  157.22 -            (sg2d.compositeState == sg2d.COMP_XOR &&
  157.23 -             sg2d.paintState <= sg2d.PAINT_ALPHACOLOR))
  157.24 +            (sg2d.compositeState == SunGraphics2D.COMP_XOR &&
  157.25 +             sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR))
  157.26          {
  157.27              textpipe = oglTextPipe;
  157.28          } else {
  157.29 @@ -454,12 +454,12 @@
  157.30          OGLRenderer nonTxPipe = null;
  157.31  
  157.32          if (sg2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON) {
  157.33 -            if (sg2d.paintState <= sg2d.PAINT_ALPHACOLOR) {
  157.34 -                if (sg2d.compositeState <= sg2d.COMP_XOR) {
  157.35 +            if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR) {
  157.36 +                if (sg2d.compositeState <= SunGraphics2D.COMP_XOR) {
  157.37                      txPipe = oglTxRenderPipe;
  157.38                      nonTxPipe = oglRenderPipe;
  157.39                  }
  157.40 -            } else if (sg2d.compositeState <= sg2d.COMP_ALPHA) {
  157.41 +            } else if (sg2d.compositeState <= SunGraphics2D.COMP_ALPHA) {
  157.42                  if (OGLPaints.isValid(sg2d)) {
  157.43                      txPipe = oglTxRenderPipe;
  157.44                      nonTxPipe = oglRenderPipe;
  157.45 @@ -467,7 +467,7 @@
  157.46                  // custom paints handled by super.validatePipe() below
  157.47              }
  157.48          } else {
  157.49 -            if (sg2d.paintState <= sg2d.PAINT_ALPHACOLOR) {
  157.50 +            if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR) {
  157.51                  if (graphicsConfig.isCapPresent(CAPS_PS30) &&
  157.52                      (sg2d.imageComp == CompositeType.SrcOverNoEa ||
  157.53                       sg2d.imageComp == CompositeType.SrcOver))
  157.54 @@ -484,7 +484,7 @@
  157.55                      sg2d.drawpipe = aaConverter;
  157.56                      sg2d.fillpipe = aaConverter;
  157.57                      sg2d.shapepipe = aaConverter;
  157.58 -                } else if (sg2d.compositeState == sg2d.COMP_XOR) {
  157.59 +                } else if (sg2d.compositeState == SunGraphics2D.COMP_XOR) {
  157.60                      // install the solid pipes when AA and XOR are both enabled
  157.61                      txPipe = oglTxRenderPipe;
  157.62                      nonTxPipe = oglRenderPipe;
  157.63 @@ -494,10 +494,10 @@
  157.64          }
  157.65  
  157.66          if (txPipe != null) {
  157.67 -            if (sg2d.transformState >= sg2d.TRANSFORM_TRANSLATESCALE) {
  157.68 +            if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
  157.69                  sg2d.drawpipe = txPipe;
  157.70                  sg2d.fillpipe = txPipe;
  157.71 -            } else if (sg2d.strokeState != sg2d.STROKE_THIN) {
  157.72 +            } else if (sg2d.strokeState != SunGraphics2D.STROKE_THIN) {
  157.73                  sg2d.drawpipe = txPipe;
  157.74                  sg2d.fillpipe = nonTxPipe;
  157.75              } else {
  157.76 @@ -524,7 +524,7 @@
  157.77  
  157.78      @Override
  157.79      protected MaskFill getMaskFill(SunGraphics2D sg2d) {
  157.80 -        if (sg2d.paintState > sg2d.PAINT_ALPHACOLOR) {
  157.81 +        if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR) {
  157.82              /*
  157.83               * We can only accelerate non-Color MaskFill operations if
  157.84               * all of the following conditions hold true:
  157.85 @@ -548,8 +548,8 @@
  157.86      public boolean copyArea(SunGraphics2D sg2d,
  157.87                              int x, int y, int w, int h, int dx, int dy)
  157.88      {
  157.89 -        if (sg2d.transformState < sg2d.TRANSFORM_TRANSLATESCALE &&
  157.90 -            sg2d.compositeState < sg2d.COMP_XOR)
  157.91 +        if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE &&
  157.92 +            sg2d.compositeState < SunGraphics2D.COMP_XOR)
  157.93          {
  157.94              x += sg2d.transX;
  157.95              y += sg2d.transY;
   158.1 --- a/src/share/classes/sun/java2d/pipe/AAShapePipe.java	Tue Dec 06 16:31:58 2011 -0800
   158.2 +++ b/src/share/classes/sun/java2d/pipe/AAShapePipe.java	Mon Dec 19 10:06:23 2011 -0800
   158.3 @@ -144,7 +144,7 @@
   158.4      public void renderPath(SunGraphics2D sg, Shape s, BasicStroke bs) {
   158.5          boolean adjust = (bs != null &&
   158.6                            sg.strokeHint != SunHints.INTVAL_STROKE_PURE);
   158.7 -        boolean thin = (sg.strokeState <= sg.STROKE_THINDASHED);
   158.8 +        boolean thin = (sg.strokeState <= SunGraphics2D.STROKE_THINDASHED);
   158.9  
  158.10          Region clip = sg.getCompClip();
  158.11          int abox[] = new int[4];
   159.1 --- a/src/share/classes/sun/java2d/pipe/BufferedPaints.java	Tue Dec 06 16:31:58 2011 -0800
   159.2 +++ b/src/share/classes/sun/java2d/pipe/BufferedPaints.java	Mon Dec 19 10:06:23 2011 -0800
   159.3 @@ -247,7 +247,7 @@
   159.4          BufferedImage bi = paint.getImage();
   159.5          SurfaceData dstData = sg2d.surfaceData;
   159.6          SurfaceData srcData =
   159.7 -            dstData.getSourceSurfaceData(bi, sg2d.TRANSFORM_ISIDENT,
   159.8 +            dstData.getSourceSurfaceData(bi, SunGraphics2D.TRANSFORM_ISIDENT,
   159.9                                           CompositeType.SrcOver, null);
  159.10          boolean filter =
  159.11              (sg2d.interpolationType !=
   160.1 --- a/src/share/classes/sun/java2d/pipe/BufferedRenderPipe.java	Tue Dec 06 16:31:58 2011 -0800
   160.2 +++ b/src/share/classes/sun/java2d/pipe/BufferedRenderPipe.java	Mon Dec 19 10:06:23 2011 -0800
   160.3 @@ -508,9 +508,9 @@
   160.4      }
   160.5  
   160.6      public void draw(SunGraphics2D sg2d, Shape s) {
   160.7 -        if (sg2d.strokeState == sg2d.STROKE_THIN) {
   160.8 +        if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
   160.9              if (s instanceof Polygon) {
  160.10 -                if (sg2d.transformState < sg2d.TRANSFORM_TRANSLATESCALE) {
  160.11 +                if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
  160.12                      Polygon p = (Polygon)s;
  160.13                      drawPolygon(sg2d, p.xpoints, p.ypoints, p.npoints);
  160.14                      return;
  160.15 @@ -518,7 +518,7 @@
  160.16              }
  160.17              Path2D.Float p2df;
  160.18              int transx, transy;
  160.19 -            if (sg2d.transformState <= sg2d.TRANSFORM_INT_TRANSLATE) {
  160.20 +            if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
  160.21                  if (s instanceof Path2D.Float) {
  160.22                      p2df = (Path2D.Float)s;
  160.23                  } else {
  160.24 @@ -532,7 +532,7 @@
  160.25                  transy = 0;
  160.26              }
  160.27              drawPath(sg2d, p2df, transx, transy);
  160.28 -        } else if (sg2d.strokeState < sg2d.STROKE_CUSTOM) {
  160.29 +        } else if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) {
  160.30              ShapeSpanIterator si = LoopPipe.getStrokeSpans(sg2d, s);
  160.31              try {
  160.32                  fillSpans(sg2d, si, 0, 0);
  160.33 @@ -547,11 +547,11 @@
  160.34      public void fill(SunGraphics2D sg2d, Shape s) {
  160.35          int transx, transy;
  160.36  
  160.37 -        if (sg2d.strokeState == sg2d.STROKE_THIN) {
  160.38 +        if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
  160.39              // Here we are able to use fillPath() for
  160.40              // high-quality fills.
  160.41              Path2D.Float p2df;
  160.42 -            if (sg2d.transformState <= sg2d.TRANSFORM_INT_TRANSLATE) {
  160.43 +            if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
  160.44                  if (s instanceof Path2D.Float) {
  160.45                      p2df = (Path2D.Float)s;
  160.46                  } else {
  160.47 @@ -569,7 +569,7 @@
  160.48          }
  160.49  
  160.50          AffineTransform at;
  160.51 -        if (sg2d.transformState <= sg2d.TRANSFORM_INT_TRANSLATE) {
  160.52 +        if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
  160.53              // Transform (translation) will be done by FillSpans (we could
  160.54              // delegate to fillPolygon() here, but most hardware accelerated
  160.55              // libraries cannot handle non-convex polygons, so we will use
   161.1 --- a/src/share/classes/sun/java2d/pipe/DrawImage.java	Tue Dec 06 16:31:58 2011 -0800
   161.2 +++ b/src/share/classes/sun/java2d/pipe/DrawImage.java	Mon Dec 19 10:06:23 2011 -0800
   161.3 @@ -146,7 +146,7 @@
   161.4          int imgh = img.getHeight(null);
   161.5          boolean checkfinalxform;
   161.6  
   161.7 -        if (sg.transformState <= sg.TRANSFORM_ANY_TRANSLATE &&
   161.8 +        if (sg.transformState <= SunGraphics2D.TRANSFORM_ANY_TRANSLATE &&
   161.9              (txtype == AffineTransform.TYPE_IDENTITY ||
  161.10               txtype == AffineTransform.TYPE_TRANSLATION))
  161.11          {
  161.12 @@ -166,7 +166,7 @@
  161.13                  return;
  161.14              }
  161.15              checkfinalxform = false;
  161.16 -        } else if (sg.transformState <= sg.TRANSFORM_TRANSLATESCALE &&
  161.17 +        } else if (sg.transformState <= SunGraphics2D.TRANSFORM_TRANSLATESCALE &&
  161.18                     ((txtype & (AffineTransform.TYPE_FLIP |
  161.19                                 AffineTransform.TYPE_MASK_ROTATION |
  161.20                                 AffineTransform.TYPE_GENERAL_TRANSFORM)) == 0))
  161.21 @@ -344,14 +344,14 @@
  161.22          Region clip = sg.getCompClip();
  161.23          SurfaceData dstData = sg.surfaceData;
  161.24          SurfaceData srcData = dstData.getSourceSurfaceData(img,
  161.25 -                                                           sg.TRANSFORM_GENERIC,
  161.26 +                                                           SunGraphics2D.TRANSFORM_GENERIC,
  161.27                                                             sg.imageComp,
  161.28                                                             bgColor);
  161.29  
  161.30          if (srcData == null) {
  161.31              img = getBufferedImage(img);
  161.32              srcData = dstData.getSourceSurfaceData(img,
  161.33 -                                                   sg.TRANSFORM_GENERIC,
  161.34 +                                                   SunGraphics2D.TRANSFORM_GENERIC,
  161.35                                                     sg.imageComp,
  161.36                                                     bgColor);
  161.37              if (srcData == null) {
  161.38 @@ -372,7 +372,7 @@
  161.39              sx1 = sy1 = 0;
  161.40  
  161.41              srcData = dstData.getSourceSurfaceData(img,
  161.42 -                                                   sg.TRANSFORM_GENERIC,
  161.43 +                                                   SunGraphics2D.TRANSFORM_GENERIC,
  161.44                                                     sg.imageComp,
  161.45                                                     bgColor);
  161.46          }
  161.47 @@ -398,7 +398,7 @@
  161.48              sx1 = sy1 = 0;
  161.49  
  161.50              srcData = dstData.getSourceSurfaceData(img,
  161.51 -                                                   sg.TRANSFORM_GENERIC,
  161.52 +                                                   SunGraphics2D.TRANSFORM_GENERIC,
  161.53                                                     sg.imageComp,
  161.54                                                     null);
  161.55              srcType = srcData.getSurfaceType();
  161.56 @@ -449,7 +449,7 @@
  161.57          SurfaceType dstType = dstData.getSurfaceType();
  161.58          MaskBlit maskblit;
  161.59          Blit blit;
  161.60 -        if (sg.compositeState <= sg.COMP_ALPHA) {
  161.61 +        if (sg.compositeState <= SunGraphics2D.COMP_ALPHA) {
  161.62              /* NOTE: We either have, or we can make,
  161.63               * a MaskBlit for any alpha composite type
  161.64               */
  161.65 @@ -565,7 +565,7 @@
  161.66          while (true) {
  161.67              SurfaceData srcData =
  161.68                  dstData.getSourceSurfaceData(img,
  161.69 -                                             sg.TRANSFORM_ISIDENT,
  161.70 +                                             SunGraphics2D.TRANSFORM_ISIDENT,
  161.71                                               sg.imageComp,
  161.72                                               bgColor);
  161.73              if (srcData == null) {
  161.74 @@ -628,7 +628,7 @@
  161.75          while (true) {
  161.76              SurfaceData srcData =
  161.77                  dstData.getSourceSurfaceData(img,
  161.78 -                                             sg.TRANSFORM_TRANSLATESCALE,
  161.79 +                                             SunGraphics2D.TRANSFORM_TRANSLATESCALE,
  161.80                                               sg.imageComp,
  161.81                                               bgColor);
  161.82  
  161.83 @@ -800,11 +800,11 @@
  161.84  
  161.85      public static boolean isSimpleTranslate(SunGraphics2D sg) {
  161.86          int ts = sg.transformState;
  161.87 -        if (ts <= sg.TRANSFORM_INT_TRANSLATE) {
  161.88 +        if (ts <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
  161.89              // Integer translates are always "simple"
  161.90              return true;
  161.91          }
  161.92 -        if (ts >= sg.TRANSFORM_TRANSLATESCALE) {
  161.93 +        if (ts >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
  161.94              // Scales and beyond are always "not simple"
  161.95              return false;
  161.96          }
  161.97 @@ -846,8 +846,11 @@
  161.98          }
  161.99          int type = tx.getType();
 161.100          boolean needTrans =
 161.101 -            ((type&(tx.TYPE_MASK_ROTATION|tx.TYPE_GENERAL_TRANSFORM)) != 0);
 161.102 -        if (! needTrans && type != tx.TYPE_TRANSLATION && type != tx.TYPE_IDENTITY)
 161.103 +                ((type & (AffineTransform.TYPE_MASK_ROTATION |
 161.104 +                          AffineTransform.TYPE_GENERAL_TRANSFORM)) != 0);
 161.105 +        if (! needTrans &&
 161.106 +              type != AffineTransform.TYPE_TRANSLATION &&
 161.107 +              type != AffineTransform.TYPE_IDENTITY)
 161.108          {
 161.109              double[] mtx = new double[4];
 161.110              tx.getMatrix(mtx);
 161.111 @@ -861,7 +864,7 @@
 161.112                  Raster raster = bImg.getRaster();
 161.113                  IndexColorModel icm = (IndexColorModel) cm;
 161.114                  // Just need to make sure that we have a transparent pixel
 161.115 -                if (needTrans && cm.getTransparency() == cm.OPAQUE) {
 161.116 +                if (needTrans && cm.getTransparency() == Transparency.OPAQUE) {
 161.117                      // Fix 4221407
 161.118                      if (raster instanceof sun.awt.image.BytePackedRaster) {
 161.119                          dstCM = ColorModel.getRGBdefault();
 161.120 @@ -892,7 +895,7 @@
 161.121                      }   /* raster instanceof sun.awt.image.BytePackedRaster */
 161.122                  } /* if (cm.getTransparency() == cm.OPAQUE) */
 161.123              } /* if (cm instanceof IndexColorModel) */
 161.124 -            else if (needTrans && cm.getTransparency() == cm.OPAQUE) {
 161.125 +            else if (needTrans && cm.getTransparency() == Transparency.OPAQUE) {
 161.126                  // Need a bitmask transparency
 161.127                  // REMIND: for now, use full transparency since no loops
 161.128                  // for bitmask
 161.129 @@ -902,7 +905,7 @@
 161.130          else {
 161.131  
 161.132              if (cm instanceof IndexColorModel ||
 161.133 -                (needTrans && cm.getTransparency() == cm.OPAQUE))
 161.134 +                (needTrans && cm.getTransparency() == Transparency.OPAQUE))
 161.135              {
 161.136                  // Need a bitmask transparency
 161.137                  // REMIND: for now, use full transparency since no loops
   162.1 --- a/src/share/classes/sun/java2d/pipe/GlyphListPipe.java	Tue Dec 06 16:31:58 2011 -0800
   162.2 +++ b/src/share/classes/sun/java2d/pipe/GlyphListPipe.java	Mon Dec 19 10:06:23 2011 -0800
   162.3 @@ -54,7 +54,7 @@
   162.4          }
   162.5  
   162.6          float devx, devy;
   162.7 -        if (sg2d.transformState >= sg2d.TRANSFORM_TRANSLATESCALE) {
   162.8 +        if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
   162.9              double origin[] = {x + info.originX, y + info.originY};
  162.10              sg2d.transform.transform(origin, 0, origin, 0, 1);
  162.11              devx = (float)origin[0];
  162.12 @@ -90,7 +90,7 @@
  162.13                                          sg2d, data, offset, length, ix, iy);
  162.14              return;
  162.15          }
  162.16 -        if (sg2d.transformState >= sg2d.TRANSFORM_TRANSLATESCALE) {
  162.17 +        if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
  162.18              double origin[] = {ix + info.originX, iy + info.originY};
  162.19              sg2d.transform.transform(origin, 0, origin, 0, 1);
  162.20              x = (float) origin[0];
  162.21 @@ -122,7 +122,7 @@
  162.22              SurfaceData.outlineTextRenderer.drawGlyphVector(sg2d, gv, x, y);
  162.23              return;
  162.24          }
  162.25 -        if (sg2d.transformState >= sg2d.TRANSFORM_TRANSLATESCALE) {
  162.26 +        if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
  162.27              double origin[] = {x, y};
  162.28              sg2d.transform.transform(origin, 0, origin, 0, 1);
  162.29              x = (float) origin[0];
   163.1 --- a/src/share/classes/sun/java2d/pipe/LoopPipe.java	Tue Dec 06 16:31:58 2011 -0800
   163.2 +++ b/src/share/classes/sun/java2d/pipe/LoopPipe.java	Mon Dec 19 10:06:23 2011 -0800
   163.3 @@ -171,11 +171,11 @@
   163.4  
   163.5  
   163.6      public void draw(SunGraphics2D sg2d, Shape s) {
   163.7 -        if (sg2d.strokeState == sg2d.STROKE_THIN) {
   163.8 +        if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
   163.9              Path2D.Float p2df;
  163.10              int transX;
  163.11              int transY;
  163.12 -            if (sg2d.transformState <= sg2d.TRANSFORM_INT_TRANSLATE) {
  163.13 +            if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
  163.14                  if (s instanceof Path2D.Float) {
  163.15                      p2df = (Path2D.Float)s;
  163.16                  } else {
  163.17 @@ -193,7 +193,7 @@
  163.18              return;
  163.19          }
  163.20  
  163.21 -        if (sg2d.strokeState == sg2d.STROKE_CUSTOM) {
  163.22 +        if (sg2d.strokeState == SunGraphics2D.STROKE_CUSTOM) {
  163.23              fill(sg2d, sg2d.stroke.createStrokedShape(s));
  163.24              return;
  163.25          }
  163.26 @@ -271,7 +271,7 @@
  163.27              sr.setRule(PathIterator.WIND_NON_ZERO);
  163.28  
  163.29              BasicStroke bs = (BasicStroke) sg2d.stroke;
  163.30 -            boolean thin = (sg2d.strokeState <= sg2d.STROKE_THINDASHED);
  163.31 +            boolean thin = (sg2d.strokeState <= SunGraphics2D.STROKE_THINDASHED);
  163.32              boolean normalize =
  163.33                  (sg2d.strokeHint != SunHints.INTVAL_STROKE_PURE);
  163.34  
  163.35 @@ -288,11 +288,11 @@
  163.36      }
  163.37  
  163.38      public void fill(SunGraphics2D sg2d, Shape s) {
  163.39 -        if (sg2d.strokeState == sg2d.STROKE_THIN) {
  163.40 +        if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
  163.41              Path2D.Float p2df;
  163.42              int transX;
  163.43              int transY;
  163.44 -            if (sg2d.transformState <= sg2d.TRANSFORM_INT_TRANSLATE) {
  163.45 +            if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
  163.46                  if (s instanceof Path2D.Float) {
  163.47                      p2df = (Path2D.Float)s;
  163.48                  } else {
  163.49 @@ -314,7 +314,7 @@
  163.50          try {
  163.51              sr.setOutputArea(sg2d.getCompClip());
  163.52              AffineTransform at =
  163.53 -                ((sg2d.transformState == sg2d.TRANSFORM_ISIDENT)
  163.54 +                ((sg2d.transformState == SunGraphics2D.TRANSFORM_ISIDENT)
  163.55                   ? null
  163.56                   : sg2d.transform);
  163.57              sr.appendPath(s.getPathIterator(at));
  163.58 @@ -328,7 +328,7 @@
  163.59          // REMIND: Eventually, the plan is that it will not be possible for
  163.60          // fs to be null since the FillSpans loop will be the fundamental
  163.61          // loop implemented for any destination type...
  163.62 -        if (sg2d.clipState == sg2d.CLIP_SHAPE) {
  163.63 +        if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
  163.64              si = sg2d.clipRegion.filter(si);
  163.65              // REMIND: Region.filter produces a Java-only iterator
  163.66              // with no native counterpart...
   164.1 --- a/src/share/classes/sun/java2d/pipe/RenderingEngine.java	Tue Dec 06 16:31:58 2011 -0800
   164.2 +++ b/src/share/classes/sun/java2d/pipe/RenderingEngine.java	Mon Dec 19 10:06:23 2011 -0800
   164.3 @@ -117,16 +117,16 @@
   164.4              return reImpl;
   164.5          }
   164.6  
   164.7 -        reImpl = (RenderingEngine)
   164.8 -            AccessController.doPrivileged(new PrivilegedAction() {
   164.9 -                public Object run() {
  164.10 +        reImpl =
  164.11 +            AccessController.doPrivileged(new PrivilegedAction<RenderingEngine>() {
  164.12 +                public RenderingEngine run() {
  164.13                      final String ductusREClass = "sun.dc.DuctusRenderingEngine";
  164.14                      String reClass =
  164.15                          System.getProperty("sun.java2d.renderer", ductusREClass);
  164.16                      if (reClass.equals(ductusREClass)) {
  164.17                          try {
  164.18 -                            Class cls = Class.forName(ductusREClass);
  164.19 -                            return cls.newInstance();
  164.20 +                            Class<?> cls = Class.forName(ductusREClass);
  164.21 +                            return (RenderingEngine) cls.newInstance();
  164.22                          } catch (ReflectiveOperationException ignored) {
  164.23                              // not found
  164.24                          }
  164.25 @@ -153,7 +153,7 @@
  164.26  
  164.27          GetPropertyAction gpa =
  164.28              new GetPropertyAction("sun.java2d.renderer.trace");
  164.29 -        String reTrace = (String) AccessController.doPrivileged(gpa);
  164.30 +        String reTrace = AccessController.doPrivileged(gpa);
  164.31          if (reTrace != null) {
  164.32              reImpl = new Tracer(reImpl);
  164.33          }
   165.1 --- a/src/share/classes/sun/launcher/LauncherHelper.java	Tue Dec 06 16:31:58 2011 -0800
   165.2 +++ b/src/share/classes/sun/launcher/LauncherHelper.java	Mon Dec 19 10:06:23 2011 -0800
   165.3 @@ -428,7 +428,7 @@
   165.4              if (t != null) {
   165.5                  t.printStackTrace();
   165.6              } else {
   165.7 -                Thread.currentThread().dumpStack();
   165.8 +                Thread.dumpStack();
   165.9              }
  165.10          }
  165.11          System.exit(1);
   166.1 --- a/src/share/classes/sun/management/counter/perf/PerfInstrumentation.java	Tue Dec 06 16:31:58 2011 -0800
   166.2 +++ b/src/share/classes/sun/management/counter/perf/PerfInstrumentation.java	Mon Dec 19 10:06:23 2011 -0800
   166.3 @@ -169,17 +169,15 @@
   166.4          Matcher matcher = pattern.matcher("");
   166.5          List<Counter> matches = new ArrayList<Counter>();
   166.6  
   166.7 -        Iterator iter = map.entrySet().iterator();
   166.8 -        while (iter.hasNext()) {
   166.9 -            Map.Entry me = (Map.Entry) iter.next();
  166.10 -            String name = (String) me.getKey();
  166.11 +        for (Map.Entry<String,Counter> me: map.entrySet()) {
  166.12 +            String name = me.getKey();
  166.13  
  166.14              // apply pattern to counter name
  166.15              matcher.reset(name);
  166.16  
  166.17              // if the pattern matches, then add Counter to list
  166.18              if (matcher.lookingAt()) {
  166.19 -                matches.add((Counter)me.getValue());
  166.20 +                matches.add(me.getValue());
  166.21              }
  166.22          }
  166.23          return matches;
   167.1 --- a/src/share/classes/sun/management/jmxremote/ConnectorBootstrap.java	Tue Dec 06 16:31:58 2011 -0800
   167.2 +++ b/src/share/classes/sun/management/jmxremote/ConnectorBootstrap.java	Mon Dec 19 10:06:23 2011 -0800
   167.3 @@ -233,16 +233,14 @@
   167.4                          "the access file [" + accessFile + "] as the " +
   167.5                          "authenticated Subject is null");
   167.6              }
   167.7 -            final Set principals = subject.getPrincipals();
   167.8 -            for (Iterator i = principals.iterator(); i.hasNext();) {
   167.9 -                final Principal p = (Principal) i.next();
  167.10 +            final Set<Principal> principals = subject.getPrincipals();
  167.11 +            for (Principal p: principals) {
  167.12                  if (properties.containsKey(p.getName())) {
  167.13                      return;
  167.14                  }
  167.15              }
  167.16              final Set<String> principalsStr = new HashSet<String>();
  167.17 -            for (Iterator i = principals.iterator(); i.hasNext();) {
  167.18 -                final Principal p = (Principal) i.next();
  167.19 +            for (Principal p: principals) {
  167.20                  principalsStr.add(p.getName());
  167.21              }
  167.22              throw new SecurityException(
  167.23 @@ -653,7 +651,7 @@
  167.24                  }
  167.25                  TrustManagerFactory tmf = TrustManagerFactory.getInstance(
  167.26                          TrustManagerFactory.getDefaultAlgorithm());
  167.27 -                tmf.init((KeyStore) ts);
  167.28 +                tmf.init(ts);
  167.29  
  167.30                  SSLContext ctx = SSLContext.getInstance("SSL");
  167.31                  ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
   168.1 --- a/src/share/classes/sun/misc/BASE64Decoder.java	Tue Dec 06 16:31:58 2011 -0800
   168.2 +++ b/src/share/classes/sun/misc/BASE64Decoder.java	Mon Dec 19 10:06:23 2011 -0800
   168.3 @@ -102,6 +102,7 @@
   168.4      /**
   168.5       * Decode one BASE64 atom into 1, 2, or 3 bytes of data.
   168.6       */
   168.7 +    @SuppressWarnings("fallthrough")
   168.8      protected void decodeAtom(PushbackInputStream inStream, OutputStream outStream, int rem)
   168.9          throws java.io.IOException
  168.10      {
   169.1 --- a/src/share/classes/sun/misc/CEFormatException.java	Tue Dec 06 16:31:58 2011 -0800
   169.2 +++ b/src/share/classes/sun/misc/CEFormatException.java	Mon Dec 19 10:06:23 2011 -0800
   169.3 @@ -28,7 +28,9 @@
   169.4  import java.io.IOException;
   169.5  
   169.6  public class CEFormatException extends IOException {
   169.7 -        public CEFormatException(String s) {
   169.8 -                super(s);
   169.9 -        }
  169.10 +    static final long serialVersionUID = -7139121221067081482L;
  169.11 +    public CEFormatException(String s) {
  169.12 +        super(s);
  169.13 +    }
  169.14  }
  169.15 +
   170.1 --- a/src/share/classes/sun/misc/CEStreamExhausted.java	Tue Dec 06 16:31:58 2011 -0800
   170.2 +++ b/src/share/classes/sun/misc/CEStreamExhausted.java	Mon Dec 19 10:06:23 2011 -0800
   170.3 @@ -27,4 +27,7 @@
   170.4  import java.io.IOException;
   170.5  
   170.6  /** This exception is thrown when EOF is reached */
   170.7 -public class CEStreamExhausted extends IOException { };
   170.8 +public class CEStreamExhausted extends IOException {
   170.9 +    static final long serialVersionUID = -5889118049525891904L;
  170.10 +}
  170.11 +
   171.1 --- a/src/share/classes/sun/misc/ClassLoaderUtil.java	Tue Dec 06 16:31:58 2011 -0800
   171.2 +++ b/src/share/classes/sun/misc/ClassLoaderUtil.java	Mon Dec 19 10:06:23 2011 -0800
   171.3 @@ -79,9 +79,9 @@
   171.4  
   171.5              URLClassPath ucp = SharedSecrets.getJavaNetAccess()
   171.6                                                  .getURLClassPath(classLoader);
   171.7 -            ArrayList loaders = ucp.loaders;
   171.8 -            Stack urls = ucp.urls;
   171.9 -            HashMap lmap = ucp.lmap;
  171.10 +            ArrayList<?> loaders = ucp.loaders;
  171.11 +            Stack<?> urls = ucp.urls;
  171.12 +            HashMap<?,?> lmap = ucp.lmap;
  171.13  
  171.14              /*
  171.15               *The urls variable in the URLClassPath object holds URLs that have not yet
   172.1 --- a/src/share/classes/sun/misc/CompoundEnumeration.java	Tue Dec 06 16:31:58 2011 -0800
   172.2 +++ b/src/share/classes/sun/misc/CompoundEnumeration.java	Mon Dec 19 10:06:23 2011 -0800
   172.3 @@ -33,10 +33,10 @@
   172.4   * enumerations.
   172.5   */
   172.6  public class CompoundEnumeration<E> implements Enumeration<E> {
   172.7 -    private Enumeration[] enums;
   172.8 +    private Enumeration<E>[] enums;
   172.9      private int index = 0;
  172.10  
  172.11 -    public CompoundEnumeration(Enumeration[] enums) {
  172.12 +    public CompoundEnumeration(Enumeration<E>[] enums) {
  172.13          this.enums = enums;
  172.14      }
  172.15  
  172.16 @@ -58,6 +58,6 @@
  172.17          if (!next()) {
  172.18              throw new NoSuchElementException();
  172.19          }
  172.20 -        return (E)enums[index].nextElement();
  172.21 +        return enums[index].nextElement();
  172.22      }
  172.23  }
   173.1 --- a/src/share/classes/sun/misc/ExtensionDependency.java	Tue Dec 06 16:31:58 2011 -0800
   173.2 +++ b/src/share/classes/sun/misc/ExtensionDependency.java	Mon Dec 19 10:06:23 2011 -0800
   173.3 @@ -70,7 +70,7 @@
   173.4  public class ExtensionDependency {
   173.5  
   173.6      /* Callbak interfaces to delegate installation of missing extensions */
   173.7 -    private static Vector providers;
   173.8 +    private static Vector<ExtensionInstallationProvider> providers;
   173.9  
  173.10      /**
  173.11       * <p>
  173.12 @@ -83,7 +83,7 @@
  173.13          (ExtensionInstallationProvider eip)
  173.14      {
  173.15          if (providers == null) {
  173.16 -            providers = new Vector();
  173.17 +            providers = new Vector<>();
  173.18          }
  173.19          providers.add(eip);
  173.20      }
  173.21 @@ -93,7 +93,7 @@
  173.22       * Unregister a previously installed installation provider
  173.23       * </p>
  173.24       */
  173.25 -    public synchronized  static void removeExtensionInstallationProvider
  173.26 +    public synchronized static void removeExtensionInstallationProvider
  173.27          (ExtensionInstallationProvider eip)
  173.28      {
  173.29          providers.remove(eip);
  173.30 @@ -348,14 +348,16 @@
  173.31                                         ExtensionInfo instInfo)
  173.32          throws ExtensionInstallationException
  173.33      {
  173.34 -
  173.35 -        Vector currentProviders;
  173.36 +        Vector<ExtensionInstallationProvider> currentProviders;
  173.37          synchronized(providers) {
  173.38 -            currentProviders = (Vector) providers.clone();
  173.39 +            @SuppressWarnings("unchecked")
  173.40 +            Vector<ExtensionInstallationProvider> tmp =
  173.41 +                (Vector<ExtensionInstallationProvider>) providers.clone();
  173.42 +            currentProviders = tmp;
  173.43          }
  173.44 -        for (Enumeration e=currentProviders.elements();e.hasMoreElements();) {
  173.45 -            ExtensionInstallationProvider eip =
  173.46 -                (ExtensionInstallationProvider) e.nextElement();
  173.47 +        for (Enumeration<ExtensionInstallationProvider> e = currentProviders.elements();
  173.48 +                e.hasMoreElements();) {
  173.49 +            ExtensionInstallationProvider eip = e.nextElement();
  173.50  
  173.51              if (eip!=null) {
  173.52                  // delegate the installation to the provider
   174.1 --- a/src/share/classes/sun/misc/ExtensionInstallationException.java	Tue Dec 06 16:31:58 2011 -0800
   174.2 +++ b/src/share/classes/sun/misc/ExtensionInstallationException.java	Mon Dec 19 10:06:23 2011 -0800
   174.3 @@ -34,6 +34,8 @@
   174.4  
   174.5  public class ExtensionInstallationException extends Exception {
   174.6  
   174.7 +    static final long serialVersionUID = 3139688306909345924L;
   174.8 +
   174.9      /*
  174.10       * <p>
  174.11       * Construct a new exception with an exception reason
   175.1 --- a/src/share/classes/sun/misc/FloatingDecimal.java	Tue Dec 06 16:31:58 2011 -0800
   175.2 +++ b/src/share/classes/sun/misc/FloatingDecimal.java	Mon Dec 19 10:06:23 2011 -0800
   175.3 @@ -325,7 +325,7 @@
   175.4              // can do int arithmetic rather than long!
   175.5              int  ivalue = (int)lvalue;
   175.6              ndigits = 10;
   175.7 -            digits = (char[])(perThreadBuffer.get());
   175.8 +            digits = perThreadBuffer.get();
   175.9              digitno = ndigits-1;
  175.10              c = ivalue%10;
  175.11              ivalue /= 10;
  175.12 @@ -345,7 +345,7 @@
  175.13              // same algorithm as above (same bugs, too )
  175.14              // but using long arithmetic.
  175.15              ndigits = 20;
  175.16 -            digits = (char[])(perThreadBuffer.get());
  175.17 +            digits = perThreadBuffer.get();
  175.18              digitno = ndigits-1;
  175.19              c = (int)(lvalue%10L);
  175.20              lvalue /= 10L;
  175.21 @@ -477,9 +477,9 @@
  175.22          }
  175.23          // Begin to unpack
  175.24          // Discover obvious special cases of NaN and Infinity.
  175.25 -        binExp = (int)( (fBits&singleExpMask) >> singleExpShift );
  175.26 +        binExp = (fBits&singleExpMask) >> singleExpShift;
  175.27          fractBits = fBits&singleFractMask;
  175.28 -        if ( binExp == (int)(singleExpMask>>singleExpShift) ) {
  175.29 +        if ( binExp == (singleExpMask>>singleExpShift) ) {
  175.30              isExceptional = true;
  175.31              if ( fractBits == 0L ){
  175.32                  digits =  infinity;
  175.33 @@ -900,7 +900,7 @@
  175.34      }
  175.35  
  175.36      public String toJavaFormatString() {
  175.37 -        char result[] = (char[])(perThreadBuffer.get());
  175.38 +        char result[] = perThreadBuffer.get();
  175.39          int i = getChars(result);
  175.40          return new String(result, 0, i);
  175.41      }
  175.42 @@ -978,14 +978,14 @@
  175.43      }
  175.44  
  175.45      // Per-thread buffer for string/stringbuffer conversion
  175.46 -    private static ThreadLocal perThreadBuffer = new ThreadLocal() {
  175.47 -            protected synchronized Object initialValue() {
  175.48 +    private static ThreadLocal<char[]> perThreadBuffer = new ThreadLocal<char[]>() {
  175.49 +            protected synchronized char[] initialValue() {
  175.50                  return new char[26];
  175.51              }
  175.52          };
  175.53  
  175.54      public void appendTo(Appendable buf) {
  175.55 -          char result[] = (char[])(perThreadBuffer.get());
  175.56 +          char result[] = perThreadBuffer.get();
  175.57            int i = getChars(result);
  175.58          if (buf instanceof StringBuilder)
  175.59              ((StringBuilder) buf).append(result, 0, i);
  175.60 @@ -995,6 +995,7 @@
  175.61              assert false;
  175.62      }
  175.63  
  175.64 +    @SuppressWarnings("fallthrough")
  175.65      public static FloatingDecimal
  175.66      readJavaFormatString( String in ) throws NumberFormatException {
  175.67          boolean isNegative = false;
  175.68 @@ -2209,7 +2210,7 @@
  175.69                      // exponent correctly, even in the case of
  175.70                      // Double.MAX_VALUE overflowing to infinity.
  175.71  
  175.72 -                    significand = (( ((long)exponent +
  175.73 +                    significand = (( (exponent +
  175.74                                       (long)DoubleConsts.EXP_BIAS) <<
  175.75                                       (DoubleConsts.SIGNIFICAND_WIDTH-1))
  175.76                                     & DoubleConsts.EXP_BIT_MASK) |
   176.1 --- a/src/share/classes/sun/misc/FormattedFloatingDecimal.java	Tue Dec 06 16:31:58 2011 -0800
   176.2 +++ b/src/share/classes/sun/misc/FormattedFloatingDecimal.java	Mon Dec 19 10:06:23 2011 -0800
   176.3 @@ -333,7 +333,7 @@
   176.4              // can do int arithmetic rather than long!
   176.5              int  ivalue = (int)lvalue;
   176.6              ndigits = 10;
   176.7 -            digits = (char[])(perThreadBuffer.get());
   176.8 +            digits = perThreadBuffer.get();
   176.9              digitno = ndigits-1;
  176.10              c = ivalue%10;
  176.11              ivalue /= 10;
  176.12 @@ -353,7 +353,7 @@
  176.13              // same algorithm as above (same bugs, too )
  176.14              // but using long arithmetic.
  176.15              ndigits = 20;
  176.16 -            digits = (char[])(perThreadBuffer.get());
  176.17 +            digits = perThreadBuffer.get();
  176.18              digitno = ndigits-1;
  176.19              c = (int)(lvalue%10L);
  176.20              lvalue /= 10L;
  176.21 @@ -554,9 +554,9 @@
  176.22          }
  176.23          // Begin to unpack
  176.24          // Discover obvious special cases of NaN and Infinity.
  176.25 -        binExp = (int)( (fBits&singleExpMask) >> singleExpShift );
  176.26 +        binExp = (fBits&singleExpMask) >> singleExpShift;
  176.27          fractBits = fBits&singleFractMask;
  176.28 -        if ( binExp == (int)(singleExpMask>>singleExpShift) ) {
  176.29 +        if ( binExp == (singleExpMask>>singleExpShift) ) {
  176.30              isExceptional = true;
  176.31              if ( fractBits == 0L ){
  176.32                  digits =  infinity;
  176.33 @@ -1140,8 +1140,8 @@
  176.34      }
  176.35  
  176.36      // Per-thread buffer for string/stringbuffer conversion
  176.37 -    private static ThreadLocal perThreadBuffer = new ThreadLocal() {
  176.38 -            protected synchronized Object initialValue() {
  176.39 +    private static ThreadLocal<char[]> perThreadBuffer = new ThreadLocal<char[]>() {
  176.40 +            protected synchronized char[] initialValue() {
  176.41                  return new char[26];
  176.42              }
  176.43          };
   177.1 --- a/src/share/classes/sun/misc/InvalidJarIndexException.java	Tue Dec 06 16:31:58 2011 -0800
   177.2 +++ b/src/share/classes/sun/misc/InvalidJarIndexException.java	Mon Dec 19 10:06:23 2011 -0800
   177.3 @@ -38,6 +38,8 @@
   177.4  public
   177.5  class InvalidJarIndexException extends RuntimeException {
   177.6  
   177.7 +    static final long serialVersionUID = -6159797516569680148L;
   177.8 +
   177.9      /**
  177.10       * Constructs an <code>InvalidJarIndexException</code> with no
  177.11       * detail message.
   178.1 --- a/src/share/classes/sun/misc/JarIndex.java	Tue Dec 06 16:31:58 2011 -0800
   178.2 +++ b/src/share/classes/sun/misc/JarIndex.java	Mon Dec 19 10:06:23 2011 -0800
   178.3 @@ -48,13 +48,13 @@
   178.4       * The hash map that maintains mappings from
   178.5       * package/classe/resource to jar file list(s)
   178.6       */
   178.7 -    private HashMap indexMap;
   178.8 +    private HashMap<String,LinkedList<String>> indexMap;
   178.9  
  178.10      /**
  178.11       * The hash map that maintains mappings from
  178.12       * jar file to package/class/resource lists
  178.13       */
  178.14 -    private HashMap jarMap;
  178.15 +    private HashMap<String,LinkedList<String>> jarMap;
  178.16  
  178.17      /*
  178.18       * An ordered list of jar file names.
  178.19 @@ -78,8 +78,8 @@
  178.20       * Constructs a new, empty jar index.
  178.21       */
  178.22      public JarIndex() {
  178.23 -        indexMap = new HashMap();
  178.24 -        jarMap = new HashMap();
  178.25 +        indexMap = new HashMap<>();
  178.26 +        jarMap = new HashMap<>();
  178.27      }
  178.28  
  178.29      /**
  178.30 @@ -150,10 +150,11 @@
  178.31       * Add the key, value pair to the hashmap, the value will
  178.32       * be put in a linked list which is created if necessary.
  178.33       */
  178.34 -    private void addToList(String key, String value, HashMap t) {
  178.35 -        LinkedList list = (LinkedList)t.get(key);
  178.36 +    private void addToList(String key, String value,
  178.37 +                           HashMap<String,LinkedList<String>> t) {
  178.38 +        LinkedList<String> list = t.get(key);
  178.39          if (list == null) {
  178.40 -            list = new LinkedList();
  178.41 +            list = new LinkedList<>();
  178.42              list.add(value);
  178.43              t.put(key, list);
  178.44          } else if (!list.contains(value)) {
  178.45 @@ -166,13 +167,13 @@
  178.46       *
  178.47       * @param fileName the key of the mapping
  178.48       */
  178.49 -    public LinkedList get(String fileName) {
  178.50 -        LinkedList jarFiles = null;
  178.51 -        if ((jarFiles = (LinkedList)indexMap.get(fileName)) == null) {
  178.52 +    public LinkedList<String> get(String fileName) {
  178.53 +        LinkedList<String> jarFiles = null;
  178.54 +        if ((jarFiles = indexMap.get(fileName)) == null) {
  178.55              /* try the package name again */
  178.56              int pos;
  178.57              if((pos = fileName.lastIndexOf("/")) != -1) {
  178.58 -                jarFiles = (LinkedList)indexMap.get(fileName.substring(0, pos));
  178.59 +                jarFiles = indexMap.get(fileName.substring(0, pos));
  178.60              }
  178.61          }
  178.62          return jarFiles;
  178.63 @@ -235,9 +236,9 @@
  178.64              ZipFile zrf = new ZipFile(currentJar.replace
  178.65                                        ('/', File.separatorChar));
  178.66  
  178.67 -            Enumeration entries = zrf.entries();
  178.68 +            Enumeration<? extends ZipEntry> entries = zrf.entries();
  178.69              while(entries.hasMoreElements()) {
  178.70 -                ZipEntry entry = (ZipEntry) entries.nextElement();
  178.71 +                ZipEntry entry = entries.nextElement();
  178.72                  String fileName = entry.getName();
  178.73  
  178.74                  // Skip the META-INF directory, the index, and manifest.
  178.75 @@ -282,11 +283,11 @@
  178.76                  /* print out the jar file name */
  178.77                  String jar = jarFiles[i];
  178.78                  bw.write(jar + "\n");
  178.79 -                LinkedList jarlist = (LinkedList)jarMap.get(jar);
  178.80 +                LinkedList<String> jarlist = jarMap.get(jar);
  178.81                  if (jarlist != null) {
  178.82 -                    Iterator listitr = jarlist.iterator();
  178.83 +                    Iterator<String> listitr = jarlist.iterator();
  178.84                      while(listitr.hasNext()) {
  178.85 -                        bw.write((String)(listitr.next()) + "\n");
  178.86 +                        bw.write(listitr.next() + "\n");
  178.87                      }
  178.88                  }
  178.89                  bw.write("\n");
  178.90 @@ -309,7 +310,7 @@
  178.91          String currentJar = null;
  178.92  
  178.93          /* an ordered list of jar file names */
  178.94 -        Vector jars = new Vector();
  178.95 +        Vector<String> jars = new Vector<>();
  178.96  
  178.97          /* read until we see a .jar line */
  178.98          while((line = br.readLine()) != null && !line.endsWith(".jar"));
  178.99 @@ -328,7 +329,7 @@
 178.100              }
 178.101          }
 178.102  
 178.103 -        jarFiles = (String[])jars.toArray(new String[jars.size()]);
 178.104 +        jarFiles = jars.toArray(new String[jars.size()]);
 178.105      }
 178.106  
 178.107      /**
 178.108 @@ -342,14 +343,14 @@
 178.109       *
 178.110       */
 178.111      public void merge(JarIndex toIndex, String path) {
 178.112 -        Iterator itr = indexMap.entrySet().iterator();
 178.113 +        Iterator<Map.Entry<String,LinkedList<String>>> itr = indexMap.entrySet().iterator();
 178.114          while(itr.hasNext()) {
 178.115 -            Map.Entry e = (Map.Entry)itr.next();
 178.116 -            String packageName = (String)e.getKey();
 178.117 -            LinkedList from_list = (LinkedList)e.getValue();
 178.118 -            Iterator listItr = from_list.iterator();
 178.119 +            Map.Entry<String,LinkedList<String>> e = itr.next();
 178.120 +            String packageName = e.getKey();
 178.121 +            LinkedList<String> from_list = e.getValue();
 178.122 +            Iterator<String> listItr = from_list.iterator();
 178.123              while(listItr.hasNext()) {
 178.124 -                String jarName = (String)listItr.next();
 178.125 +                String jarName = listItr.next();
 178.126                  if (path != null) {
 178.127                      jarName = path.concat(jarName);
 178.128                  }
   179.1 --- a/src/share/classes/sun/misc/JavaLangAccess.java	Tue Dec 06 16:31:58 2011 -0800
   179.2 +++ b/src/share/classes/sun/misc/JavaLangAccess.java	Mon Dec 19 10:06:23 2011 -0800
   179.3 @@ -31,19 +31,19 @@
   179.4  
   179.5  public interface JavaLangAccess {
   179.6      /** Return the constant pool for a class. */
   179.7 -    ConstantPool getConstantPool(Class klass);
   179.8 +    ConstantPool getConstantPool(Class<?> klass);
   179.9  
  179.10      /**
  179.11       * Set the AnnotationType instance corresponding to this class.
  179.12       * (This method only applies to annotation types.)
  179.13       */
  179.14 -    void setAnnotationType(Class klass, AnnotationType annotationType);
  179.15 +    void setAnnotationType(Class<?> klass, AnnotationType annotationType);
  179.16  
  179.17      /**
  179.18       * Get the AnnotationType instance corresponding to this class.
  179.19       * (This method only applies to annotation types.)
  179.20       */
  179.21 -    AnnotationType getAnnotationType(Class klass);
  179.22 +    AnnotationType getAnnotationType(Class<?> klass);
  179.23  
  179.24      /**
  179.25       * Returns the elements of an enum class or null if the
   180.1 --- a/src/share/classes/sun/misc/JavaUtilJarAccess.java	Tue Dec 06 16:31:58 2011 -0800
   180.2 +++ b/src/share/classes/sun/misc/JavaUtilJarAccess.java	Mon Dec 19 10:06:23 2011 -0800
   180.3 @@ -40,5 +40,5 @@
   180.4      public Enumeration<String> entryNames(JarFile jar, CodeSource[] cs);
   180.5      public Enumeration<JarEntry> entries2(JarFile jar);
   180.6      public void setEagerValidation(JarFile jar, boolean eager);
   180.7 -    public List getManifestDigests(JarFile jar);
   180.8 +    public List<Object> getManifestDigests(JarFile jar);
   180.9  }
   181.1 --- a/src/share/classes/sun/misc/LRUCache.java	Tue Dec 06 16:31:58 2011 -0800
   181.2 +++ b/src/share/classes/sun/misc/LRUCache.java	Mon Dec 19 10:06:23 2011 -0800
   181.3 @@ -52,7 +52,9 @@
   181.4  
   181.5      public V forName(N name) {
   181.6          if (oa == null) {
   181.7 -            oa = (V[])new Object[size];
   181.8 +            @SuppressWarnings("unchecked")
   181.9 +            V[] temp = (V[])new Object[size];
  181.10 +            oa = temp;
  181.11          } else {
  181.12              for (int i = 0; i < oa.length; i++) {
  181.13                  V ob = oa[i];
   182.1 --- a/src/share/classes/sun/misc/Launcher.java	Tue Dec 06 16:31:58 2011 -0800
   182.2 +++ b/src/share/classes/sun/misc/Launcher.java	Mon Dec 19 10:06:23 2011 -0800
   182.3 @@ -295,7 +295,7 @@
   182.4          /**
   182.5           * Override loadClass so we can checkPackageAccess.
   182.6           */
   182.7 -        public Class loadClass(String name, boolean resolve)
   182.8 +        public Class<?> loadClass(String name, boolean resolve)
   182.9              throws ClassNotFoundException
  182.10          {
  182.11              int i = name.lastIndexOf('.');
  182.12 @@ -473,7 +473,7 @@
  182.13          public URLStreamHandler createURLStreamHandler(String protocol) {
  182.14              String name = PREFIX + "." + protocol + ".Handler";
  182.15              try {
  182.16 -                Class c = Class.forName(name);
  182.17 +                Class<?> c = Class.forName(name);
  182.18                  return (URLStreamHandler)c.newInstance();
  182.19              } catch (ReflectiveOperationException e) {
  182.20                  throw new InternalError("could not load " + protocol +
   183.1 --- a/src/share/classes/sun/misc/ProxyGenerator.java	Tue Dec 06 16:31:58 2011 -0800
   183.2 +++ b/src/share/classes/sun/misc/ProxyGenerator.java	Mon Dec 19 10:06:23 2011 -0800
   183.3 @@ -351,7 +351,7 @@
   183.4          try {
   183.5              hashCodeMethod = Object.class.getMethod("hashCode");
   183.6              equalsMethod =
   183.7 -                Object.class.getMethod("equals", new Class[] { Object.class });
   183.8 +                Object.class.getMethod("equals", new Class<?>[] { Object.class });
   183.9              toStringMethod = Object.class.getMethod("toString");
  183.10          } catch (NoSuchMethodException e) {
  183.11              throw new NoSuchMethodError(e.getMessage());
  183.12 @@ -559,11 +559,11 @@
  183.13       * passed to the invocation handler's "invoke" method for a given
  183.14       * set of duplicate methods.
  183.15       */
  183.16 -    private void addProxyMethod(Method m, Class fromClass) {
  183.17 +    private void addProxyMethod(Method m, Class<?> fromClass) {
  183.18          String name = m.getName();
  183.19 -        Class[] parameterTypes = m.getParameterTypes();
  183.20 -        Class returnType = m.getReturnType();
  183.21 -        Class[] exceptionTypes = m.getExceptionTypes();
  183.22 +        Class<?>[] parameterTypes = m.getParameterTypes();
  183.23 +        Class<?> returnType = m.getReturnType();
  183.24 +        Class<?>[] exceptionTypes = m.getExceptionTypes();
  183.25  
  183.26          String sig = name + getParameterDescriptors(parameterTypes);
  183.27          List<ProxyMethod> sigmethods = proxyMethods.get(sig);
  183.28 @@ -581,7 +581,7 @@
  183.29                          exceptionTypes, pm.exceptionTypes, legalExceptions);
  183.30                      collectCompatibleTypes(
  183.31                          pm.exceptionTypes, exceptionTypes, legalExceptions);
  183.32 -                    pm.exceptionTypes = new Class[legalExceptions.size()];
  183.33 +                    pm.exceptionTypes = new Class<?>[legalExceptions.size()];
  183.34                      pm.exceptionTypes =
  183.35                          legalExceptions.toArray(pm.exceptionTypes);
  183.36                      return;
  183.37 @@ -848,15 +848,15 @@
  183.38      private class ProxyMethod {
  183.39  
  183.40          public String methodName;
  183.41 -        public Class[] parameterTypes;
  183.42 -        public Class returnType;
  183.43 -        public Class[] exceptionTypes;
  183.44 -        public Class fromClass;
  183.45 +        public Class<?>[] parameterTypes;
  183.46 +        public Class<?> returnType;
  183.47 +        public Class<?>[] exceptionTypes;
  183.48 +        public Class<?> fromClass;
  183.49          public String methodFieldName;
  183.50  
  183.51 -        private ProxyMethod(String methodName, Class[] parameterTypes,
  183.52 -                            Class returnType, Class[] exceptionTypes,
  183.53 -                            Class fromClass)
  183.54 +        private ProxyMethod(String methodName, Class<?>[] parameterTypes,
  183.55 +                            Class<?> returnType, Class<?>[] exceptionTypes,
  183.56 +                            Class<?> fromClass)
  183.57          {
  183.58              this.methodName = methodName;
  183.59              this.parameterTypes = parameterTypes;
  183.60 @@ -1001,7 +1001,7 @@
  183.61           * invocation handler's "invoke" method.  The code is written
  183.62           * to the supplied stream.
  183.63           */
  183.64 -        private void codeWrapArgument(Class type, int slot,
  183.65 +        private void codeWrapArgument(Class<?> type, int slot,
  183.66                                        DataOutputStream out)
  183.67              throws IOException
  183.68          {
  183.69 @@ -1042,7 +1042,7 @@
  183.70           * Object) to its correct type.  The code is written to the
  183.71           * supplied stream.
  183.72           */
  183.73 -        private void codeUnwrapReturnValue(Class type, DataOutputStream out)
  183.74 +        private void codeUnwrapReturnValue(Class<?> type, DataOutputStream out)
  183.75              throws IOException
  183.76          {
  183.77              if (type.isPrimitive()) {
  183.78 @@ -1391,7 +1391,7 @@
  183.79       * the supplied stream.  Note that the code generated by this method
  183.80       * may caused the checked ClassNotFoundException to be thrown.
  183.81       */
  183.82 -    private void codeClassForName(Class cl, DataOutputStream out)
  183.83 +    private void codeClassForName(Class<?> cl, DataOutputStream out)
  183.84          throws IOException
  183.85      {
  183.86          code_ldc(cp.getString(cl.getName()), out);
  183.87 @@ -1422,8 +1422,8 @@
  183.88       * Return the "method descriptor" string for a method with the given
  183.89       * parameter types and return type.  See JVMS section 4.3.3.
  183.90       */
  183.91 -    private static String getMethodDescriptor(Class[] parameterTypes,
  183.92 -                                              Class returnType)
  183.93 +    private static String getMethodDescriptor(Class<?>[] parameterTypes,
  183.94 +                                              Class<?> returnType)
  183.95      {
  183.96          return getParameterDescriptors(parameterTypes) +
  183.97              ((returnType == void.class) ? "V" : getFieldType(returnType));
  183.98 @@ -1436,7 +1436,7 @@
  183.99       * string is useful for constructing string keys for methods without
 183.100       * regard to their return type.
 183.101       */
 183.102 -    private static String getParameterDescriptors(Class[] parameterTypes) {
 183.103 +    private static String getParameterDescriptors(Class<?>[] parameterTypes) {
 183.104          StringBuilder desc = new StringBuilder("(");
 183.105          for (int i = 0; i < parameterTypes.length; i++) {
 183.106              desc.append(getFieldType(parameterTypes[i]));
 183.107 @@ -1450,7 +1450,7 @@
 183.108       * a field descriptor, a parameter descriptor, or a return descriptor
 183.109       * other than "void".  See JVMS section 4.3.2.
 183.110       */
 183.111 -    private static String getFieldType(Class type) {
 183.112 +    private static String getFieldType(Class<?> type) {
 183.113          if (type.isPrimitive()) {
 183.114              return PrimitiveTypeInfo.get(type).baseTypeString;
 183.115          } else if (type.isArray()) {
 183.116 @@ -1472,7 +1472,7 @@
 183.117       * method with the given name and parameter types.
 183.118       */
 183.119      private static String getFriendlyMethodSignature(String name,
 183.120 -                                                     Class[] parameterTypes)
 183.121 +                                                     Class<?>[] parameterTypes)
 183.122      {
 183.123          StringBuilder sig = new StringBuilder(name);
 183.124          sig.append('(');
 183.125 @@ -1480,7 +1480,7 @@
 183.126              if (i > 0) {
 183.127                  sig.append(',');
 183.128              }
 183.129 -            Class parameterType = parameterTypes[i];
 183.130 +            Class<?> parameterType = parameterTypes[i];
 183.131              int dimensions = 0;
 183.132              while (parameterType.isArray()) {
 183.133                  parameterType = parameterType.getComponentType();
 183.134 @@ -1504,7 +1504,7 @@
 183.135       * this abstract notion of a "word" in section 3.4, but that definition
 183.136       * was removed for the second edition.
 183.137       */
 183.138 -    private static int getWordsPerType(Class type) {
 183.139 +    private static int getWordsPerType(Class<?> type) {
 183.140          if (type == long.class || type == double.class) {
 183.141              return 2;
 183.142          } else {
 183.143 @@ -1632,8 +1632,7 @@
 183.144          /** descriptor of same method */
 183.145          public String unwrapMethodDesc;
 183.146  
 183.147 -        private static Map<Class,PrimitiveTypeInfo> table =
 183.148 -            new HashMap<Class,PrimitiveTypeInfo>();
 183.149 +        private static Map<Class<?>,PrimitiveTypeInfo> table = new HashMap<>();
 183.150          static {
 183.151              add(byte.class, Byte.class);
 183.152              add(char.class, Character.class);
 183.153 @@ -1645,12 +1644,12 @@
 183.154              add(boolean.class, Boolean.class);
 183.155          }
 183.156  
 183.157 -        private static void add(Class primitiveClass, Class wrapperClass) {
 183.158 +        private static void add(Class<?> primitiveClass, Class<?> wrapperClass) {
 183.159              table.put(primitiveClass,
 183.160                        new PrimitiveTypeInfo(primitiveClass, wrapperClass));
 183.161          }
 183.162  
 183.163 -        private PrimitiveTypeInfo(Class primitiveClass, Class wrapperClass) {
 183.164 +        private PrimitiveTypeInfo(Class<?> primitiveClass, Class<?> wrapperClass) {
 183.165              assert primitiveClass.isPrimitive();
 183.166  
 183.167              baseTypeString =
 183.168 @@ -1663,7 +1662,7 @@
 183.169              unwrapMethodDesc = "()" + baseTypeString;
 183.170          }
 183.171  
 183.172 -        public static PrimitiveTypeInfo get(Class cl) {
 183.173 +        public static PrimitiveTypeInfo get(Class<?> cl) {
 183.174              return table.get(cl);
 183.175          }
 183.176      }
 183.177 @@ -1694,7 +1693,7 @@
 183.178           * and for assigning the next index value.  Note that element 0
 183.179           * of this list corresponds to constant pool index 1.
 183.180           */
 183.181 -        private List<Entry> pool = new ArrayList<Entry>(32);
 183.182 +        private List<Entry> pool = new ArrayList<>(32);
 183.183  
 183.184          /**
 183.185           * maps constant pool data of all types to constant pool indexes.
 183.186 @@ -1702,7 +1701,7 @@
 183.187           * This map is used to look up the index of an existing entry for
 183.188           * values of all types.
 183.189           */
 183.190 -        private Map<Object,Short> map = new HashMap<Object,Short>(16);
 183.191 +        private Map<Object,Short> map = new HashMap<>(16);
 183.192  
 183.193          /** true if no new constant pool entries may be added */
 183.194          private boolean readOnly = false;
   184.1 --- a/src/share/classes/sun/misc/Queue.java	Tue Dec 06 16:31:58 2011 -0800
   184.2 +++ b/src/share/classes/sun/misc/Queue.java	Mon Dec 19 10:06:23 2011 -0800
   184.3 @@ -35,12 +35,12 @@
   184.4   * @author Herb Jellinek
   184.5   */
   184.6  
   184.7 -public class Queue {
   184.8 +public class Queue<T> {
   184.9  
  184.10      int length = 0;
  184.11  
  184.12 -    QueueElement head = null;
  184.13 -    QueueElement tail = null;
  184.14 +    QueueElement<T> head = null;
  184.15 +    QueueElement<T> tail = null;
  184.16  
  184.17      public Queue() {
  184.18      }
  184.19 @@ -48,9 +48,9 @@
  184.20      /**
  184.21       * Enqueue an object.
  184.22       */
  184.23 -    public synchronized void enqueue(Object obj) {
  184.24 +    public synchronized void enqueue(T obj) {
  184.25  
  184.26 -        QueueElement newElt = new QueueElement(obj);
  184.27 +        QueueElement<T> newElt = new QueueElement<>(obj);
  184.28  
  184.29          if (head == null) {
  184.30              head = newElt;
  184.31 @@ -72,7 +72,7 @@
  184.32       * @exception java.lang.InterruptedException if any thread has
  184.33       *              interrupted this thread.
  184.34       */
  184.35 -    public Object dequeue() throws InterruptedException {
  184.36 +    public T dequeue() throws InterruptedException {
  184.37          return dequeue(0L);
  184.38      }
  184.39  
  184.40 @@ -85,13 +85,13 @@
  184.41       * @exception java.lang.InterruptedException if any thread has
  184.42       *              interrupted this thread.
  184.43       */
  184.44 -    public synchronized Object dequeue(long timeOut)
  184.45 +    public synchronized T dequeue(long timeOut)
  184.46          throws InterruptedException {
  184.47  
  184.48          while (tail == null) {
  184.49              wait(timeOut);
  184.50          }
  184.51 -        QueueElement elt = tail;
  184.52 +        QueueElement<T> elt = tail;
  184.53          tail = elt.prev;
  184.54          if (tail == null) {
  184.55              head = null;
  184.56 @@ -115,8 +115,8 @@
  184.57       * order. Use the Enumeration methods on the returned object to
  184.58       * fetch the elements sequentially.
  184.59       */
  184.60 -    public final synchronized Enumeration elements() {
  184.61 -        return new LIFOQueueEnumerator(this);
  184.62 +    public final synchronized Enumeration<T> elements() {
  184.63 +        return new LIFOQueueEnumerator<>(this);
  184.64      }
  184.65  
  184.66      /**
  184.67 @@ -124,8 +124,8 @@
  184.68       * order. Use the Enumeration methods on the returned object to
  184.69       * fetch the elements sequentially.
  184.70       */
  184.71 -    public final synchronized Enumeration reverseElements() {
  184.72 -        return new FIFOQueueEnumerator(this);
  184.73 +    public final synchronized Enumeration<T> reverseElements() {
  184.74 +        return new FIFOQueueEnumerator<>(this);
  184.75      }
  184.76  
  184.77      public synchronized void dump(String msg) {
  184.78 @@ -133,8 +133,8 @@
  184.79          System.err.println("["+length+" elt(s); head = "+
  184.80                             (head == null ? "null" : (head.obj)+"")+
  184.81                             " tail = "+(tail == null ? "null" : (tail.obj)+""));
  184.82 -        QueueElement cursor = head;
  184.83 -        QueueElement last = null;
  184.84 +        QueueElement<T> cursor = head;
  184.85 +        QueueElement<T> last = null;
  184.86          while (cursor != null) {
  184.87              System.err.println("  "+cursor);
  184.88              last = cursor;
  184.89 @@ -147,11 +147,11 @@
  184.90      }
  184.91  }
  184.92  
  184.93 -final class FIFOQueueEnumerator implements Enumeration {
  184.94 -    Queue queue;
  184.95 -    QueueElement cursor;
  184.96 +final class FIFOQueueEnumerator<T> implements Enumeration<T> {
  184.97 +    Queue<T> queue;
  184.98 +    QueueElement<T> cursor;
  184.99  
 184.100 -    FIFOQueueEnumerator(Queue q) {
 184.101 +    FIFOQueueEnumerator(Queue<T> q) {
 184.102          queue = q;
 184.103          cursor = q.tail;
 184.104      }
 184.105 @@ -160,10 +160,10 @@
 184.106          return (cursor != null);
 184.107      }
 184.108  
 184.109 -    public Object nextElement() {
 184.110 +    public T nextElement() {
 184.111          synchronized (queue) {
 184.112              if (cursor != null) {
 184.113 -                QueueElement result = cursor;
 184.114 +                QueueElement<T> result = cursor;
 184.115                  cursor = cursor.prev;
 184.116                  return result.obj;
 184.117              }
 184.118 @@ -172,11 +172,11 @@
 184.119      }
 184.120  }
 184.121  
 184.122 -final class LIFOQueueEnumerator implements Enumeration {
 184.123 -    Queue queue;
 184.124 -    QueueElement cursor;
 184.125 +final class LIFOQueueEnumerator<T> implements Enumeration<T> {
 184.126 +    Queue<T> queue;
 184.127 +    QueueElement<T> cursor;
 184.128  
 184.129 -    LIFOQueueEnumerator(Queue q) {
 184.130 +    LIFOQueueEnumerator(Queue<T> q) {
 184.131          queue = q;
 184.132          cursor = q.head;
 184.133      }
 184.134 @@ -185,10 +185,10 @@
 184.135          return (cursor != null);
 184.136      }
 184.137  
 184.138 -    public Object nextElement() {
 184.139 +    public T nextElement() {
 184.140          synchronized (queue) {
 184.141              if (cursor != null) {
 184.142 -                QueueElement result = cursor;
 184.143 +                QueueElement<T> result = cursor;
 184.144                  cursor = cursor.next;
 184.145                  return result.obj;
 184.146              }
 184.147 @@ -197,13 +197,13 @@
 184.148      }
 184.149  }
 184.150  
 184.151 -class QueueElement {
 184.152 -    QueueElement next = null;
 184.153 -    QueueElement prev = null;
 184.154 +class QueueElement<T> {
 184.155 +    QueueElement<T> next = null;
 184.156 +    QueueElement<T> prev = null;
 184.157  
 184.158 -    Object obj = null;
 184.159 +    T obj = null;
 184.160  
 184.161 -    QueueElement(Object obj) {
 184.162 +    QueueElement(T obj) {
 184.163          this.obj = obj;
 184.164      }
 184.165  
   185.1 --- a/src/share/classes/sun/misc/RequestProcessor.java	Tue Dec 06 16:31:58 2011 -0800
   185.2 +++ b/src/share/classes/sun/misc/RequestProcessor.java	Mon Dec 19 10:06:23 2011 -0800
   185.3 @@ -36,7 +36,7 @@
   185.4  
   185.5  public class RequestProcessor implements Runnable {
   185.6  
   185.7 -    private static Queue requestQueue;
   185.8 +    private static Queue<Request> requestQueue;
   185.9      private static Thread dispatcher;
  185.10  
  185.11      /**
  185.12 @@ -55,15 +55,12 @@
  185.13          lazyInitialize();
  185.14          while (true) {
  185.15              try {
  185.16 -                Object obj = requestQueue.dequeue();
  185.17 -                if (obj instanceof Request) { // ignore bogons
  185.18 -                    Request req = (Request)obj;
  185.19 -                    try {
  185.20 -                        req.execute();
  185.21 -                    } catch (Throwable t) {
  185.22 -                        // do nothing at the moment...maybe report an error
  185.23 -                        // in the future
  185.24 -                    }
  185.25 +                Request req = requestQueue.dequeue();
  185.26 +                try {
  185.27 +                    req.execute();
  185.28 +                } catch (Throwable t) {
  185.29 +                    // do nothing at the moment...maybe report an error
  185.30 +                    // in the future
  185.31                  }
  185.32              } catch (InterruptedException e) {
  185.33                  // do nothing at the present time.
  185.34 @@ -92,7 +89,7 @@
  185.35       */
  185.36      private static synchronized void lazyInitialize() {
  185.37          if (requestQueue == null) {
  185.38 -            requestQueue = new Queue();
  185.39 +            requestQueue = new Queue<Request>();
  185.40          }
  185.41      }
  185.42  
   186.1 --- a/src/share/classes/sun/misc/Service.java	Tue Dec 06 16:31:58 2011 -0800
   186.2 +++ b/src/share/classes/sun/misc/Service.java	Mon Dec 19 10:06:23 2011 -0800
   186.3 @@ -125,13 +125,13 @@
   186.4   * @since 1.3
   186.5   */
   186.6  
   186.7 -public final class Service {
   186.8 +public final class Service<S> {
   186.9  
  186.10      private static final String prefix = "META-INF/services/";
  186.11  
  186.12      private Service() { }
  186.13  
  186.14 -    private static void fail(Class service, String msg, Throwable cause)
  186.15 +    private static void fail(Class<?> service, String msg, Throwable cause)
  186.16          throws ServiceConfigurationError
  186.17      {
  186.18          ServiceConfigurationError sce
  186.19 @@ -140,13 +140,13 @@
  186.20          throw sce;
  186.21      }
  186.22  
  186.23 -    private static void fail(Class service, String msg)
  186.24 +    private static void fail(Class<?> service, String msg)
  186.25          throws ServiceConfigurationError
  186.26      {
  186.27          throw new ServiceConfigurationError(service.getName() + ": " + msg);
  186.28      }
  186.29  
  186.30 -    private static void fail(Class service, URL u, int line, String msg)
  186.31 +    private static void fail(Class<?> service, URL u, int line, String msg)
  186.32          throws ServiceConfigurationError
  186.33      {
  186.34          fail(service, u + ":" + line + ": " + msg);
  186.35 @@ -157,8 +157,8 @@
  186.36       * on the line to both the names list and the returned set iff the name is
  186.37       * not already a member of the returned set.
  186.38       */
  186.39 -    private static int parseLine(Class service, URL u, BufferedReader r, int lc,
  186.40 -                                 List names, Set returned)
  186.41 +    private static int parseLine(Class<?> service, URL u, BufferedReader r, int lc,
  186.42 +                                 List<String> names, Set<String> returned)
  186.43          throws IOException, ServiceConfigurationError
  186.44      {
  186.45          String ln = r.readLine();
  186.46 @@ -211,12 +211,12 @@
  186.47       *         If an I/O error occurs while reading from the given URL, or
  186.48       *         if a configuration-file format error is detected
  186.49       */
  186.50 -    private static Iterator parse(Class service, URL u, Set returned)
  186.51 +    private static Iterator<String> parse(Class<?> service, URL u, Set<String> returned)
  186.52          throws ServiceConfigurationError
  186.53      {
  186.54          InputStream in = null;
  186.55          BufferedReader r = null;
  186.56 -        ArrayList names = new ArrayList();
  186.57 +        ArrayList<String> names = new ArrayList<>();
  186.58          try {
  186.59              in = u.openStream();
  186.60              r = new BufferedReader(new InputStreamReader(in, "utf-8"));
  186.61 @@ -239,16 +239,16 @@
  186.62      /**
  186.63       * Private inner class implementing fully-lazy provider lookup
  186.64       */
  186.65 -    private static class LazyIterator implements Iterator {
  186.66 +    private static class LazyIterator<S> implements Iterator<S> {
  186.67  
  186.68 -        Class service;
  186.69 +        Class<S> service;
  186.70          ClassLoader loader;
  186.71 -        Enumeration configs = null;
  186.72 -        Iterator pending = null;
  186.73 -        Set returned = new TreeSet();
  186.74 +        Enumeration<URL> configs = null;
  186.75 +        Iterator<String> pending = null;
  186.76 +        Set<String> returned = new TreeSet<>();
  186.77          String nextName = null;
  186.78  
  186.79 -        private LazyIterator(Class service, ClassLoader loader) {
  186.80 +        private LazyIterator(Class<S> service, ClassLoader loader) {
  186.81              this.service = service;
  186.82              this.loader = loader;
  186.83          }
  186.84 @@ -272,20 +272,20 @@
  186.85                  if (!configs.hasMoreElements()) {
  186.86                      return false;
  186.87                  }
  186.88 -                pending = parse(service, (URL)configs.nextElement(), returned);
  186.89 +                pending = parse(service, configs.nextElement(), returned);
  186.90              }
  186.91 -            nextName = (String)pending.next();
  186.92 +            nextName = pending.next();
  186.93              return true;
  186.94          }
  186.95  
  186.96 -        public Object next() throws ServiceConfigurationError {
  186.97 +        public S next() throws ServiceConfigurationError {
  186.98              if (!hasNext()) {
  186.99                  throw new NoSuchElementException();
 186.100              }
 186.101              String cn = nextName;
 186.102              nextName = null;
 186.103              try {
 186.104 -                return Class.forName(cn, true, loader).newInstance();
 186.105 +                return service.cast(Class.forName(cn, true, loader).newInstance());
 186.106              } catch (ClassNotFoundException x) {
 186.107                  fail(service,
 186.108                       "Provider " + cn + " not found");
 186.109 @@ -342,10 +342,10 @@
 186.110       * @see #providers(java.lang.Class)
 186.111       * @see #installedProviders(java.lang.Class)
 186.112       */
 186.113 -    public static Iterator providers(Class service, ClassLoader loader)
 186.114 +    public static <S> Iterator<S> providers(Class<S> service, ClassLoader loader)
 186.115          throws ServiceConfigurationError
 186.116      {
 186.117 -        return new LazyIterator(service, loader);
 186.118 +        return new LazyIterator<S>(service, loader);
 186.119      }
 186.120  
 186.121  
 186.122 @@ -374,7 +374,7 @@
 186.123       *
 186.124       * @see #providers(java.lang.Class, java.lang.ClassLoader)
 186.125       */
 186.126 -    public static Iterator providers(Class service)
 186.127 +    public static <S> Iterator<S> providers(Class<S> service)
 186.128          throws ServiceConfigurationError
 186.129      {
 186.130          ClassLoader cl = Thread.currentThread().getContextClassLoader();
 186.131 @@ -411,7 +411,7 @@
 186.132       *
 186.133       * @see #providers(java.lang.Class, java.lang.ClassLoader)
 186.134       */
 186.135 -    public static Iterator installedProviders(Class service)
 186.136 +    public static <S> Iterator<S> installedProviders(Class<S> service)
 186.137          throws ServiceConfigurationError
 186.138      {
 186.139          ClassLoader cl = ClassLoader.getSystemClassLoader();
   187.1 --- a/src/share/classes/sun/misc/ServiceConfigurationError.java	Tue Dec 06 16:31:58 2011 -0800
   187.2 +++ b/src/share/classes/sun/misc/ServiceConfigurationError.java	Mon Dec 19 10:06:23 2011 -0800
   187.3 @@ -43,6 +43,8 @@
   187.4  
   187.5  public class ServiceConfigurationError extends Error {
   187.6  
   187.7 +    static final long serialVersionUID = 8769866263384244465L;
   187.8 +
   187.9      /**
  187.10       * Constructs a new instance with the specified detail string.
  187.11       */
   188.1 --- a/src/share/classes/sun/misc/Signal.java	Tue Dec 06 16:31:58 2011 -0800
   188.2 +++ b/src/share/classes/sun/misc/Signal.java	Mon Dec 19 10:06:23 2011 -0800
   188.3 @@ -72,8 +72,8 @@
   188.4   * @since    1.2
   188.5   */
   188.6  public final class Signal {
   188.7 -    private static Hashtable handlers = new Hashtable(4);
   188.8 -    private static Hashtable signals = new Hashtable(4);
   188.9 +    private static Hashtable<Signal,SignalHandler> handlers = new Hashtable<>(4);
  188.10 +    private static Hashtable<Integer,Signal> signals = new Hashtable<>(4);
  188.11  
  188.12      private int number;
  188.13      private String name;
  188.14 @@ -166,9 +166,9 @@
  188.15              throw new IllegalArgumentException
  188.16                  ("Signal already used by VM or OS: " + sig);
  188.17          }
  188.18 -        signals.put(new Integer(sig.number), sig);
  188.19 +        signals.put(sig.number, sig);
  188.20          synchronized (handlers) {
  188.21 -            SignalHandler oldHandler = (SignalHandler)handlers.get(sig);
  188.22 +            SignalHandler oldHandler = handlers.get(sig);
  188.23              handlers.remove(sig);
  188.24              if (newH == 2) {
  188.25                  handlers.put(sig, handler);
  188.26 @@ -200,8 +200,8 @@
  188.27  
  188.28      /* Called by the VM to execute Java signal handlers. */
  188.29      private static void dispatch(final int number) {
  188.30 -        final Signal sig = (Signal)signals.get(new Integer(number));
  188.31 -        final SignalHandler handler = (SignalHandler)handlers.get(sig);
  188.32 +        final Signal sig = signals.get(number);
  188.33 +        final SignalHandler handler = handlers.get(sig);
  188.34  
  188.35          Runnable runnable = new Runnable () {
  188.36              public void run() {
   189.1 --- a/src/share/classes/sun/misc/URLClassPath.java	Tue Dec 06 16:31:58 2011 -0800
   189.2 +++ b/src/share/classes/sun/misc/URLClassPath.java	Mon Dec 19 10:06:23 2011 -0800
   189.3 @@ -836,10 +836,9 @@
   189.4                               Set<String> visited) {
   189.5  
   189.6              Resource res;
   189.7 -            Object[] jarFiles;
   189.8 -            boolean done = false;
   189.9 +            String[] jarFiles;
  189.10              int count = 0;
  189.11 -            LinkedList jarFilesList = null;
  189.12 +            LinkedList<String> jarFilesList = null;
  189.13  
  189.14              /* If there no jar files in the index that can potential contain
  189.15               * this resource then return immediately.
  189.16 @@ -848,11 +847,11 @@
  189.17                  return null;
  189.18  
  189.19              do {
  189.20 -                jarFiles = jarFilesList.toArray();
  189.21                  int size = jarFilesList.size();
  189.22 +                jarFiles = jarFilesList.toArray(new String[size]);
  189.23                  /* loop through the mapped jar file list */
  189.24                  while(count < size) {
  189.25 -                    String jarName = (String)jarFiles[count++];
  189.26 +                    String jarName = jarFiles[count++];
  189.27                      JarLoader newLoader;
  189.28                      final URL url;
  189.29  
   190.1 --- a/src/share/classes/sun/misc/Unsafe.java	Tue Dec 06 16:31:58 2011 -0800
   190.2 +++ b/src/share/classes/sun/misc/Unsafe.java	Mon Dec 19 10:06:23 2011 -0800
   190.3 @@ -81,7 +81,7 @@
   190.4       *             access to the system properties.
   190.5       */
   190.6      public static Unsafe getUnsafe() {
   190.7 -        Class cc = sun.reflect.Reflection.getCallerClass(2);
   190.8 +        Class<?> cc = sun.reflect.Reflection.getCallerClass(2);
   190.9          if (cc.getClassLoader() != null)
  190.10              throw new SecurityException("Unsafe");
  190.11          return theUnsafe;
  190.12 @@ -616,7 +616,7 @@
  190.13       * for a given class in one place.
  190.14       */
  190.15      @Deprecated
  190.16 -    public Object staticFieldBase(Class c) {
  190.17 +    public Object staticFieldBase(Class<?> c) {
  190.18          Field[] fields = c.getDeclaredFields();
  190.19          for (int i = 0; i < fields.length; i++) {
  190.20              if (Modifier.isStatic(fields[i].getModifiers())) {
  190.21 @@ -682,7 +682,7 @@
  190.22       * needed in conjunction with obtaining the static field base of a
  190.23       * class.
  190.24       */
  190.25 -    public native void ensureClassInitialized(Class c);
  190.26 +    public native void ensureClassInitialized(Class<?> c);
  190.27  
  190.28      /**
  190.29       * Report the offset of the first element in the storage allocation of a
  190.30 @@ -694,7 +694,7 @@
  190.31       * @see #getInt(Object, long)
  190.32       * @see #putInt(Object, long, int)
  190.33       */
  190.34 -    public native int arrayBaseOffset(Class arrayClass);
  190.35 +    public native int arrayBaseOffset(Class<?> arrayClass);
  190.36  
  190.37      /** The value of {@code arrayBaseOffset(boolean[].class)} */
  190.38      public static final int ARRAY_BOOLEAN_BASE_OFFSET
  190.39 @@ -743,7 +743,7 @@
  190.40       * @see #getInt(Object, long)
  190.41       * @see #putInt(Object, long, int)
  190.42       */
  190.43 -    public native int arrayIndexScale(Class arrayClass);
  190.44 +    public native int arrayIndexScale(Class<?> arrayClass);
  190.45  
  190.46      /** The value of {@code arrayIndexScale(boolean[].class)} */
  190.47      public static final int ARRAY_BOOLEAN_INDEX_SCALE
  190.48 @@ -805,11 +805,11 @@
  190.49       * Tell the VM to define a class, without security checks.  By default, the
  190.50       * class loader and protection domain come from the caller's class.
  190.51       */
  190.52 -    public native Class defineClass(String name, byte[] b, int off, int len,
  190.53 -                                    ClassLoader loader,
  190.54 -                                    ProtectionDomain protectionDomain);
  190.55 +    public native Class<?> defineClass(String name, byte[] b, int off, int len,
  190.56 +                                       ClassLoader loader,
  190.57 +                                       ProtectionDomain protectionDomain);
  190.58  
  190.59 -    public native Class defineClass(String name, byte[] b, int off, int len);
  190.60 +    public native Class<?> defineClass(String name, byte[] b, int off, int len);
  190.61  
  190.62      /**
  190.63       * Define a class but do not make it known to the class loader or system dictionary.
  190.64 @@ -827,12 +827,12 @@
  190.65       * @params data      bytes of a class file
  190.66       * @params cpPatches where non-null entries exist, they replace corresponding CP entries in data
  190.67       */
  190.68 -    public native Class defineAnonymousClass(Class hostClass, byte[] data, Object[] cpPatches);
  190.69 +    public native Class<?> defineAnonymousClass(Class<?> hostClass, byte[] data, Object[] cpPatches);
  190.70  
  190.71  
  190.72      /** Allocate an instance but do not run any constructor.
  190.73          Initializes the class if it has not yet been. */
  190.74 -    public native Object allocateInstance(Class cls)
  190.75 +    public native Object allocateInstance(Class<?> cls)
  190.76          throws InstantiationException;
  190.77  
  190.78      /** Lock the object.  It must get unlocked via {@link #monitorExit}. */
   191.1 --- a/src/share/classes/sun/misc/VM.java	Tue Dec 06 16:31:58 2011 -0800
   191.2 +++ b/src/share/classes/sun/misc/VM.java	Mon Dec 19 10:06:23 2011 -0800
   191.3 @@ -48,6 +48,7 @@
   191.4          return suspended;
   191.5      }
   191.6  
   191.7 +    @SuppressWarnings("deprecation")
   191.8      public static boolean allowThreadSuspension(ThreadGroup g, boolean b) {
   191.9          return g.allowThreadSuspension(b);
  191.10      }
   192.1 --- a/src/share/classes/sun/net/RegisteredDomain.java	Tue Dec 06 16:31:58 2011 -0800
   192.2 +++ b/src/share/classes/sun/net/RegisteredDomain.java	Mon Dec 19 10:06:23 2011 -0800
   192.3 @@ -118,8 +118,8 @@
   192.4  private static Set<String>  usSubStateSet = new HashSet<String>(Arrays.asList("state",
   192.5                  "lib", "k12", "cc", "tec", "gen", "cog", "mus", "dst"));
   192.6  
   192.7 -private static Map<String,Set> topMap = new HashMap<String,Set>();
   192.8 -private static Map<String,Set> top3Map = new HashMap<String,Set>();
   192.9 +private static Map<String,Set<String>> topMap = new HashMap<>();
  192.10 +private static Map<String,Set<String>> top3Map = new HashMap<>();
  192.11  
  192.12  static {
  192.13      /*
  192.14 @@ -764,7 +764,7 @@
  192.15           */
  192.16          String str = cname.substring(third + 1);
  192.17          if (third != -1) {
  192.18 -            Set set = top3Map.get(s);
  192.19 +            Set<String> set = top3Map.get(s);
  192.20              if (set != null) {
  192.21                  if (set.contains(str)) {
  192.22                      return cname.substring(fourth + 1);
  192.23 @@ -801,7 +801,7 @@
  192.24          /*
  192.25           * XX.MA.US.
  192.26           */
  192.27 -        Set topSet = topMap.get(s);
  192.28 +        Set<String> topSet = topMap.get(s);
  192.29          if (topSet != null) {
  192.30              if (topSet.contains(s2)) {
  192.31                  return cname.substring(third + 1);
   193.1 --- a/src/share/classes/sun/net/ftp/FtpClientProvider.java	Tue Dec 06 16:31:58 2011 -0800
   193.2 +++ b/src/share/classes/sun/net/ftp/FtpClientProvider.java	Mon Dec 19 10:06:23 2011 -0800
   193.3 @@ -27,7 +27,7 @@
   193.4  import java.security.AccessController;
   193.5  import java.security.PrivilegedAction;
   193.6  import java.util.ServiceConfigurationError;
   193.7 -//import sun.misc.Service;
   193.8 +//import java.util.ServiceLoader;
   193.9  
  193.10  /**
  193.11   * Service provider class for FtpClient.
  193.12 @@ -79,20 +79,22 @@
  193.13      }
  193.14  
  193.15      private static boolean loadProviderAsService() {
  193.16 -        //        Iterator i = Service.providers(FtpClientProvider.class,
  193.17 -        //                ClassLoader.getSystemClassLoader());
  193.18 -        //        while (i.hasNext()) {
  193.19 -        //            try {
  193.20 -        //                provider = (FtpClientProvider) i.next();
  193.21 -        //                return true;
  193.22 -        //            } catch (ServiceConfigurationError sce) {
  193.23 -        //                if (sce.getCause() instanceof SecurityException) {
  193.24 -        //                    // Ignore, try next provider, if any
  193.25 -        //                    continue;
  193.26 -        //                }
  193.27 -        //                throw sce;
  193.28 -        //            }
  193.29 -        //        }
  193.30 +//        Iterator<FtpClientProvider> i =
  193.31 +//                ServiceLoader.load(FtpClientProvider.class,
  193.32 +//                                   ClassLoader.getSystemClassLoader()).iterator();
  193.33 +//
  193.34 +//        while (i.hasNext()) {
  193.35 +//            try {
  193.36 +//                provider = i.next();
  193.37 +//                return true;
  193.38 +//            } catch (ServiceConfigurationError sce) {
  193.39 +//                if (sce.getCause() instanceof SecurityException) {
  193.40 +//                    // Ignore, try next provider, if any
  193.41 +//                    continue;
  193.42 +//                }
  193.43 +//                throw sce;
  193.44 +//            }
  193.45 +//        }
  193.46          return false;
  193.47      }
  193.48  
   194.1 --- a/src/share/classes/sun/net/www/protocol/jar/Handler.java	Tue Dec 06 16:31:58 2011 -0800
   194.2 +++ b/src/share/classes/sun/net/www/protocol/jar/Handler.java	Mon Dec 19 10:06:23 2011 -0800
   194.3 @@ -123,6 +123,7 @@
   194.4  
   194.5  
   194.6      @Override
   194.7 +    @SuppressWarnings("deprecation")
   194.8      protected void parseURL(URL url, String spec,
   194.9                              int start, int limit) {
  194.10          String file = null;
   195.1 --- a/src/share/classes/sun/nio/ch/SocketAdaptor.java	Tue Dec 06 16:31:58 2011 -0800
   195.2 +++ b/src/share/classes/sun/nio/ch/SocketAdaptor.java	Mon Dec 19 10:06:23 2011 -0800
   195.3 @@ -57,13 +57,17 @@
   195.4      // Timeout "option" value for reads
   195.5      private volatile int timeout = 0;
   195.6  
   195.7 -    // ## super will create a useless impl
   195.8 -    private SocketAdaptor(SocketChannelImpl sc) {
   195.9 +    private SocketAdaptor(SocketChannelImpl sc) throws SocketException {
  195.10 +        super((SocketImpl) null);
  195.11          this.sc = sc;
  195.12      }
  195.13  
  195.14      public static Socket create(SocketChannelImpl sc) {
  195.15 -        return new SocketAdaptor(sc);
  195.16 +        try {
  195.17 +            return new SocketAdaptor(sc);
  195.18 +        } catch (SocketException e) {
  195.19 +            throw new InternalError("Should not reach here");
  195.20 +        }
  195.21      }
  195.22  
  195.23      public SocketChannel getChannel() {
   196.1 --- a/src/share/classes/sun/security/provider/certpath/ssl/SSLServerCertStore.java	Tue Dec 06 16:31:58 2011 -0800
   196.2 +++ b/src/share/classes/sun/security/provider/certpath/ssl/SSLServerCertStore.java	Mon Dec 19 10:06:23 2011 -0800
   196.3 @@ -44,12 +44,16 @@
   196.4  import java.security.cert.CRLSelector;
   196.5  import java.security.cert.X509Certificate;
   196.6  import java.security.cert.X509CRL;
   196.7 +import java.net.Socket;
   196.8 +import java.net.URLConnection;
   196.9  import javax.net.ssl.HostnameVerifier;
  196.10  import javax.net.ssl.HttpsURLConnection;
  196.11  import javax.net.ssl.SSLContext;
  196.12  import javax.net.ssl.SSLSession;
  196.13 +import javax.net.ssl.SSLEngine;
  196.14 +import javax.net.ssl.SSLSocketFactory;
  196.15  import javax.net.ssl.TrustManager;
  196.16 -import javax.net.ssl.X509TrustManager;
  196.17 +import javax.net.ssl.X509ExtendedTrustManager;
  196.18  
  196.19  /**
  196.20   * A CertStore that retrieves an SSL server's certificate chain.
  196.21 @@ -57,31 +61,74 @@
  196.22  public final class SSLServerCertStore extends CertStoreSpi {
  196.23  
  196.24      private final URI uri;
  196.25 +    private final static GetChainTrustManager trustManager;
  196.26 +    private final static SSLSocketFactory socketFactory;
  196.27 +    private final static HostnameVerifier hostnameVerifier;
  196.28 +
  196.29 +    static {
  196.30 +        trustManager = new GetChainTrustManager();
  196.31 +        hostnameVerifier = new HostnameVerifier() {
  196.32 +            public boolean verify(String hostname, SSLSession session) {
  196.33 +                return true;
  196.34 +            }
  196.35 +        };
  196.36 +
  196.37 +        SSLSocketFactory tempFactory;
  196.38 +        try {
  196.39 +            SSLContext context = SSLContext.getInstance("SSL");
  196.40 +            context.init(null, new TrustManager[] { trustManager }, null);
  196.41 +            tempFactory = context.getSocketFactory();
  196.42 +        } catch (GeneralSecurityException gse) {
  196.43 +            tempFactory = null;
  196.44 +        }
  196.45 +
  196.46 +        socketFactory = tempFactory;
  196.47 +    }
  196.48  
  196.49      SSLServerCertStore(URI uri) throws InvalidAlgorithmParameterException {
  196.50          super(null);
  196.51          this.uri = uri;
  196.52      }
  196.53  
  196.54 -    public synchronized Collection<X509Certificate> engineGetCertificates
  196.55 -        (CertSelector selector) throws CertStoreException
  196.56 -    {
  196.57 +    public Collection<X509Certificate> engineGetCertificates
  196.58 +            (CertSelector selector) throws CertStoreException {
  196.59 +
  196.60          try {
  196.61 -            SSLContext sc = SSLContext.getInstance("SSL");
  196.62 -            GetChainTrustManager xtm = new GetChainTrustManager();
  196.63 -            sc.init(null, new TrustManager[] { xtm }, null);
  196.64 -            HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
  196.65 -            HttpsURLConnection.setDefaultHostnameVerifier(
  196.66 -                new HostnameVerifier() {
  196.67 -                    public boolean verify(String hostname, SSLSession session) {
  196.68 -                        return true;
  196.69 +            URLConnection urlConn = uri.toURL().openConnection();
  196.70 +            if (urlConn instanceof HttpsURLConnection) {
  196.71 +                if (socketFactory == null) {
  196.72 +                    throw new CertStoreException(
  196.73 +                        "No initialized SSLSocketFactory");
  196.74 +                }
  196.75 +
  196.76 +                HttpsURLConnection https = (HttpsURLConnection)urlConn;
  196.77 +                https.setSSLSocketFactory(socketFactory);
  196.78 +                https.setHostnameVerifier(hostnameVerifier);
  196.79 +                synchronized (trustManager) {
  196.80 +                    try {
  196.81 +                        https.connect();
  196.82 +                        return getMatchingCerts(
  196.83 +                            trustManager.serverChain, selector);
  196.84 +                    } catch (IOException ioe) {
  196.85 +                        // If the server certificate has already been
  196.86 +                        // retrieved, don't mind the connection state.
  196.87 +                        if (trustManager.exchangedServerCerts) {
  196.88 +                            return getMatchingCerts(
  196.89 +                                trustManager.serverChain, selector);
  196.90 +                        }
  196.91 +
  196.92 +                        // otherwise, rethrow the exception
  196.93 +                        throw ioe;
  196.94 +                    } finally {
  196.95 +                        trustManager.cleanup();
  196.96                      }
  196.97 -            });
  196.98 -            uri.toURL().openConnection().connect();
  196.99 -            return getMatchingCerts(xtm.serverChain, selector);
 196.100 -        } catch (GeneralSecurityException | IOException e) {
 196.101 -            throw new CertStoreException(e);
 196.102 +                }
 196.103 +            }
 196.104 +        } catch (IOException ioe) {
 196.105 +            throw new CertStoreException(ioe);
 196.106          }
 196.107 +
 196.108 +        return Collections.<X509Certificate>emptySet();
 196.109      }
 196.110  
 196.111      private static List<X509Certificate> getMatchingCerts
 196.112 @@ -106,37 +153,77 @@
 196.113          throw new UnsupportedOperationException();
 196.114      }
 196.115  
 196.116 -    static synchronized CertStore getInstance(URI uri)
 196.117 +    static CertStore getInstance(URI uri)
 196.118          throws InvalidAlgorithmParameterException
 196.119      {
 196.120          return new CS(new SSLServerCertStore(uri), null, "SSLServer", null);
 196.121      }
 196.122  
 196.123      /*
 196.124 -     * An X509TrustManager that simply stores a reference to the server's
 196.125 -     * certificate chain.
 196.126 +     * An X509ExtendedTrustManager that ignores the server certificate
 196.127 +     * validation.
 196.128       */
 196.129 -    private static class GetChainTrustManager implements X509TrustManager {
 196.130 -        private List<X509Certificate> serverChain;
 196.131 +    private static class GetChainTrustManager
 196.132 +            extends X509ExtendedTrustManager {
 196.133  
 196.134 +        private List<X509Certificate> serverChain =
 196.135 +                        Collections.<X509Certificate>emptyList();
 196.136 +        private boolean exchangedServerCerts = false;
 196.137 +
 196.138 +        @Override
 196.139          public X509Certificate[] getAcceptedIssuers() {
 196.140 +            return new X509Certificate[0];
 196.141 +        }
 196.142 +
 196.143 +        @Override
 196.144 +        public void checkClientTrusted(X509Certificate[] chain,
 196.145 +                String authType) throws CertificateException {
 196.146 +
 196.147              throw new UnsupportedOperationException();
 196.148          }
 196.149  
 196.150 -        public void checkClientTrusted(X509Certificate[] chain,
 196.151 -                                       String authType)
 196.152 -            throws CertificateException
 196.153 -        {
 196.154 +        @Override
 196.155 +        public void checkClientTrusted(X509Certificate[] chain, String authType,
 196.156 +                Socket socket) throws CertificateException {
 196.157 +
 196.158              throw new UnsupportedOperationException();
 196.159          }
 196.160  
 196.161 +        @Override
 196.162 +        public void checkClientTrusted(X509Certificate[] chain, String authType,
 196.163 +                SSLEngine engine) throws CertificateException {
 196.164 +
 196.165 +            throw new UnsupportedOperationException();
 196.166 +        }
 196.167 +
 196.168 +        @Override
 196.169          public void checkServerTrusted(X509Certificate[] chain,
 196.170 -                                       String authType)
 196.171 -            throws CertificateException
 196.172 -        {
 196.173 +                String authType) throws CertificateException {
 196.174 +
 196.175 +            exchangedServerCerts = true;
 196.176              this.serverChain = (chain == null)
 196.177 -                               ? Collections.<X509Certificate>emptyList()
 196.178 -                               : Arrays.asList(chain);
 196.179 +                           ? Collections.<X509Certificate>emptyList()
 196.180 +                           : Arrays.<X509Certificate>asList(chain);
 196.181 +
 196.182 +        }
 196.183 +
 196.184 +        @Override
 196.185 +        public void checkServerTrusted(X509Certificate[] chain, String authType,
 196.186 +                Socket socket) throws CertificateException {
 196.187 +
 196.188 +            checkServerTrusted(chain, authType);
 196.189 +        }
 196.190 +
 196.191 +        @Override
 196.192 +        public void checkServerTrusted(X509Certificate[] chain, String authType,
 196.193 +                SSLEngine engine) throws CertificateException {
 196.194 +
 196.195 +            checkServerTrusted(chain, authType);
 196.196 +        }
 196.197 +
 196.198 +        void cleanup() {
 196.199 +            exchangedServerCerts = false;
 196.200 +            serverChain = Collections.<X509Certificate>emptyList();
 196.201          }
 196.202      }
 196.203  
   197.1 --- a/src/share/classes/sun/text/CompactByteArray.java	Tue Dec 06 16:31:58 2011 -0800
   197.2 +++ b/src/share/classes/sun/text/CompactByteArray.java	Mon Dec 19 10:06:23 2011 -0800
   197.3 @@ -264,9 +264,9 @@
   197.4      {
   197.5          try {
   197.6              CompactByteArray other = (CompactByteArray) super.clone();
   197.7 -            other.values = (byte[])values.clone();
   197.8 -            other.indices = (short[])indices.clone();
   197.9 -            if (hashes != null) other.hashes = (int[])hashes.clone();
  197.10 +            other.values = values.clone();
  197.11 +            other.indices = indices.clone();
  197.12 +            if (hashes != null) other.hashes = hashes.clone();
  197.13              return other;
  197.14          } catch (CloneNotSupportedException e) {
  197.15              throw new InternalError(e);
   198.1 --- a/src/share/classes/sun/text/IntHashtable.java	Tue Dec 06 16:31:58 2011 -0800
   198.2 +++ b/src/share/classes/sun/text/IntHashtable.java	Mon Dec 19 10:06:23 2011 -0800
   198.3 @@ -122,11 +122,11 @@
   198.4              // this line just scrambles the bits as each value is added into the
   198.5              // has value.  This helps to make sure we affect all the bits and that
   198.6              // the same values in a different order will produce a different hash value
   198.7 -            result = (int)(result * scrambler + 1);
   198.8 +            result = result * scrambler + 1;
   198.9              result += keyList[i];
  198.10          }
  198.11          for (int i = 0; i < values.length; ++i) {
  198.12 -            result = (int)(result * scrambler + 1);
  198.13 +            result = result * scrambler + 1;
  198.14              result += values[i];
  198.15          }
  198.16          return result;
  198.17 @@ -135,8 +135,8 @@
  198.18      public Object clone ()
  198.19                      throws CloneNotSupportedException {
  198.20          IntHashtable result = (IntHashtable) super.clone();
  198.21 -        values = (int[]) values.clone();
  198.22 -        keyList = (int[])keyList.clone();
  198.23 +        values = values.clone();
  198.24 +        keyList = keyList.clone();
  198.25          return result;
  198.26      }
  198.27  
   199.1 --- a/src/share/classes/sun/text/bidi/BidiBase.java	Tue Dec 06 16:31:58 2011 -0800
   199.2 +++ b/src/share/classes/sun/text/bidi/BidiBase.java	Mon Dec 19 10:06:23 2011 -0800
   199.3 @@ -1106,7 +1106,7 @@
   199.4       * Assume sizeNeeded>0.
   199.5       * If object != null, then assume size > 0.
   199.6       */
   199.7 -    private Object getMemory(String label, Object array, Class arrayClass,
   199.8 +    private Object getMemory(String label, Object array, Class<?> arrayClass,
   199.9              boolean mayAllocate, int sizeNeeded)
  199.10      {
  199.11          int len = Array.getLength(array);
  199.12 @@ -1990,7 +1990,7 @@
  199.13          cell = impTab[oldStateSeq][_prop];
  199.14          levState.state = GetState(cell);        /* isolate the new state */
  199.15          actionSeq = impAct[GetAction(cell)];    /* isolate the action */
  199.16 -        addLevel = (byte)impTab[levState.state][IMPTABLEVELS_RES];
  199.17 +        addLevel = impTab[levState.state][IMPTABLEVELS_RES];
  199.18  
  199.19          if (actionSeq != 0) {
  199.20              switch (actionSeq) {
  199.21 @@ -2014,7 +2014,7 @@
  199.22                      /* nothing, just clean up */
  199.23                      levState.lastStrongRTL = -1;
  199.24                      /* check if we have a pending conditional segment */
  199.25 -                    level = (byte)impTab[oldStateSeq][IMPTABLEVELS_RES];
  199.26 +                    level = impTab[oldStateSeq][IMPTABLEVELS_RES];
  199.27                      if ((level & 1) != 0 && levState.startON > 0) { /* after ON */
  199.28                          start = levState.startON;   /* reset to basic run level */
  199.29                      }
  199.30 @@ -2115,7 +2115,7 @@
  199.31                  break;
  199.32  
  199.33              case 11:                    /* L after L+ON+EN/AN/ON */
  199.34 -                level = (byte)levState.runLevel;
  199.35 +                level = levState.runLevel;
  199.36                  for (k = start0-1; k >= levState.startON; k--) {
  199.37                      if (levels[k] == level+3) {
  199.38                          while (levels[k] == level+3) {
  199.39 @@ -2178,7 +2178,7 @@
  199.40          levState.runLevel = levels[start];
  199.41          levState.impTab = impTabPair.imptab[levState.runLevel & 1];
  199.42          levState.impAct = impTabPair.impact[levState.runLevel & 1];
  199.43 -        processPropertySeq(levState, (short)sor, start, start);
  199.44 +        processPropertySeq(levState, sor, start, start);
  199.45          /* initialize for property state table */
  199.46          if (dirProps[start] == NSM) {
  199.47              stateImp = (short)(1 + sor);
  199.48 @@ -2230,7 +2230,7 @@
  199.49              }
  199.50          }
  199.51          /* flush possible pending sequence, e.g. ON */
  199.52 -        processPropertySeq(levState, (short)eor, limit, limit);
  199.53 +        processPropertySeq(levState, eor, limit, limit);
  199.54      }
  199.55  
  199.56      /* perform (L1) and (X9) ---------------------------------------------------- */
  199.57 @@ -3484,6 +3484,7 @@
  199.58              }
  199.59          }
  199.60  
  199.61 +        @SuppressWarnings("serial")
  199.62          private static AttributedCharacterIterator.Attribute
  199.63              getTextAttribute(String name)
  199.64          {
   200.1 --- a/src/share/classes/sun/text/normalizer/ICUData.java	Tue Dec 06 16:31:58 2011 -0800
   200.2 +++ b/src/share/classes/sun/text/normalizer/ICUData.java	Mon Dec 19 10:06:23 2011 -0800
   200.3 @@ -48,12 +48,12 @@
   200.4   */
   200.5  public final class ICUData {
   200.6  
   200.7 -    private static InputStream getStream(final Class root, final String resourceName, boolean required) {
   200.8 +    private static InputStream getStream(final Class<ICUData> root, final String resourceName, boolean required) {
   200.9          InputStream i = null;
  200.10  
  200.11          if (System.getSecurityManager() != null) {
  200.12 -            i = (InputStream)AccessController.doPrivileged(new PrivilegedAction() {
  200.13 -                    public Object run() {
  200.14 +            i = AccessController.doPrivileged(new PrivilegedAction<InputStream>() {
  200.15 +                    public InputStream run() {
  200.16                          return root.getResourceAsStream(resourceName);
  200.17                      }
  200.18                  });
   201.1 --- a/src/share/classes/sun/text/normalizer/NormalizerBase.java	Tue Dec 06 16:31:58 2011 -0800
   201.2 +++ b/src/share/classes/sun/text/normalizer/NormalizerBase.java	Mon Dec 19 10:06:23 2011 -0800
   201.3 @@ -886,6 +886,7 @@
   201.4       * @deprecated ICU 3.2
   201.5       * @obsolete ICU 3.2
   201.6       */
   201.7 +     @Deprecated
   201.8       public int setIndex(int index) {
   201.9           setIndexOnly(index);
  201.10           return current();
  201.11 @@ -899,6 +900,7 @@
  201.12       * @return The codepoint as an int
  201.13       * @see #startIndex
  201.14       */
  201.15 +    @Deprecated
  201.16      public int getBeginIndex() {
  201.17          return 0;
  201.18      }
  201.19 @@ -911,6 +913,7 @@
  201.20       * @return The codepoint as an int
  201.21       * @see #endIndex
  201.22       */
  201.23 +    @Deprecated
  201.24      public int getEndIndex() {
  201.25          return endIndex();
  201.26      }
  201.27 @@ -1235,11 +1238,11 @@
  201.28                                                  mode, options);
  201.29  
  201.30                  if(pNeededToNormalize!=null) {
  201.31 -                    pNeededToNormalize[0]=(boolean)(destLength!=bufferLength ||
  201.32 -                                                    Utility.arrayRegionMatches(
  201.33 -                                                                               buffer,0,dest,
  201.34 -                                                                               destStart,destLimit
  201.35 -                                                                               ));
  201.36 +                    pNeededToNormalize[0]=destLength!=bufferLength ||
  201.37 +                                          Utility.arrayRegionMatches(
  201.38 +                                            buffer,0,dest,
  201.39 +                                            destStart,destLimit
  201.40 +                                          );
  201.41                  }
  201.42              } else {
  201.43                  /* just copy the source characters */
  201.44 @@ -1458,10 +1461,10 @@
  201.45                                            dest,destStart,destLimit, options);
  201.46  
  201.47                  if(pNeededToNormalize!=null) {
  201.48 -                    pNeededToNormalize[0]=(boolean)(destLength!=bufferLength ||
  201.49 -                                                    Utility.arrayRegionMatches(buffer,startIndex[0],
  201.50 -                                                                               dest,destStart,
  201.51 -                                                                               destLength));
  201.52 +                    pNeededToNormalize[0]=destLength!=bufferLength ||
  201.53 +                                          Utility.arrayRegionMatches(buffer,startIndex[0],
  201.54 +                                            dest,destStart,
  201.55 +                                            destLength);
  201.56                  }
  201.57              } else {
  201.58                  /* just copy the source characters */
   202.1 --- a/src/share/classes/sun/text/normalizer/NormalizerImpl.java	Tue Dec 06 16:31:58 2011 -0800
   202.2 +++ b/src/share/classes/sun/text/normalizer/NormalizerImpl.java	Mon Dec 19 10:06:23 2011 -0800
   202.3 @@ -98,11 +98,11 @@
   202.4      private static final int EXTRA_SHIFT=16;
   202.5  
   202.6      /* norm32 value constants using >16 bits */
   202.7 -    private static final long  MIN_SPECIAL    =  (long)(0xfc000000 & UNSIGNED_INT_MASK);
   202.8 -    private static final long  SURROGATES_TOP =  (long)(0xfff00000 & UNSIGNED_INT_MASK);
   202.9 -    private static final long  MIN_HANGUL     =  (long)(0xfff00000 & UNSIGNED_INT_MASK);
  202.10 -//  private static final long  MIN_JAMO_V     =  (long)(0xfff20000 & UNSIGNED_INT_MASK);
  202.11 -    private static final long  JAMO_V_TOP     =  (long)(0xfff30000 & UNSIGNED_INT_MASK);
  202.12 +    private static final long  MIN_SPECIAL    =  0xfc000000 & UNSIGNED_INT_MASK;
  202.13 +    private static final long  SURROGATES_TOP =  0xfff00000 & UNSIGNED_INT_MASK;
  202.14 +    private static final long  MIN_HANGUL     =  0xfff00000 & UNSIGNED_INT_MASK;
  202.15 +//  private static final long  MIN_JAMO_V     =  0xfff20000 & UNSIGNED_INT_MASK;
  202.16 +    private static final long  JAMO_V_TOP     =  0xfff30000 & UNSIGNED_INT_MASK;
  202.17  
  202.18  
  202.19      /* indexes[] value names */
  202.20 @@ -134,7 +134,7 @@
  202.21      private static final int AUX_COMP_EX_SHIFT           = 10;
  202.22      private static final int AUX_NFC_SKIPPABLE_F_SHIFT = 12;
  202.23  
  202.24 -    private static final int AUX_MAX_FNC          =   ((int)1<<AUX_COMP_EX_SHIFT);
  202.25 +    private static final int AUX_MAX_FNC          =   1<<AUX_COMP_EX_SHIFT;
  202.26      private static final int AUX_UNSAFE_MASK      =   (int)((1<<AUX_UNSAFE_SHIFT) & UNSIGNED_INT_MASK);
  202.27      private static final int AUX_FNC_MASK         =   (int)((AUX_MAX_FNC-1) & UNSIGNED_INT_MASK);
  202.28      private static final int AUX_COMP_EX_MASK     =   (int)((1<<AUX_COMP_EX_SHIFT) & UNSIGNED_INT_MASK);
  202.29 @@ -188,7 +188,7 @@
  202.30          */
  202.31          /* auxTrie: the folding offset is in bits 9..0 of the 16-bit trie result */
  202.32          public int getFoldingOffset(int value){
  202.33 -            return (int)(value &AUX_FNC_MASK)<<SURROGATE_BLOCK_BITS;
  202.34 +            return (value &AUX_FNC_MASK)<<SURROGATE_BLOCK_BITS;
  202.35          }
  202.36      }
  202.37  
  202.38 @@ -972,7 +972,7 @@
  202.39  
  202.40              /* copy these code units all at once */
  202.41              if(srcIndex!=prevSrc) {
  202.42 -                length=(int)(srcIndex-prevSrc);
  202.43 +                length=srcIndex-prevSrc;
  202.44                  if((destIndex+length)<=destLimit) {
  202.45                      System.arraycopy(src,prevSrc,dest,destIndex,length);
  202.46                  }
  202.47 @@ -1814,7 +1814,7 @@
  202.48  
  202.49              /* copy these code units all at once */
  202.50              if(srcIndex!=prevSrc) {
  202.51 -                length=(int)(srcIndex-prevSrc);
  202.52 +                length=srcIndex-prevSrc;
  202.53                  if((destIndex+length)<=destLimit) {
  202.54                      System.arraycopy(src,prevSrc,dest,destIndex,length);
  202.55                  }
  202.56 @@ -2022,13 +2022,13 @@
  202.57      public static int getCombiningClass(int c) {
  202.58          long norm32;
  202.59          norm32=getNorm32(c);
  202.60 -        return (char)((norm32>>CC_SHIFT)&0xFF);
  202.61 +        return (int)((norm32>>CC_SHIFT)&0xFF);
  202.62      }
  202.63  
  202.64      public static boolean isFullCompositionExclusion(int c) {
  202.65          if(isFormatVersion_2_1) {
  202.66              int aux =AuxTrieImpl.auxTrie.getCodePointValue(c);
  202.67 -            return (boolean)((aux & AUX_COMP_EX_MASK)!=0);
  202.68 +            return (aux & AUX_COMP_EX_MASK)!=0;
  202.69          } else {
  202.70              return false;
  202.71          }
  202.72 @@ -2037,7 +2037,7 @@
  202.73      public static boolean isCanonSafeStart(int c) {
  202.74          if(isFormatVersion_2_1) {
  202.75              int aux = AuxTrieImpl.auxTrie.getCodePointValue(c);
  202.76 -            return (boolean)((aux & AUX_UNSAFE_MASK)==0);
  202.77 +            return (aux & AUX_UNSAFE_MASK)==0;
  202.78          } else {
  202.79              return false;
  202.80          }
  202.81 @@ -2546,7 +2546,7 @@
  202.82  
  202.83              // copy these code units all at once
  202.84              if (srcIndex != prevSrc) {
  202.85 -                length = (int)(srcIndex - prevSrc);
  202.86 +                length = srcIndex - prevSrc;
  202.87                  if ((destIndex + length) <= destLimit) {
  202.88                      System.arraycopy(src,prevSrc,dest,destIndex,length);
  202.89                  }
   203.1 --- a/src/share/classes/sun/text/normalizer/SymbolTable.java	Tue Dec 06 16:31:58 2011 -0800
   203.2 +++ b/src/share/classes/sun/text/normalizer/SymbolTable.java	Mon Dec 19 10:06:23 2011 -0800
   203.3 @@ -65,6 +65,7 @@
   203.4   * @draft ICU 2.8
   203.5   * @deprecated This is a draft API and might change in a future release of ICU.
   203.6   */
   203.7 +@Deprecated
   203.8  public interface SymbolTable {
   203.9  
  203.10      /**
  203.11 @@ -72,6 +73,7 @@
  203.12       * @draft ICU 2.8
  203.13       * @deprecated This is a draft API and might change in a future release of ICU.
  203.14       */
  203.15 +    @Deprecated
  203.16      static final char SYMBOL_REF = '$';
  203.17  
  203.18      /**
  203.19 @@ -84,6 +86,7 @@
  203.20       * @draft ICU 2.8
  203.21       * @deprecated This is a draft API and might change in a future release of ICU.
  203.22       */
  203.23 +    @Deprecated
  203.24      char[] lookup(String s);
  203.25  
  203.26      /**
  203.27 @@ -95,6 +98,7 @@
  203.28       * @draft ICU 2.8
  203.29       * @deprecated This is a draft API and might change in a future release of ICU.
  203.30       */
  203.31 +    @Deprecated
  203.32      UnicodeMatcher lookupMatcher(int ch);
  203.33  
  203.34      /**
  203.35 @@ -115,5 +119,6 @@
  203.36       * @draft ICU 2.8
  203.37       * @deprecated This is a draft API and might change in a future release of ICU.
  203.38       */
  203.39 +    @Deprecated
  203.40      String parseReference(String text, ParsePosition pos, int limit);
  203.41  }
   204.1 --- a/src/share/classes/sun/text/normalizer/UnicodeSet.java	Tue Dec 06 16:31:58 2011 -0800
   204.2 +++ b/src/share/classes/sun/text/normalizer/UnicodeSet.java	Mon Dec 19 10:06:23 2011 -0800
   204.3 @@ -298,7 +298,7 @@
   204.4  
   204.5      // NOTE: normally the field should be of type SortedSet; but that is missing a public clone!!
   204.6      // is not private so that UnicodeSetIterator can get access
   204.7 -    TreeSet strings = new TreeSet();
   204.8 +    TreeSet<String> strings = new TreeSet<>();
   204.9  
  204.10      /**
  204.11       * The pattern representation of this set.  This may not be the
  204.12 @@ -368,7 +368,7 @@
  204.13       * @stable ICU 2.0
  204.14       */
  204.15      public UnicodeSet set(UnicodeSet other) {
  204.16 -        list = (int[]) other.list.clone();
  204.17 +        list = other.list.clone();
  204.18          len = other.len;
  204.19          pat = other.pat;
  204.20          strings = (TreeSet)other.strings.clone();
  204.21 @@ -524,10 +524,10 @@
  204.22          }
  204.23  
  204.24          if (includeStrings && strings.size() > 0) {
  204.25 -            Iterator it = strings.iterator();
  204.26 +            Iterator<String> it = strings.iterator();
  204.27              while (it.hasNext()) {
  204.28                  result.append('{');
  204.29 -                _appendToPat(result, (String) it.next(), escapeUnprintable);
  204.30 +                _appendToPat(result, it.next(), escapeUnprintable);
  204.31                  result.append('}');
  204.32              }
  204.33          }
  204.34 @@ -1180,14 +1180,17 @@
  204.35                          }
  204.36                      }
  204.37                      syntaxError(chars, "'-' not after char or set");
  204.38 +                    break;
  204.39                  case '&':
  204.40                      if (lastItem == 2 && op == 0) {
  204.41                          op = (char) c;
  204.42                          continue;
  204.43                      }
  204.44                      syntaxError(chars, "'&' not after set");
  204.45 +                    break;
  204.46                  case '^':
  204.47                      syntaxError(chars, "'^' not after '['");
  204.48 +                    break;
  204.49                  case '{':
  204.50                      if (op != 0) {
  204.51                          syntaxError(chars, "Missing operand after operator");
  204.52 @@ -1251,6 +1254,7 @@
  204.53                          continue;
  204.54                      }
  204.55                      syntaxError(chars, "Unquoted '$'");
  204.56 +                    break;
  204.57                  default:
  204.58                      break;
  204.59                  }
   205.1 --- a/src/share/classes/sun/text/normalizer/UnicodeSetIterator.java	Tue Dec 06 16:31:58 2011 -0800
   205.2 +++ b/src/share/classes/sun/text/normalizer/UnicodeSetIterator.java	Mon Dec 19 10:06:23 2011 -0800
   205.3 @@ -154,7 +154,7 @@
   205.4  
   205.5          if (stringIterator == null) return false;
   205.6          codepoint = IS_STRING; // signal that value is actually a string
   205.7 -        string = (String)stringIterator.next();
   205.8 +        string = stringIterator.next();
   205.9          if (!stringIterator.hasNext()) stringIterator = null;
  205.10          return true;
  205.11      }
  205.12 @@ -203,7 +203,7 @@
  205.13       * @internal
  205.14       */
  205.15      protected int nextElement;
  205.16 -    private Iterator stringIterator = null;
  205.17 +    private Iterator<String> stringIterator = null;
  205.18  
  205.19      /**
  205.20       * Invariant: stringIterator is null when there are no (more) strings remaining
   206.1 --- a/src/share/classes/sun/text/normalizer/VersionInfo.java	Tue Dec 06 16:31:58 2011 -0800
   206.2 +++ b/src/share/classes/sun/text/normalizer/VersionInfo.java	Mon Dec 19 10:06:23 2011 -0800
   206.3 @@ -153,7 +153,7 @@
   206.4      /**
   206.5       * Map of singletons
   206.6       */
   206.7 -    private static final HashMap MAP_ = new HashMap();
   206.8 +    private static final HashMap<Integer, Object> MAP_ = new HashMap<>();
   206.9      /**
  206.10       * Error statement string
  206.11       */
   207.1 --- a/src/share/classes/sun/tools/attach/HotSpotAttachProvider.java	Tue Dec 06 16:31:58 2011 -0800
   207.2 +++ b/src/share/classes/sun/tools/attach/HotSpotAttachProvider.java	Mon Dec 19 10:06:23 2011 -0800
   207.3 @@ -75,7 +75,7 @@
   207.4              new ArrayList<VirtualMachineDescriptor>();
   207.5  
   207.6          MonitoredHost host;
   207.7 -        Set vms;
   207.8 +        Set<Integer> vms;
   207.9          try {
  207.10              host = MonitoredHost.getMonitoredHost(new HostIdentifier((String)null));
  207.11              vms = host.activeVms();
  207.12 @@ -92,31 +92,29 @@
  207.13              throw new InternalError(t);          // shouldn't happen
  207.14          }
  207.15  
  207.16 -        for (Object vmid: vms) {
  207.17 -            if (vmid instanceof Integer) {
  207.18 -                String pid = vmid.toString();
  207.19 -                String name = pid;      // default to pid if name not available
  207.20 -                boolean isAttachable = false;
  207.21 -                MonitoredVm mvm = null;
  207.22 +        for (Integer vmid: vms) {
  207.23 +            String pid = vmid.toString();
  207.24 +            String name = pid;      // default to pid if name not available
  207.25 +            boolean isAttachable = false;
  207.26 +            MonitoredVm mvm = null;
  207.27 +            try {
  207.28 +                mvm = host.getMonitoredVm(new VmIdentifier(pid));
  207.29                  try {
  207.30 -                    mvm = host.getMonitoredVm(new VmIdentifier(pid));
  207.31 -                    try {
  207.32 -                        isAttachable = MonitoredVmUtil.isAttachable(mvm);
  207.33 -                        // use the command line as the display name
  207.34 -                        name =  MonitoredVmUtil.commandLine(mvm);
  207.35 -                    } catch (Exception e) {
  207.36 -                    }
  207.37 -                    if (isAttachable) {
  207.38 -                        result.add(new HotSpotVirtualMachineDescriptor(this, pid, name));
  207.39 -                    }
  207.40 -                } catch (Throwable t) {
  207.41 -                    if (t instanceof ThreadDeath) {
  207.42 -                        throw (ThreadDeath)t;
  207.43 -                    }
  207.44 -                } finally {
  207.45 -                    if (mvm != null) {
  207.46 -                        mvm.detach();
  207.47 -                    }
  207.48 +                    isAttachable = MonitoredVmUtil.isAttachable(mvm);
  207.49 +                    // use the command line as the display name
  207.50 +                    name =  MonitoredVmUtil.commandLine(mvm);
  207.51 +                } catch (Exception e) {
  207.52 +                }
  207.53 +                if (isAttachable) {
  207.54 +                    result.add(new HotSpotVirtualMachineDescriptor(this, pid, name));
  207.55 +                }
  207.56 +            } catch (Throwable t) {
  207.57 +                if (t instanceof ThreadDeath) {
  207.58 +                    throw (ThreadDeath)t;
  207.59 +                }
  207.60 +            } finally {
  207.61 +                if (mvm != null) {
  207.62 +                    mvm.detach();
  207.63                  }
  207.64              }
  207.65          }
   208.1 --- a/src/share/classes/sun/tools/jinfo/JInfo.java	Tue Dec 06 16:31:58 2011 -0800
   208.2 +++ b/src/share/classes/sun/tools/jinfo/JInfo.java	Mon Dec 19 10:06:23 2011 -0800
   208.3 @@ -98,7 +98,7 @@
   208.4      }
   208.5  
   208.6      // loads the given class using the system class loader
   208.7 -    private static Class loadClass(String name) {
   208.8 +    private static Class<?> loadClass(String name) {
   208.9          //
  208.10          // We specify the system clas loader so as to cater for development
  208.11          // environments where this class is on the boot class path but sa-jdi.jar
  208.12 @@ -178,7 +178,7 @@
  208.13      // print usage message
  208.14      private static void usage() {
  208.15  
  208.16 -        Class c = loadClass("sun.jvm.hotspot.tools.JInfo");
  208.17 +        Class<?> c = loadClass("sun.jvm.hotspot.tools.JInfo");
  208.18          boolean usageSA = (c != null);
  208.19  
  208.20          System.out.println("Usage:");
   209.1 --- a/src/share/classes/sun/tools/jmap/JMap.java	Tue Dec 06 16:31:58 2011 -0800
   209.2 +++ b/src/share/classes/sun/tools/jmap/JMap.java	Mon Dec 19 10:06:23 2011 -0800
   209.3 @@ -198,7 +198,7 @@
   209.4      }
   209.5  
   209.6      // loads the given class using the system class loader
   209.7 -    private static Class loadClass(String name) {
   209.8 +    private static Class<?> loadClass(String name) {
   209.9          //
  209.10          // We specify the system clas loader so as to cater for development
  209.11          // environments where this class is on the boot class path but sa-jdi.jar
  209.12 @@ -336,7 +336,7 @@
  209.13  
  209.14      // returns true if SA is available
  209.15      private static boolean haveSA() {
  209.16 -        Class c = loadClass("sun.jvm.hotspot.tools.HeapSummary");
  209.17 +        Class<?> c = loadClass("sun.jvm.hotspot.tools.HeapSummary");
  209.18          return (c != null);
  209.19      }
  209.20  
   210.1 --- a/src/share/classes/sun/tools/jps/Jps.java	Tue Dec 06 16:31:58 2011 -0800
   210.2 +++ b/src/share/classes/sun/tools/jps/Jps.java	Mon Dec 19 10:06:23 2011 -0800
   210.3 @@ -59,13 +59,13 @@
   210.4                      MonitoredHost.getMonitoredHost(hostId);
   210.5  
   210.6              // get the set active JVMs on the specified host.
   210.7 -            Set jvms = monitoredHost.activeVms();
   210.8 +            Set<Integer> jvms = monitoredHost.activeVms();
   210.9  
  210.10 -            for (Iterator j = jvms.iterator(); j.hasNext(); /* empty */ ) {
  210.11 +            for (Integer jvm: jvms) {
  210.12                  StringBuilder output = new StringBuilder();
  210.13                  Throwable lastError = null;
  210.14  
  210.15 -                int lvmid = ((Integer)j.next()).intValue();
  210.16 +                int lvmid = jvm;
  210.17  
  210.18                  output.append(String.valueOf(lvmid));
  210.19  
   211.1 --- a/src/share/classes/sun/tools/jstack/JStack.java	Tue Dec 06 16:31:58 2011 -0800
   211.2 +++ b/src/share/classes/sun/tools/jstack/JStack.java	Mon Dec 19 10:06:23 2011 -0800
   211.3 @@ -137,7 +137,7 @@
   211.4      }
   211.5  
   211.6      // Returns sun.jvm.hotspot.tools.JStack if available, otherwise null.
   211.7 -    private static Class loadSAClass() {
   211.8 +    private static Class<?> loadSAClass() {
   211.9          //
  211.10          // Attempt to load JStack class - we specify the system class
  211.11          // loader so as to cater for development environments where
   212.1 --- a/src/share/classes/sun/tools/serialver/SerialVer.java	Tue Dec 06 16:31:58 2011 -0800
   212.2 +++ b/src/share/classes/sun/tools/serialver/SerialVer.java	Mon Dec 19 10:06:23 2011 -0800
   212.3 @@ -98,6 +98,7 @@
   212.4          classname_t.requestFocus();
   212.5      }
   212.6  
   212.7 +    @SuppressWarnings("deprecation")
   212.8      public boolean action(Event ev, Object obj) {
   212.9          if (ev.target == classname_t) {
  212.10              show((String)ev.arg);
  212.11 @@ -110,6 +111,7 @@
  212.12      }
  212.13  
  212.14  
  212.15 +    @SuppressWarnings("deprecation")
  212.16      public boolean handleEvent(Event ev) {
  212.17          boolean rc = super.handleEvent(ev);
  212.18          return rc;
  212.19 @@ -206,7 +208,7 @@
  212.20      }
  212.21  
  212.22      static String resolveClass(String classname) throws ClassNotFoundException {
  212.23 -        Class cl = Class.forName(classname, false, loader);
  212.24 +        Class<?> cl = Class.forName(classname, false, loader);
  212.25          ObjectStreamClass desc = ObjectStreamClass.lookup(cl);
  212.26          if (desc != null) {
  212.27              return "    static final long serialVersionUID = " +
  212.28 @@ -216,6 +218,10 @@
  212.29          }
  212.30      }
  212.31  
  212.32 +    @SuppressWarnings("deprecation")
  212.33 +    private static void showWindow(Window w) {
  212.34 +        w.show();
  212.35 +    }
  212.36  
  212.37      public static void main(String[] args) {
  212.38          boolean show = false;
  212.39 @@ -316,7 +322,7 @@
  212.40  
  212.41              f.add("Center", sv);
  212.42              f.pack();
  212.43 -            f.show();
  212.44 +            showWindow(f);
  212.45          }
  212.46      }
  212.47  
  212.48 @@ -362,6 +368,7 @@
  212.49      /*
  212.50       * Handle a window destroy event by exiting.
  212.51       */
  212.52 +    @SuppressWarnings("deprecation")
  212.53      public boolean handleEvent(Event e) {
  212.54          if (e.id == Event.WINDOW_DESTROY) {
  212.55              exit(0);
  212.56 @@ -371,6 +378,7 @@
  212.57      /*
  212.58       * Handle an Exit event by exiting.
  212.59       */
  212.60 +    @SuppressWarnings("deprecation")
  212.61      public boolean action(Event ev, Object obj) {
  212.62          if (ev.target == exit_i) {
  212.63              exit(0);
  212.64 @@ -455,11 +463,7 @@
  212.65          }
  212.66          try {
  212.67              String message = messageRB.getString(key);
  212.68 -            String[] args = new String[3];
  212.69 -            args[0] = a1;
  212.70 -            args[1] = a2;
  212.71 -            args[2] = a3;
  212.72 -            return MessageFormat.format(message, args);
  212.73 +            return MessageFormat.format(message, a1, a2, a3);
  212.74          } catch (MissingResourceException e) {
  212.75              throw new Error("Fatal: Resource for serialver is broken. There is no " + key + " key in resource.");
  212.76          }
   213.1 --- a/src/share/classes/sun/util/LocaleServiceProviderPool.java	Tue Dec 06 16:31:58 2011 -0800
   213.2 +++ b/src/share/classes/sun/util/LocaleServiceProviderPool.java	Mon Dec 19 10:06:23 2011 -0800
   213.3 @@ -58,7 +58,7 @@
   213.4       * A Map that holds singleton instances of this class.  Each instance holds a
   213.5       * set of provider implementations of a particular locale sensitive service.
   213.6       */
   213.7 -    private static ConcurrentMap<Class, LocaleServiceProviderPool> poolOfPools =
   213.8 +    private static ConcurrentMap<Class<? extends LocaleServiceProvider>, LocaleServiceProviderPool> poolOfPools =
   213.9          new ConcurrentHashMap<>();
  213.10  
  213.11      /**
  213.12 @@ -147,6 +147,10 @@
  213.13      /**
  213.14       * Lazy loaded set of available locales.
  213.15       * Loading all locales is a very long operation.
  213.16 +     *
  213.17 +     * We know "providerClasses" contains classes that extends LocaleServiceProvider,
  213.18 +     * but generic array creation is not allowed, thus the "unchecked" warning
  213.19 +     * is suppressed here.
  213.20       */
  213.21      private static class AllAvailableLocales {
  213.22          /**
  213.23 @@ -156,7 +160,9 @@
  213.24          static final Locale[] allAvailableLocales;
  213.25  
  213.26          static {
  213.27 -            Class[] providerClasses = {
  213.28 +            @SuppressWarnings("unchecked")
  213.29 +            Class<LocaleServiceProvider>[] providerClasses =
  213.30 +                        (Class<LocaleServiceProvider>[]) new Class<?>[] {
  213.31                  java.text.spi.BreakIteratorProvider.class,
  213.32                  java.text.spi.CollatorProvider.class,
  213.33                  java.text.spi.DateFormatProvider.class,
  213.34 @@ -174,7 +180,7 @@
  213.35                  all.add(getLookupLocale(locale));
  213.36              }
  213.37  
  213.38 -            for (Class providerClass : providerClasses) {
  213.39 +            for (Class<LocaleServiceProvider> providerClass : providerClasses) {
  213.40                  LocaleServiceProviderPool pool =
  213.41                      LocaleServiceProviderPool.getPool(providerClass);
  213.42                  all.addAll(pool.getProviderLocales());
  213.43 @@ -355,7 +361,6 @@
  213.44              }
  213.45              Locale bundleLocale = (bundle != null ? bundle.getLocale() : null);
  213.46              List<Locale> lookupLocales = getLookupLocales(locale);
  213.47 -            P lsp;
  213.48              S providersObj = null;
  213.49  
  213.50              // check whether a provider has an implementation that's closer
  213.51 @@ -375,7 +380,9 @@
  213.52                      }
  213.53                  }
  213.54                  if (provLoc.contains(current)) {
  213.55 -                    lsp = (P)findProvider(current);
  213.56 +                    // It is safe to assume that findProvider() returns the instance of type P.
  213.57 +                    @SuppressWarnings("unchecked")
  213.58 +                    P lsp = (P)findProvider(current);
  213.59                      if (lsp != null) {
  213.60                          providersObj = getter.getObject(lsp, locale, key, params);
  213.61                          if (providersObj != null) {
  213.62 @@ -397,7 +404,9 @@
  213.63                      // JRE has it.
  213.64                      return null;
  213.65                  } else {
  213.66 -                    lsp = (P)findProvider(bundleLocale);
  213.67 +                    // It is safe to assume that findProvider() returns the instance of type P.
  213.68 +                    @SuppressWarnings("unchecked")
  213.69 +                    P lsp = (P)findProvider(bundleLocale);
  213.70                      if (lsp != null) {
  213.71                          providersObj = getter.getObject(lsp, locale, key, params);
  213.72                          if (providersObj != null) {
   214.1 --- a/src/share/classes/sun/util/calendar/BaseCalendar.java	Tue Dec 06 16:31:58 2011 -0800
   214.2 +++ b/src/share/classes/sun/util/calendar/BaseCalendar.java	Mon Dec 19 10:06:23 2011 -0800
   214.3 @@ -1,5 +1,5 @@
   214.4  /*
   214.5 - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
   214.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
   214.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   214.8   *
   214.9   * This code is free software; you can redistribute it and/or modify it
  214.10 @@ -25,7 +25,6 @@
  214.11  
  214.12  package sun.util.calendar;
  214.13  
  214.14 -import java.util.Locale;
  214.15  import java.util.TimeZone;
  214.16  
  214.17  /**
  214.18 @@ -203,7 +202,7 @@
  214.19              return false;
  214.20          }
  214.21          int dow = bdate.getDayOfWeek();
  214.22 -        if (dow != bdate.FIELD_UNDEFINED && dow != getDayOfWeek(bdate)) {
  214.23 +        if (dow != Date.FIELD_UNDEFINED && dow != getDayOfWeek(bdate)) {
  214.24              return false;
  214.25          }
  214.26  
  214.27 @@ -329,7 +328,7 @@
  214.28      }
  214.29  
  214.30      // accepts 0 (December in the previous year) to 12.
  214.31 -    private final int getMonthLength(int year, int month) {
  214.32 +    private int getMonthLength(int year, int month) {
  214.33          int days = DAYS_IN_MONTH[month];
  214.34          if (month == FEBRUARY && isLeapYear(year)) {
  214.35              days++;
   215.1 --- a/src/share/classes/sun/util/calendar/CalendarSystem.java	Tue Dec 06 16:31:58 2011 -0800
   215.2 +++ b/src/share/classes/sun/util/calendar/CalendarSystem.java	Mon Dec 19 10:06:23 2011 -0800
   215.3 @@ -1,5 +1,5 @@
   215.4  /*
   215.5 - * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
   215.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
   215.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   215.8   *
   215.9   * This code is free software; you can redistribute it and/or modify it
  215.10 @@ -25,13 +25,6 @@
  215.11  
  215.12  package sun.util.calendar;
  215.13  
  215.14 -import java.lang.reflect.Field;
  215.15 -import java.util.HashMap;
  215.16 -import java.util.Locale;
  215.17 -import java.util.Map;
  215.18 -import java.util.MissingResourceException;
  215.19 -import java.util.ResourceBundle;
  215.20 -import java.util.Set;
  215.21  import java.util.TimeZone;
  215.22  import java.util.concurrent.ConcurrentHashMap;
  215.23  import java.util.concurrent.ConcurrentMap;
  215.24 @@ -99,7 +92,7 @@
  215.25      };
  215.26  
  215.27      private static void initNames() {
  215.28 -        ConcurrentMap<String,String> nameMap = new ConcurrentHashMap<String,String>();
  215.29 +        ConcurrentMap<String,String> nameMap = new ConcurrentHashMap<>();
  215.30  
  215.31          // Associate a calendar name with its class name and the
  215.32          // calendar class name with its date class name.
  215.33 @@ -112,7 +105,7 @@
  215.34          synchronized (CalendarSystem.class) {
  215.35              if (!initialized) {
  215.36                  names = nameMap;
  215.37 -                calendars = new ConcurrentHashMap<String,CalendarSystem>();
  215.38 +                calendars = new ConcurrentHashMap<>();
  215.39                  initialized = true;
  215.40              }
  215.41          }
  215.42 @@ -164,10 +157,10 @@
  215.43              cal = LocalGregorianCalendar.getLocalGregorianCalendar(calendarName);
  215.44          } else {
  215.45              try {
  215.46 -                Class cl = Class.forName(className);
  215.47 +                Class<?> cl = Class.forName(className);
  215.48                  cal = (CalendarSystem) cl.newInstance();
  215.49              } catch (Exception e) {
  215.50 -                throw new RuntimeException("internal error", e);
  215.51 +                throw new InternalError(e);
  215.52              }
  215.53          }
  215.54          if (cal == null) {
   216.1 --- a/src/share/classes/sun/util/calendar/LocalGregorianCalendar.java	Tue Dec 06 16:31:58 2011 -0800
   216.2 +++ b/src/share/classes/sun/util/calendar/LocalGregorianCalendar.java	Mon Dec 19 10:06:23 2011 -0800
   216.3 @@ -29,7 +29,6 @@
   216.4  import java.io.FileInputStream;
   216.5  import java.io.IOException;
   216.6  import java.security.AccessController;
   216.7 -import java.security.PrivilegedAction;
   216.8  import java.security.PrivilegedActionException;
   216.9  import java.security.PrivilegedExceptionAction;
  216.10  import java.util.ArrayList;
  216.11 @@ -124,8 +123,8 @@
  216.12                  new sun.security.action.GetPropertyAction("java.home"));
  216.13              final String fname = homeDir + File.separator + "lib" + File.separator
  216.14                                   + "calendars.properties";
  216.15 -            calendarProps = (Properties) AccessController.doPrivileged(new PrivilegedExceptionAction() {
  216.16 -                public Object run() throws IOException {
  216.17 +            calendarProps = AccessController.doPrivileged(new PrivilegedExceptionAction<Properties>() {
  216.18 +                public Properties run() throws IOException {
  216.19                      Properties props = new Properties();
  216.20                      try (FileInputStream fis = new FileInputStream(fname)) {
  216.21                          props.load(fis);
  216.22 @@ -142,7 +141,7 @@
  216.23          if (props == null) {
  216.24              return null;
  216.25          }
  216.26 -        List<Era> eras = new ArrayList<Era>();
  216.27 +        List<Era> eras = new ArrayList<>();
  216.28          StringTokenizer eraTokens = new StringTokenizer(props, ";");
  216.29          while (eraTokens.hasMoreTokens()) {
  216.30              String items = eraTokens.nextToken().trim();
   217.1 --- a/src/share/classes/sun/util/calendar/ZoneInfo.java	Tue Dec 06 16:31:58 2011 -0800
   217.2 +++ b/src/share/classes/sun/util/calendar/ZoneInfo.java	Mon Dec 19 10:06:23 2011 -0800
   217.3 @@ -31,7 +31,6 @@
   217.4  import java.security.AccessController;
   217.5  import java.util.ArrayList;
   217.6  import java.util.Date;
   217.7 -import java.util.HashMap;
   217.8  import java.util.List;
   217.9  import java.util.Locale;
  217.10  import java.util.Map;
  217.11 @@ -318,7 +317,7 @@
  217.12          return offset;
  217.13      }
  217.14  
  217.15 -    private final int getTransitionIndex(long date, int type) {
  217.16 +    private int getTransitionIndex(long date, int type) {
  217.17          int low = 0;
  217.18          int high = transitions.length - 1;
  217.19  
  217.20 @@ -572,7 +571,7 @@
  217.21          List<String> excluded = ZoneInfoFile.getExcludedZones();
  217.22          if (excluded != null) {
  217.23              // List all zones from the idList and excluded lists
  217.24 -            List<String> list = new ArrayList<String>(idList.size() + excluded.size());
  217.25 +            List<String> list = new ArrayList<>(idList.size() + excluded.size());
  217.26              list.addAll(idList);
  217.27              list.addAll(excluded);
  217.28              idList = list;
  217.29 @@ -592,7 +591,7 @@
  217.30       */
  217.31      public static String[] getAvailableIDs(int rawOffset) {
  217.32          String[] result;
  217.33 -        List<String> matched = new ArrayList<String>();
  217.34 +        List<String> matched = new ArrayList<>();
  217.35          List<String> IDs = ZoneInfoFile.getZoneIDs();
  217.36          int[] rawOffsets = ZoneInfoFile.getRawOffsets();
  217.37  
  217.38 @@ -807,7 +806,7 @@
  217.39          return (checksum == ((ZoneInfo)other).checksum);
  217.40      }
  217.41  
  217.42 -    private static SoftReference<Map> aliasTable;
  217.43 +    private static SoftReference<Map<String, String>> aliasTable;
  217.44  
  217.45      /**
  217.46       * Returns a Map from alias time zone IDs to their standard
  217.47 @@ -820,7 +819,7 @@
  217.48      public synchronized static Map<String, String> getAliasTable() {
  217.49          Map<String, String> aliases = null;
  217.50  
  217.51 -        SoftReference<Map> cache = aliasTable;
  217.52 +        SoftReference<Map<String, String>> cache = aliasTable;
  217.53          if (cache != null) {
  217.54              aliases = cache.get();
  217.55              if (aliases != null) {
  217.56 @@ -830,7 +829,7 @@
  217.57  
  217.58          aliases = ZoneInfoFile.getZoneAliases();
  217.59          if (aliases != null) {
  217.60 -            aliasTable = new SoftReference<Map>(aliases);
  217.61 +            aliasTable = new SoftReference<>(aliases);
  217.62          }
  217.63          return aliases;
  217.64      }
   218.1 --- a/src/share/classes/sun/util/calendar/ZoneInfoFile.java	Tue Dec 06 16:31:58 2011 -0800
   218.2 +++ b/src/share/classes/sun/util/calendar/ZoneInfoFile.java	Mon Dec 19 10:06:23 2011 -0800
   218.3 @@ -1,5 +1,5 @@
   218.4  /*
   218.5 - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
   218.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
   218.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   218.8   *
   218.9   * This code is free software; you can redistribute it and/or modify it
  218.10 @@ -573,7 +573,7 @@
  218.11  
  218.12      synchronized static ZoneInfo addToCache(String id, ZoneInfo zi) {
  218.13          if (zoneInfoObjects == null) {
  218.14 -            zoneInfoObjects = new HashMap<String, ZoneInfo>();
  218.15 +            zoneInfoObjects = new HashMap<>();
  218.16          } else {
  218.17              ZoneInfo zone = zoneInfoObjects.get(id);
  218.18              if (zone != null) {
  218.19 @@ -758,7 +758,7 @@
  218.20                  case TAG_ZoneIDs:
  218.21                      {
  218.22                          int n = (buf[index++] << 8) + (buf[index++] & 0xFF);
  218.23 -                        ids = new ArrayList<String>(n);
  218.24 +                        ids = new ArrayList<>(n);
  218.25  
  218.26                          for (int i = 0; i < n; i++) {
  218.27                              byte m = buf[index++];
  218.28 @@ -777,7 +777,7 @@
  218.29              System.err.println("ZoneInfo: corrupted " + JAVAZM_FILE_NAME);
  218.30          }
  218.31  
  218.32 -        zoneIDs = new SoftReference<List<String>>(ids);
  218.33 +        zoneIDs = new SoftReference<>(ids);
  218.34          return ids;
  218.35      }
  218.36  
  218.37 @@ -802,7 +802,7 @@
  218.38                  case TAG_ZoneAliases:
  218.39                      {
  218.40                          int n = (buf[index++] << 8) + (buf[index++] & 0xFF);
  218.41 -                        aliases = new HashMap<String, String>(n);
  218.42 +                        aliases = new HashMap<>(n);
  218.43                          for (int i = 0; i < n; i++) {
  218.44                              byte m = buf[index++];
  218.45                              String name = new String(buf, index, m, "UTF-8");
  218.46 @@ -865,7 +865,7 @@
  218.47                  case TAG_ExcludedZones:
  218.48                      {
  218.49                          int n = (buf[index++] << 8) + (buf[index++] & 0xFF);
  218.50 -                        excludeList = new ArrayList<String>();
  218.51 +                        excludeList = new ArrayList<>();
  218.52                          for (int i = 0; i < n; i++) {
  218.53                              byte m = buf[index++];
  218.54                              String name = new String(buf, index, m, "UTF-8");
  218.55 @@ -886,7 +886,7 @@
  218.56          }
  218.57  
  218.58          if (excludeList != null) {
  218.59 -            excludedIDs = new SoftReference<List<String>>(excludeList);
  218.60 +            excludedIDs = new SoftReference<>(excludeList);
  218.61          } else {
  218.62              hasNoExcludeList = true;
  218.63          }
  218.64 @@ -935,7 +935,7 @@
  218.65              System.err.println("ZoneInfo: corrupted " + JAVAZM_FILE_NAME);
  218.66          }
  218.67  
  218.68 -        rawOffsetIndices = new SoftReference<byte[]>(indices);
  218.69 +        rawOffsetIndices = new SoftReference<>(indices);
  218.70          return indices;
  218.71      }
  218.72  
  218.73 @@ -986,7 +986,7 @@
  218.74              System.err.println("ZoneInfo: corrupted " + JAVAZM_FILE_NAME);
  218.75          }
  218.76  
  218.77 -        rawOffsets = new SoftReference<int[]>(offsets);
  218.78 +        rawOffsets = new SoftReference<>(offsets);
  218.79          return offsets;
  218.80      }
  218.81  
  218.82 @@ -1022,7 +1022,7 @@
  218.83              return null;
  218.84          }
  218.85  
  218.86 -        zoneInfoMappings = new SoftReference<byte[]>(data);
  218.87 +        zoneInfoMappings = new SoftReference<>(data);
  218.88          return data;
  218.89      }
  218.90  
  218.91 @@ -1034,8 +1034,8 @@
  218.92          byte[] buffer = null;
  218.93  
  218.94          try {
  218.95 -            buffer = (byte[]) AccessController.doPrivileged(new PrivilegedExceptionAction() {
  218.96 -                public Object run() throws IOException {
  218.97 +            buffer = AccessController.doPrivileged(new PrivilegedExceptionAction<byte[]>() {
  218.98 +                public byte[] run() throws IOException {
  218.99                      File file = new File(ziDir, fileName);
 218.100                      if (!file.exists() || !file.isFile()) {
 218.101                          return null;
 218.102 @@ -1068,4 +1068,7 @@
 218.103          }
 218.104          return buffer;
 218.105      }
 218.106 +
 218.107 +    private ZoneInfoFile() {
 218.108 +    }
 218.109  }
   219.1 --- a/src/share/classes/sun/util/resources/LocaleData.java	Tue Dec 06 16:31:58 2011 -0800
   219.2 +++ b/src/share/classes/sun/util/resources/LocaleData.java	Mon Dec 19 10:06:23 2011 -0800
   219.3 @@ -137,8 +137,8 @@
   219.4      }
   219.5  
   219.6      private static ResourceBundle getBundle(final String baseName, final Locale locale) {
   219.7 -        return (ResourceBundle) AccessController.doPrivileged(new PrivilegedAction() {
   219.8 -                public Object run() {
   219.9 +        return AccessController.doPrivileged(new PrivilegedAction<ResourceBundle>() {
  219.10 +                public ResourceBundle run() {
  219.11                      return ResourceBundle.
  219.12                          getBundle(baseName, locale,
  219.13                                    LocaleDataResourceBundleControl.getRBControlInstance());
   220.1 --- a/src/share/classes/sun/util/resources/OpenListResourceBundle.java	Tue Dec 06 16:31:58 2011 -0800
   220.2 +++ b/src/share/classes/sun/util/resources/OpenListResourceBundle.java	Mon Dec 19 10:06:23 2011 -0800
   220.3 @@ -119,11 +119,12 @@
   220.4       * loading.
   220.5       */
   220.6      private synchronized void loadLookup() {
   220.7 -        if (lookup != null)
   220.8 +        if (lookup != null) {
   220.9              return;
  220.10 +        }
  220.11  
  220.12          Object[][] contents = getContents();
  220.13 -        Map temp = createMap(contents.length);
  220.14 +        Map<String, Object> temp = createMap(contents.length);
  220.15          for (int i = 0; i < contents.length; ++i) {
  220.16              // key must be non-null String, value must be non-null
  220.17              String key = (String) contents[i][0];
  220.18 @@ -140,9 +141,9 @@
  220.19       * Lets subclasses provide specialized Map implementations.
  220.20       * Default uses HashMap.
  220.21       */
  220.22 -    protected Map createMap(int size) {
  220.23 -        return new HashMap(size);
  220.24 +    protected Map<String, Object> createMap(int size) {
  220.25 +        return new HashMap<>(size);
  220.26      }
  220.27  
  220.28 -    private Map lookup = null;
  220.29 +    private Map<String, Object> lookup = null;
  220.30  }
   221.1 --- a/src/share/classes/sun/util/resources/TimeZoneNamesBundle.java	Tue Dec 06 16:31:58 2011 -0800
   221.2 +++ b/src/share/classes/sun/util/resources/TimeZoneNamesBundle.java	Mon Dec 19 10:06:23 2011 -0800
   221.3 @@ -1,5 +1,5 @@
   221.4  /*
   221.5 - * Copyright (c) 2005, 2007, Oracle and/or its affiliates. All rights reserved.
   221.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
   221.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   221.8   *
   221.9   * This code is free software; you can redistribute it and/or modify it
  221.10 @@ -80,17 +80,16 @@
  221.11          int clen = contents.length;
  221.12          String[] tmpobj = new String[clen+1];
  221.13          tmpobj[0] = key;
  221.14 -        for (int i = 0; i < clen; i++) {
  221.15 -            tmpobj[i+1] = contents[i];
  221.16 -        }
  221.17 +        System.arraycopy(contents, 0, tmpobj, 1, clen);
  221.18          return tmpobj;
  221.19      }
  221.20  
  221.21      /**
  221.22       * Use LinkedHashMap to preserve order of bundle entries.
  221.23       */
  221.24 -    protected Map createMap(int size) {
  221.25 -        return new LinkedHashMap(size);
  221.26 +    @Override
  221.27 +    protected Map<String, Object> createMap(int size) {
  221.28 +        return new LinkedHashMap<>(size);
  221.29      }
  221.30  
  221.31      /**
   222.1 --- a/src/share/native/java/io/io_util.c	Tue Dec 06 16:31:58 2011 -0800
   222.2 +++ b/src/share/native/java/io/io_util.c	Mon Dec 19 10:06:23 2011 -0800
   222.3 @@ -44,7 +44,7 @@
   222.4          JNU_ThrowIOException(env, "Stream Closed");
   222.5          return -1;
   222.6      }
   222.7 -    nread = (jint)IO_Read(fd, &ret, 1);
   222.8 +    nread = IO_Read(fd, &ret, 1);
   222.9      if (nread == 0) { /* EOF */
  222.10          return -1;
  222.11      } else if (nread == JVM_IO_ERR) { /* error */
  222.12 @@ -108,7 +108,7 @@
  222.13          JNU_ThrowIOException(env, "Stream Closed");
  222.14          nread = -1;
  222.15      } else {
  222.16 -        nread = (jint)IO_Read(fd, buf, len);
  222.17 +        nread = IO_Read(fd, buf, len);
  222.18          if (nread > 0) {
  222.19              (*env)->SetByteArrayRegion(env, bytes, off, nread, (jbyte *)buf);
  222.20          } else if (nread == JVM_IO_ERR) {
  222.21 @@ -137,9 +137,9 @@
  222.22          return;
  222.23      }
  222.24      if (append == JNI_TRUE) {
  222.25 -        n = (jint)IO_Append(fd, &c, 1);
  222.26 +        n = IO_Append(fd, &c, 1);
  222.27      } else {
  222.28 -        n = (jint)IO_Write(fd, &c, 1);
  222.29 +        n = IO_Write(fd, &c, 1);
  222.30      }
  222.31      if (n == JVM_IO_ERR) {
  222.32          JNU_ThrowIOExceptionWithLastError(env, "Write error");
  222.33 @@ -190,9 +190,9 @@
  222.34                  break;
  222.35              }
  222.36              if (append == JNI_TRUE) {
  222.37 -                n = (jint)IO_Append(fd, buf+off, len);
  222.38 +                n = IO_Append(fd, buf+off, len);
  222.39              } else {
  222.40 -                n = (jint)IO_Write(fd, buf+off, len);
  222.41 +                n = IO_Write(fd, buf+off, len);
  222.42              }
  222.43              if (n == JVM_IO_ERR) {
  222.44                  JNU_ThrowIOExceptionWithLastError(env, "Write error");
   223.1 --- a/src/share/native/java/util/zip/Adler32.c	Tue Dec 06 16:31:58 2011 -0800
   223.2 +++ b/src/share/native/java/util/zip/Adler32.c	Mon Dec 19 10:06:23 2011 -0800
   223.3 @@ -30,6 +30,7 @@
   223.4  #include "jni.h"
   223.5  #include "jni_util.h"
   223.6  #include "zlib.h"
   223.7 +#include "jlong.h"
   223.8  
   223.9  #include "java_util_zip_Adler32.h"
  223.10  
  223.11 @@ -53,3 +54,17 @@
  223.12      }
  223.13      return adler;
  223.14  }
  223.15 +
  223.16 +
  223.17 +JNIEXPORT jint JNICALL
  223.18 +Java_java_util_zip_Adler32_updateByteBuffer(JNIEnv *env, jclass cls, jint adler,
  223.19 +                                       jlong address, jint off, jint len)
  223.20 +{
  223.21 +    Bytef *buf = (Bytef *)jlong_to_ptr(address);
  223.22 +    if (buf) {
  223.23 +        adler = adler32(adler, buf + off, len);
  223.24 +    }
  223.25 +    return adler;
  223.26 +}
  223.27 +
  223.28 +
   224.1 --- a/src/share/native/java/util/zip/CRC32.c	Tue Dec 06 16:31:58 2011 -0800
   224.2 +++ b/src/share/native/java/util/zip/CRC32.c	Mon Dec 19 10:06:23 2011 -0800
   224.3 @@ -58,3 +58,14 @@
   224.4  {
   224.5      return crc32(crc, (Bytef*)buf, len);
   224.6  }
   224.7 +
   224.8 +JNIEXPORT jint JNICALL
   224.9 +Java_java_util_zip_CRC32_updateByteBuffer(JNIEnv *env, jclass cls, jint crc,
  224.10 +                                          jlong address, jint off, jint len)
  224.11 +{
  224.12 +    Bytef *buf = (Bytef *)jlong_to_ptr(address);
  224.13 +    if (buf) {
  224.14 +        crc = crc32(crc, buf + off, len);
  224.15 +    }
  224.16 +    return crc;
  224.17 +}
   225.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/ChangeLog	Tue Dec 06 16:31:58 2011 -0800
   225.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   225.3 @@ -1,855 +0,0 @@
   225.4 -
   225.5 -                ChangeLog file for zlib
   225.6 -
   225.7 -Changes in 1.2.3 (18 July 2005)
   225.8 -- Apply security vulnerability fixes to contrib/infback9 as well
   225.9 -- Clean up some text files (carriage returns, trailing space)
  225.10 -- Update testzlib, vstudio, masmx64, and masmx86 in contrib [Vollant]
  225.11 -
  225.12 -Changes in 1.2.2.4 (11 July 2005)
  225.13 -- Add inflatePrime() function for starting inflation at bit boundary
  225.14 -- Avoid some Visual C warnings in deflate.c
  225.15 -- Avoid more silly Visual C warnings in inflate.c and inftrees.c for 64-bit
  225.16 -  compile
  225.17 -- Fix some spelling errors in comments [Betts]
  225.18 -- Correct inflateInit2() error return documentation in zlib.h
  225.19 -- Added zran.c example of compressed data random access to examples
  225.20 -  directory, shows use of inflatePrime()
  225.21 -- Fix cast for assignments to strm->state in inflate.c and infback.c
  225.22 -- Fix zlibCompileFlags() in zutil.c to use 1L for long shifts [Oberhumer]
  225.23 -- Move declarations of gf2 functions to right place in crc32.c [Oberhumer]
  225.24 -- Add cast in trees.c t avoid a warning [Oberhumer]
  225.25 -- Avoid some warnings in fitblk.c, gun.c, gzjoin.c in examples [Oberhumer]
  225.26 -- Update make_vms.com [Zinser]
  225.27 -- Initialize state->write in inflateReset() since copied in inflate_fast()
  225.28 -- Be more strict on incomplete code sets in inflate_table() and increase
  225.29 -  ENOUGH and MAXD -- this repairs a possible security vulnerability for
  225.30 -  invalid inflate input.  Thanks to Tavis Ormandy and Markus Oberhumer for
  225.31 -  discovering the vulnerability and providing test cases.
  225.32 -- Add ia64 support to configure for HP-UX [Smith]
  225.33 -- Add error return to gzread() for format or i/o error [Levin]
  225.34 -- Use malloc.h for OS/2 [Necasek]
  225.35 -
  225.36 -Changes in 1.2.2.3 (27 May 2005)
  225.37 -- Replace 1U constants in inflate.c and inftrees.c for 64-bit compile
  225.38 -- Typecast fread() return values in gzio.c [Vollant]
  225.39 -- Remove trailing space in minigzip.c outmode (VC++ can't deal with it)
  225.40 -- Fix crc check bug in gzread() after gzungetc() [Heiner]
  225.41 -- Add the deflateTune() function to adjust internal compression parameters
  225.42 -- Add a fast gzip decompressor, gun.c, to examples (use of inflateBack)
  225.43 -- Remove an incorrect assertion in examples/zpipe.c
  225.44 -- Add C++ wrapper in infback9.h [Donais]
  225.45 -- Fix bug in inflateCopy() when decoding fixed codes
  225.46 -- Note in zlib.h how much deflateSetDictionary() actually uses
  225.47 -- Remove USE_DICT_HEAD in deflate.c (would mess up inflate if used)
  225.48 -- Add _WIN32_WCE to define WIN32 in zconf.in.h [Spencer]
  225.49 -- Don't include stderr.h or errno.h for _WIN32_WCE in zutil.h [Spencer]
  225.50 -- Add gzdirect() function to indicate transparent reads
  225.51 -- Update contrib/minizip [Vollant]
  225.52 -- Fix compilation of deflate.c when both ASMV and FASTEST [Oberhumer]
  225.53 -- Add casts in crc32.c to avoid warnings [Oberhumer]
  225.54 -- Add contrib/masmx64 [Vollant]
  225.55 -- Update contrib/asm586, asm686, masmx86, testzlib, vstudio [Vollant]
  225.56 -
  225.57 -Changes in 1.2.2.2 (30 December 2004)
  225.58 -- Replace structure assignments in deflate.c and inflate.c with zmemcpy to
  225.59 -  avoid implicit memcpy calls (portability for no-library compilation)
  225.60 -- Increase sprintf() buffer size in gzdopen() to allow for large numbers
  225.61 -- Add INFLATE_STRICT to check distances against zlib header
  225.62 -- Improve WinCE errno handling and comments [Chang]
  225.63 -- Remove comment about no gzip header processing in FAQ
  225.64 -- Add Z_FIXED strategy option to deflateInit2() to force fixed trees
  225.65 -- Add updated make_vms.com [Coghlan], update README
  225.66 -- Create a new "examples" directory, move gzappend.c there, add zpipe.c,
  225.67 -  fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html.
  225.68 -- Add FAQ entry and comments in deflate.c on uninitialized memory access
  225.69 -- Add Solaris 9 make options in configure [Gilbert]
  225.70 -- Allow strerror() usage in gzio.c for STDC
  225.71 -- Fix DecompressBuf in contrib/delphi/ZLib.pas [ManChesTer]
  225.72 -- Update contrib/masmx86/inffas32.asm and gvmat32.asm [Vollant]
  225.73 -- Use z_off_t for adler32_combine() and crc32_combine() lengths
  225.74 -- Make adler32() much faster for small len
  225.75 -- Use OS_CODE in deflate() default gzip header
  225.76 -
  225.77 -Changes in 1.2.2.1 (31 October 2004)
  225.78 -- Allow inflateSetDictionary() call for raw inflate
  225.79 -- Fix inflate header crc check bug for file names and comments
  225.80 -- Add deflateSetHeader() and gz_header structure for custom gzip headers
  225.81 -- Add inflateGetheader() to retrieve gzip headers
  225.82 -- Add crc32_combine() and adler32_combine() functions
  225.83 -- Add alloc_func, free_func, in_func, out_func to Z_PREFIX list
  225.84 -- Use zstreamp consistently in zlib.h (inflate_back functions)
  225.85 -- Remove GUNZIP condition from definition of inflate_mode in inflate.h
  225.86 -  and in contrib/inflate86/inffast.S [Truta, Anderson]
  225.87 -- Add support for AMD64 in contrib/inflate86/inffas86.c [Anderson]
  225.88 -- Update projects/README.projects and projects/visualc6 [Truta]
  225.89 -- Update win32/DLL_FAQ.txt [Truta]
  225.90 -- Avoid warning under NO_GZCOMPRESS in gzio.c; fix typo [Truta]
  225.91 -- Deprecate Z_ASCII; use Z_TEXT instead [Truta]
  225.92 -- Use a new algorithm for setting strm->data_type in trees.c [Truta]
  225.93 -- Do not define an exit() prototype in zutil.c unless DEBUG defined
  225.94 -- Remove prototype of exit() from zutil.c, example.c, minigzip.c [Truta]
  225.95 -- Add comment in zlib.h for Z_NO_FLUSH parameter to deflate()
  225.96 -- Fix Darwin build version identification [Peterson]
  225.97 -
  225.98 -Changes in 1.2.2 (3 October 2004)
  225.99 -- Update zlib.h comments on gzip in-memory processing
 225.100 -- Set adler to 1 in inflateReset() to support Java test suite [Walles]
 225.101 -- Add contrib/dotzlib [Ravn]
 225.102 -- Update win32/DLL_FAQ.txt [Truta]
 225.103 -- Update contrib/minizip [Vollant]
 225.104 -- Move contrib/visual-basic.txt to old/ [Truta]
 225.105 -- Fix assembler builds in projects/visualc6/ [Truta]
 225.106 -
 225.107 -Changes in 1.2.1.2 (9 September 2004)
 225.108 -- Update INDEX file
 225.109 -- Fix trees.c to update strm->data_type (no one ever noticed!)
 225.110 -- Fix bug in error case in inflate.c, infback.c, and infback9.c [Brown]
 225.111 -- Add "volatile" to crc table flag declaration (for DYNAMIC_CRC_TABLE)
 225.112 -- Add limited multitasking protection to DYNAMIC_CRC_TABLE
 225.113 -- Add NO_vsnprintf for VMS in zutil.h [Mozilla]
 225.114 -- Don't declare strerror() under VMS [Mozilla]
 225.115 -- Add comment to DYNAMIC_CRC_TABLE to use get_crc_table() to initialize
 225.116 -- Update contrib/ada [Anisimkov]
 225.117 -- Update contrib/minizip [Vollant]
 225.118 -- Fix configure to not hardcode directories for Darwin [Peterson]
 225.119 -- Fix gzio.c to not return error on empty files [Brown]
 225.120 -- Fix indentation; update version in contrib/delphi/ZLib.pas and
 225.121 -  contrib/pascal/zlibpas.pas [Truta]
 225.122 -- Update mkasm.bat in contrib/masmx86 [Truta]
 225.123 -- Update contrib/untgz [Truta]
 225.124 -- Add projects/README.projects [Truta]
 225.125 -- Add project for MS Visual C++ 6.0 in projects/visualc6 [Cadieux, Truta]
 225.126 -- Update win32/DLL_FAQ.txt [Truta]
 225.127 -- Update list of Z_PREFIX symbols in zconf.h [Randers-Pehrson, Truta]
 225.128 -- Remove an unnecessary assignment to curr in inftrees.c [Truta]
 225.129 -- Add OS/2 to exe builds in configure [Poltorak]
 225.130 -- Remove err dummy parameter in zlib.h [Kientzle]
 225.131 -
 225.132 -Changes in 1.2.1.1 (9 January 2004)
 225.133 -- Update email address in README
 225.134 -- Several FAQ updates
 225.135 -- Fix a big fat bug in inftrees.c that prevented decoding valid
 225.136 -  dynamic blocks with only literals and no distance codes --
 225.137 -  Thanks to "Hot Emu" for the bug report and sample file
 225.138 -- Add a note to puff.c on no distance codes case.
 225.139 -
 225.140 -Changes in 1.2.1 (17 November 2003)
 225.141 -- Remove a tab in contrib/gzappend/gzappend.c
 225.142 -- Update some interfaces in contrib for new zlib functions
 225.143 -- Update zlib version number in some contrib entries
 225.144 -- Add Windows CE definition for ptrdiff_t in zutil.h [Mai, Truta]
 225.145 -- Support shared libraries on Hurd and KFreeBSD [Brown]
 225.146 -- Fix error in NO_DIVIDE option of adler32.c
 225.147 -
 225.148 -Changes in 1.2.0.8 (4 November 2003)
 225.149 -- Update version in contrib/delphi/ZLib.pas and contrib/pascal/zlibpas.pas
 225.150 -- Add experimental NO_DIVIDE #define in adler32.c
 225.151 -    - Possibly faster on some processors (let me know if it is)
 225.152 -- Correct Z_BLOCK to not return on first inflate call if no wrap
 225.153 -- Fix strm->data_type on inflate() return to correctly indicate EOB
 225.154 -- Add deflatePrime() function for appending in the middle of a byte
 225.155 -- Add contrib/gzappend for an example of appending to a stream
 225.156 -- Update win32/DLL_FAQ.txt [Truta]
 225.157 -- Delete Turbo C comment in README [Truta]
 225.158 -- Improve some indentation in zconf.h [Truta]
 225.159 -- Fix infinite loop on bad input in configure script [Church]
 225.160 -- Fix gzeof() for concatenated gzip files [Johnson]
 225.161 -- Add example to contrib/visual-basic.txt [Michael B.]
 225.162 -- Add -p to mkdir's in Makefile.in [vda]
 225.163 -- Fix configure to properly detect presence or lack of printf functions
 225.164 -- Add AS400 support [Monnerat]
 225.165 -- Add a little Cygwin support [Wilson]
 225.166 -
 225.167 -Changes in 1.2.0.7 (21 September 2003)
 225.168 -- Correct some debug formats in contrib/infback9
 225.169 -- Cast a type in a debug statement in trees.c
 225.170 -- Change search and replace delimiter in configure from % to # [Beebe]
 225.171 -- Update contrib/untgz to 0.2 with various fixes [Truta]
 225.172 -- Add build support for Amiga [Nikl]
 225.173 -- Remove some directories in old that have been updated to 1.2
 225.174 -- Add dylib building for Mac OS X in configure and Makefile.in
 225.175 -- Remove old distribution stuff from Makefile
 225.176 -- Update README to point to DLL_FAQ.txt, and add comment on Mac OS X
 225.177 -- Update links in README
 225.178 -
 225.179 -Changes in 1.2.0.6 (13 September 2003)
 225.180 -- Minor FAQ updates
 225.181 -- Update contrib/minizip to 1.00 [Vollant]
 225.182 -- Remove test of gz functions in example.c when GZ_COMPRESS defined [Truta]
 225.183 -- Update POSTINC comment for 68060 [Nikl]
 225.184 -- Add contrib/infback9 with deflate64 decoding (unsupported)
 225.185 -- For MVS define NO_vsnprintf and undefine FAR [van Burik]
 225.186 -- Add pragma for fdopen on MVS [van Burik]
 225.187 -
 225.188 -Changes in 1.2.0.5 (8 September 2003)
 225.189 -- Add OF to inflateBackEnd() declaration in zlib.h
 225.190 -- Remember start when using gzdopen in the middle of a file
 225.191 -- Use internal off_t counters in gz* functions to properly handle seeks
 225.192 -- Perform more rigorous check for distance-too-far in inffast.c
 225.193 -- Add Z_BLOCK flush option to return from inflate at block boundary
 225.194 -- Set strm->data_type on return from inflate
 225.195 -    - Indicate bits unused, if at block boundary, and if in last block
 225.196 -- Replace size_t with ptrdiff_t in crc32.c, and check for correct size
 225.197 -- Add condition so old NO_DEFLATE define still works for compatibility
 225.198 -- FAQ update regarding the Windows DLL [Truta]
 225.199 -- INDEX update: add qnx entry, remove aix entry [Truta]
 225.200 -- Install zlib.3 into mandir [Wilson]
 225.201 -- Move contrib/zlib_dll_FAQ.txt to win32/DLL_FAQ.txt; update [Truta]
 225.202 -- Adapt the zlib interface to the new DLL convention guidelines [Truta]
 225.203 -- Introduce ZLIB_WINAPI macro to allow the export of functions using
 225.204 -  the WINAPI calling convention, for Visual Basic [Vollant, Truta]
 225.205 -- Update msdos and win32 scripts and makefiles [Truta]
 225.206 -- Export symbols by name, not by ordinal, in win32/zlib.def [Truta]
 225.207 -- Add contrib/ada [Anisimkov]
 225.208 -- Move asm files from contrib/vstudio/vc70_32 to contrib/asm386 [Truta]
 225.209 -- Rename contrib/asm386 to contrib/masmx86 [Truta, Vollant]
 225.210 -- Add contrib/masm686 [Truta]
 225.211 -- Fix offsets in contrib/inflate86 and contrib/masmx86/inffas32.asm
 225.212 -  [Truta, Vollant]
 225.213 -- Update contrib/delphi; rename to contrib/pascal; add example [Truta]
 225.214 -- Remove contrib/delphi2; add a new contrib/delphi [Truta]
 225.215 -- Avoid inclusion of the nonstandard <memory.h> in contrib/iostream,
 225.216 -  and fix some method prototypes [Truta]
 225.217 -- Fix the ZCR_SEED2 constant to avoid warnings in contrib/minizip
 225.218 -  [Truta]
 225.219 -- Avoid the use of backslash (\) in contrib/minizip [Vollant]
 225.220 -- Fix file time handling in contrib/untgz; update makefiles [Truta]
 225.221 -- Update contrib/vstudio/vc70_32 to comply with the new DLL guidelines
 225.222 -  [Vollant]
 225.223 -- Remove contrib/vstudio/vc15_16 [Vollant]
 225.224 -- Rename contrib/vstudio/vc70_32 to contrib/vstudio/vc7 [Truta]
 225.225 -- Update README.contrib [Truta]
 225.226 -- Invert the assignment order of match_head and s->prev[...] in
 225.227 -  INSERT_STRING [Truta]
 225.228 -- Compare TOO_FAR with 32767 instead of 32768, to avoid 16-bit warnings
 225.229 -  [Truta]
 225.230 -- Compare function pointers with 0, not with NULL or Z_NULL [Truta]
 225.231 -- Fix prototype of syncsearch in inflate.c [Truta]
 225.232 -- Introduce ASMINF macro to be enabled when using an ASM implementation
 225.233 -  of inflate_fast [Truta]
 225.234 -- Change NO_DEFLATE to NO_GZCOMPRESS [Truta]
 225.235 -- Modify test_gzio in example.c to take a single file name as a
 225.236 -  parameter [Truta]
 225.237 -- Exit the example.c program if gzopen fails [Truta]
 225.238 -- Add type casts around strlen in example.c [Truta]
 225.239 -- Remove casting to sizeof in minigzip.c; give a proper type
 225.240 -  to the variable compared with SUFFIX_LEN [Truta]
 225.241 -- Update definitions of STDC and STDC99 in zconf.h [Truta]
 225.242 -- Synchronize zconf.h with the new Windows DLL interface [Truta]
 225.243 -- Use SYS16BIT instead of __32BIT__ to distinguish between
 225.244 -  16- and 32-bit platforms [Truta]
 225.245 -- Use far memory allocators in small 16-bit memory models for
 225.246 -  Turbo C [Truta]
 225.247 -- Add info about the use of ASMV, ASMINF and ZLIB_WINAPI in
 225.248 -  zlibCompileFlags [Truta]
 225.249 -- Cygwin has vsnprintf [Wilson]
 225.250 -- In Windows16, OS_CODE is 0, as in MSDOS [Truta]
 225.251 -- In Cygwin, OS_CODE is 3 (Unix), not 11 (Windows32) [Wilson]
 225.252 -
 225.253 -Changes in 1.2.0.4 (10 August 2003)
 225.254 -- Minor FAQ updates
 225.255 -- Be more strict when checking inflateInit2's windowBits parameter
 225.256 -- Change NO_GUNZIP compile option to NO_GZIP to cover deflate as well
 225.257 -- Add gzip wrapper option to deflateInit2 using windowBits
 225.258 -- Add updated QNX rule in configure and qnx directory [Bonnefoy]
 225.259 -- Make inflate distance-too-far checks more rigorous
 225.260 -- Clean up FAR usage in inflate
 225.261 -- Add casting to sizeof() in gzio.c and minigzip.c
 225.262 -
 225.263 -Changes in 1.2.0.3 (19 July 2003)
 225.264 -- Fix silly error in gzungetc() implementation [Vollant]
 225.265 -- Update contrib/minizip and contrib/vstudio [Vollant]
 225.266 -- Fix printf format in example.c
 225.267 -- Correct cdecl support in zconf.in.h [Anisimkov]
 225.268 -- Minor FAQ updates
 225.269 -
 225.270 -Changes in 1.2.0.2 (13 July 2003)
 225.271 -- Add ZLIB_VERNUM in zlib.h for numerical preprocessor comparisons
 225.272 -- Attempt to avoid warnings in crc32.c for pointer-int conversion
 225.273 -- Add AIX to configure, remove aix directory [Bakker]
 225.274 -- Add some casts to minigzip.c
 225.275 -- Improve checking after insecure sprintf() or vsprintf() calls
 225.276 -- Remove #elif's from crc32.c
 225.277 -- Change leave label to inf_leave in inflate.c and infback.c to avoid
 225.278 -  library conflicts
 225.279 -- Remove inflate gzip decoding by default--only enable gzip decoding by
 225.280 -  special request for stricter backward compatibility
 225.281 -- Add zlibCompileFlags() function to return compilation information
 225.282 -- More typecasting in deflate.c to avoid warnings
 225.283 -- Remove leading underscore from _Capital #defines [Truta]
 225.284 -- Fix configure to link shared library when testing
 225.285 -- Add some Windows CE target adjustments [Mai]
 225.286 -- Remove #define ZLIB_DLL in zconf.h [Vollant]
 225.287 -- Add zlib.3 [Rodgers]
 225.288 -- Update RFC URL in deflate.c and algorithm.txt [Mai]
 225.289 -- Add zlib_dll_FAQ.txt to contrib [Truta]
 225.290 -- Add UL to some constants [Truta]
 225.291 -- Update minizip and vstudio [Vollant]
 225.292 -- Remove vestigial NEED_DUMMY_RETURN from zconf.in.h
 225.293 -- Expand use of NO_DUMMY_DECL to avoid all dummy structures
 225.294 -- Added iostream3 to contrib [Schwardt]
 225.295 -- Replace rewind() with fseek() for WinCE [Truta]
 225.296 -- Improve setting of zlib format compression level flags
 225.297 -    - Report 0 for huffman and rle strategies and for level == 0 or 1
 225.298 -    - Report 2 only for level == 6
 225.299 -- Only deal with 64K limit when necessary at compile time [Truta]
 225.300 -- Allow TOO_FAR check to be turned off at compile time [Truta]
 225.301 -- Add gzclearerr() function [Souza]
 225.302 -- Add gzungetc() function
 225.303 -
 225.304 -Changes in 1.2.0.1 (17 March 2003)
 225.305 -- Add Z_RLE strategy for run-length encoding [Truta]
 225.306 -    - When Z_RLE requested, restrict matches to distance one
 225.307 -    - Update zlib.h, minigzip.c, gzopen(), gzdopen() for Z_RLE
 225.308 -- Correct FASTEST compilation to allow level == 0
 225.309 -- Clean up what gets compiled for FASTEST
 225.310 -- Incorporate changes to zconf.in.h [Vollant]
 225.311 -    - Refine detection of Turbo C need for dummy returns
 225.312 -    - Refine ZLIB_DLL compilation
 225.313 -    - Include additional header file on VMS for off_t typedef
 225.314 -- Try to use _vsnprintf where it supplants vsprintf [Vollant]
 225.315 -- Add some casts in inffast.c
 225.316 -- Enchance comments in zlib.h on what happens if gzprintf() tries to
 225.317 -  write more than 4095 bytes before compression
 225.318 -- Remove unused state from inflateBackEnd()
 225.319 -- Remove exit(0) from minigzip.c, example.c
 225.320 -- Get rid of all those darn tabs
 225.321 -- Add "check" target to Makefile.in that does the same thing as "test"
 225.322 -- Add "mostlyclean" and "maintainer-clean" targets to Makefile.in
 225.323 -- Update contrib/inflate86 [Anderson]
 225.324 -- Update contrib/testzlib, contrib/vstudio, contrib/minizip [Vollant]
 225.325 -- Add msdos and win32 directories with makefiles [Truta]
 225.326 -- More additions and improvements to the FAQ
 225.327 -
 225.328 -Changes in 1.2.0 (9 March 2003)
 225.329 -- New and improved inflate code
 225.330 -    - About 20% faster
 225.331 -    - Does not allocate 32K window unless and until needed
 225.332 -    - Automatically detects and decompresses gzip streams
 225.333 -    - Raw inflate no longer needs an extra dummy byte at end
 225.334 -    - Added inflateBack functions using a callback interface--even faster
 225.335 -      than inflate, useful for file utilities (gzip, zip)
 225.336 -    - Added inflateCopy() function to record state for random access on
 225.337 -      externally generated deflate streams (e.g. in gzip files)
 225.338 -    - More readable code (I hope)
 225.339 -- New and improved crc32()
 225.340 -    - About 50% faster, thanks to suggestions from Rodney Brown
 225.341 -- Add deflateBound() and compressBound() functions
 225.342 -- Fix memory leak in deflateInit2()
 225.343 -- Permit setting dictionary for raw deflate (for parallel deflate)
 225.344 -- Fix const declaration for gzwrite()
 225.345 -- Check for some malloc() failures in gzio.c
 225.346 -- Fix bug in gzopen() on single-byte file 0x1f
 225.347 -- Fix bug in gzread() on concatenated file with 0x1f at end of buffer
 225.348 -  and next buffer doesn't start with 0x8b
 225.349 -- Fix uncompress() to return Z_DATA_ERROR on truncated input
 225.350 -- Free memory at end of example.c
 225.351 -- Remove MAX #define in trees.c (conflicted with some libraries)
 225.352 -- Fix static const's in deflate.c, gzio.c, and zutil.[ch]
 225.353 -- Declare malloc() and free() in gzio.c if STDC not defined
 225.354 -- Use malloc() instead of calloc() in zutil.c if int big enough
 225.355 -- Define STDC for AIX
 225.356 -- Add aix/ with approach for compiling shared library on AIX
 225.357 -- Add HP-UX support for shared libraries in configure
 225.358 -- Add OpenUNIX support for shared libraries in configure
 225.359 -- Use $cc instead of gcc to build shared library
 225.360 -- Make prefix directory if needed when installing
 225.361 -- Correct Macintosh avoidance of typedef Byte in zconf.h
 225.362 -- Correct Turbo C memory allocation when under Linux
 225.363 -- Use libz.a instead of -lz in Makefile (assure use of compiled library)
 225.364 -- Update configure to check for snprintf or vsnprintf functions and their
 225.365 -  return value, warn during make if using an insecure function
 225.366 -- Fix configure problem with compile-time knowledge of HAVE_UNISTD_H that
 225.367 -  is lost when library is used--resolution is to build new zconf.h
 225.368 -- Documentation improvements (in zlib.h):
 225.369 -    - Document raw deflate and inflate
 225.370 -    - Update RFCs URL
 225.371 -    - Point out that zlib and gzip formats are different
 225.372 -    - Note that Z_BUF_ERROR is not fatal
 225.373 -    - Document string limit for gzprintf() and possible buffer overflow
 225.374 -    - Note requirement on avail_out when flushing
 225.375 -    - Note permitted values of flush parameter of inflate()
 225.376 -- Add some FAQs (and even answers) to the FAQ
 225.377 -- Add contrib/inflate86/ for x86 faster inflate
 225.378 -- Add contrib/blast/ for PKWare Data Compression Library decompression
 225.379 -- Add contrib/puff/ simple inflate for deflate format description
 225.380 -
 225.381 -Changes in 1.1.4 (11 March 2002)
 225.382 -- ZFREE was repeated on same allocation on some error conditions.
 225.383 -  This creates a security problem described in
 225.384 -  http://www.zlib.org/advisory-2002-03-11.txt
 225.385 -- Returned incorrect error (Z_MEM_ERROR) on some invalid data
 225.386 -- Avoid accesses before window for invalid distances with inflate window
 225.387 -  less than 32K.
 225.388 -- force windowBits > 8 to avoid a bug in the encoder for a window size
 225.389 -  of 256 bytes. (A complete fix will be available in 1.1.5).
 225.390 -
 225.391 -Changes in 1.1.3 (9 July 1998)
 225.392 -- fix "an inflate input buffer bug that shows up on rare but persistent
 225.393 -  occasions" (Mark)
 225.394 -- fix gzread and gztell for concatenated .gz files (Didier Le Botlan)
 225.395 -- fix gzseek(..., SEEK_SET) in write mode
 225.396 -- fix crc check after a gzeek (Frank Faubert)
 225.397 -- fix miniunzip when the last entry in a zip file is itself a zip file
 225.398 -  (J Lillge)
 225.399 -- add contrib/asm586 and contrib/asm686 (Brian Raiter)
 225.400 -  See http://www.muppetlabs.com/~breadbox/software/assembly.html
 225.401 -- add support for Delphi 3 in contrib/delphi (Bob Dellaca)
 225.402 -- add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti)
 225.403 -- do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren)
 225.404 -- use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks)
 225.405 -- added a FAQ file
 225.406 -
 225.407 -- Support gzdopen on Mac with Metrowerks (Jason Linhart)
 225.408 -- Do not redefine Byte on Mac (Brad Pettit & Jason Linhart)
 225.409 -- define SEEK_END too if SEEK_SET is not defined (Albert Chin-A-Young)
 225.410 -- avoid some warnings with Borland C (Tom Tanner)
 225.411 -- fix a problem in contrib/minizip/zip.c for 16-bit MSDOS (Gilles Vollant)
 225.412 -- emulate utime() for WIN32 in contrib/untgz  (Gilles Vollant)
 225.413 -- allow several arguments to configure (Tim Mooney, Frodo Looijaard)
 225.414 -- use libdir and includedir in Makefile.in (Tim Mooney)
 225.415 -- support shared libraries on OSF1 V4 (Tim Mooney)
 225.416 -- remove so_locations in "make clean"  (Tim Mooney)
 225.417 -- fix maketree.c compilation error (Glenn, Mark)
 225.418 -- Python interface to zlib now in Python 1.5 (Jeremy Hylton)
 225.419 -- new Makefile.riscos (Rich Walker)
 225.420 -- initialize static descriptors in trees.c for embedded targets (Nick Smith)
 225.421 -- use "foo-gz" in example.c for RISCOS and VMS (Nick Smith)
 225.422 -- add the OS/2 files in Makefile.in too (Andrew Zabolotny)
 225.423 -- fix fdopen and halloc macros for Microsoft C 6.0 (Tom Lane)
 225.424 -- fix maketree.c to allow clean compilation of inffixed.h (Mark)
 225.425 -- fix parameter check in deflateCopy (Gunther Nikl)
 225.426 -- cleanup trees.c, use compressed_len only in debug mode (Christian Spieler)
 225.427 -- Many portability patches by Christian Spieler:
 225.428 -  . zutil.c, zutil.h: added "const" for zmem*
 225.429 -  . Make_vms.com: fixed some typos
 225.430 -  . Make_vms.com: msdos/Makefile.*: removed zutil.h from some dependency lists
 225.431 -  . msdos/Makefile.msc: remove "default rtl link library" info from obj files
 225.432 -  . msdos/Makefile.*: use model-dependent name for the built zlib library
 225.433 -  . msdos/Makefile.emx, nt/Makefile.emx, nt/Makefile.gcc:
 225.434 -     new makefiles, for emx (DOS/OS2), emx&rsxnt and mingw32 (Windows 9x / NT)
 225.435 -- use define instead of typedef for Bytef also for MSC small/medium (Tom Lane)
 225.436 -- replace __far with _far for better portability (Christian Spieler, Tom Lane)
 225.437 -- fix test for errno.h in configure (Tim Newsham)
 225.438 -
 225.439 -Changes in 1.1.2 (19 March 98)
 225.440 -- added contrib/minzip, mini zip and unzip based on zlib (Gilles Vollant)
 225.441 -  See http://www.winimage.com/zLibDll/unzip.html
 225.442 -- preinitialize the inflate tables for fixed codes, to make the code
 225.443 -  completely thread safe (Mark)
 225.444 -- some simplifications and slight speed-up to the inflate code (Mark)
 225.445 -- fix gzeof on non-compressed files (Allan Schrum)
 225.446 -- add -std1 option in configure for OSF1 to fix gzprintf (Martin Mokrejs)
 225.447 -- use default value of 4K for Z_BUFSIZE for 16-bit MSDOS (Tim Wegner + Glenn)
 225.448 -- added os2/Makefile.def and os2/zlib.def (Andrew Zabolotny)
 225.449 -- add shared lib support for UNIX_SV4.2MP (MATSUURA Takanori)
 225.450 -- do not wrap extern "C" around system includes (Tom Lane)
 225.451 -- mention zlib binding for TCL in README (Andreas Kupries)
 225.452 -- added amiga/Makefile.pup for Amiga powerUP SAS/C PPC (Andreas Kleinert)
 225.453 -- allow "make install prefix=..." even after configure (Glenn Randers-Pehrson)
 225.454 -- allow "configure --prefix $HOME" (Tim Mooney)
 225.455 -- remove warnings in example.c and gzio.c (Glenn Randers-Pehrson)
 225.456 -- move Makefile.sas to amiga/Makefile.sas
 225.457 -
 225.458 -Changes in 1.1.1 (27 Feb 98)
 225.459 -- fix macros _tr_tally_* in deflate.h for debug mode  (Glenn Randers-Pehrson)
 225.460 -- remove block truncation heuristic which had very marginal effect for zlib
 225.461 -  (smaller lit_bufsize than in gzip 1.2.4) and degraded a little the
 225.462 -  compression ratio on some files. This also allows inlining _tr_tally for
 225.463 -  matches in deflate_slow.
 225.464 -- added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier)
 225.465 -
 225.466 -Changes in 1.1.0 (24 Feb 98)
 225.467 -- do not return STREAM_END prematurely in inflate (John Bowler)
 225.468 -- revert to the zlib 1.0.8 inflate to avoid the gcc 2.8.0 bug (Jeremy Buhler)
 225.469 -- compile with -DFASTEST to get compression code optimized for speed only
 225.470 -- in minigzip, try mmap'ing the input file first (Miguel Albrecht)
 225.471 -- increase size of I/O buffers in minigzip.c and gzio.c (not a big gain
 225.472 -  on Sun but significant on HP)
 225.473 -
 225.474 -- add a pointer to experimental unzip library in README (Gilles Vollant)
 225.475 -- initialize variable gcc in configure (Chris Herborth)
 225.476 -
 225.477 -Changes in 1.0.9 (17 Feb 1998)
 225.478 -- added gzputs and gzgets functions
 225.479 -- do not clear eof flag in gzseek (Mark Diekhans)
 225.480 -- fix gzseek for files in transparent mode (Mark Diekhans)
 225.481 -- do not assume that vsprintf returns the number of bytes written (Jens Krinke)
 225.482 -- replace EXPORT with ZEXPORT to avoid conflict with other programs
 225.483 -- added compress2 in zconf.h, zlib.def, zlib.dnt
 225.484 -- new asm code from Gilles Vollant in contrib/asm386
 225.485 -- simplify the inflate code (Mark):
 225.486 - . Replace ZALLOC's in huft_build() with single ZALLOC in inflate_blocks_new()
 225.487 - . ZALLOC the length list in inflate_trees_fixed() instead of using stack
 225.488 - . ZALLOC the value area for huft_build() instead of using stack
 225.489 - . Simplify Z_FINISH check in inflate()
 225.490 -
 225.491 -- Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8
 225.492 -- in inftrees.c, avoid cc -O bug on HP (Farshid Elahi)
 225.493 -- in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with
 225.494 -  the declaration of FAR (Gilles VOllant)
 225.495 -- install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann)
 225.496 -- read_buf buf parameter of type Bytef* instead of charf*
 225.497 -- zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout)
 225.498 -- do not redeclare unlink in minigzip.c for WIN32 (John Bowler)
 225.499 -- fix check for presence of directories in "make install" (Ian Willis)
 225.500 -
 225.501 -Changes in 1.0.8 (27 Jan 1998)
 225.502 -- fixed offsets in contrib/asm386/gvmat32.asm (Gilles Vollant)
 225.503 -- fix gzgetc and gzputc for big endian systems (Markus Oberhumer)
 225.504 -- added compress2() to allow setting the compression level
 225.505 -- include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong)
 225.506 -- use constant arrays for the static trees in trees.c instead of computing
 225.507 -  them at run time (thanks to Ken Raeburn for this suggestion). To create
 225.508 -  trees.h, compile with GEN_TREES_H and run "make test".
 225.509 -- check return code of example in "make test" and display result
 225.510 -- pass minigzip command line options to file_compress
 225.511 -- simplifying code of inflateSync to avoid gcc 2.8 bug
 225.512 -
 225.513 -- support CC="gcc -Wall" in configure -s (QingLong)
 225.514 -- avoid a flush caused by ftell in gzopen for write mode (Ken Raeburn)
 225.515 -- fix test for shared library support to avoid compiler warnings
 225.516 -- zlib.lib -> zlib.dll in msdos/zlib.rc (Gilles Vollant)
 225.517 -- check for TARGET_OS_MAC in addition to MACOS (Brad Pettit)
 225.518 -- do not use fdopen for Metrowerks on Mac (Brad Pettit))
 225.519 -- add checks for gzputc and gzputc in example.c
 225.520 -- avoid warnings in gzio.c and deflate.c (Andreas Kleinert)
 225.521 -- use const for the CRC table (Ken Raeburn)
 225.522 -- fixed "make uninstall" for shared libraries
 225.523 -- use Tracev instead of Trace in infblock.c
 225.524 -- in example.c use correct compressed length for test_sync
 225.525 -- suppress +vnocompatwarnings in configure for HPUX (not always supported)
 225.526 -
 225.527 -Changes in 1.0.7 (20 Jan 1998)
 225.528 -- fix gzseek which was broken in write mode
 225.529 -- return error for gzseek to negative absolute position
 225.530 -- fix configure for Linux (Chun-Chung Chen)
 225.531 -- increase stack space for MSC (Tim Wegner)
 225.532 -- get_crc_table and inflateSyncPoint are EXPORTed (Gilles Vollant)
 225.533 -- define EXPORTVA for gzprintf (Gilles Vollant)
 225.534 -- added man page zlib.3 (Rick Rodgers)
 225.535 -- for contrib/untgz, fix makedir() and improve Makefile
 225.536 -
 225.537 -- check gzseek in write mode in example.c
 225.538 -- allocate extra buffer for seeks only if gzseek is actually called
 225.539 -- avoid signed/unsigned comparisons (Tim Wegner, Gilles Vollant)
 225.540 -- add inflateSyncPoint in zconf.h
 225.541 -- fix list of exported functions in nt/zlib.dnt and mdsos/zlib.def
 225.542 -
 225.543 -Changes in 1.0.6 (19 Jan 1998)
 225.544 -- add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and
 225.545 -  gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code)
 225.546 -- Fix a deflate bug occurring only with compression level 0 (thanks to
 225.547 -  Andy Buckler for finding this one).
 225.548 -- In minigzip, pass transparently also the first byte for .Z files.
 225.549 -- return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress()
 225.550 -- check Z_FINISH in inflate (thanks to Marc Schluper)
 225.551 -- Implement deflateCopy (thanks to Adam Costello)
 225.552 -- make static libraries by default in configure, add --shared option.
 225.553 -- move MSDOS or Windows specific files to directory msdos
 225.554 -- suppress the notion of partial flush to simplify the interface
 225.555 -  (but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4)
 225.556 -- suppress history buffer provided by application to simplify the interface
 225.557 -  (this feature was not implemented anyway in 1.0.4)
 225.558 -- next_in and avail_in must be initialized before calling inflateInit or
 225.559 -  inflateInit2
 225.560 -- add EXPORT in all exported functions (for Windows DLL)
 225.561 -- added Makefile.nt (thanks to Stephen Williams)
 225.562 -- added the unsupported "contrib" directory:
 225.563 -   contrib/asm386/ by Gilles Vollant <info@winimage.com>
 225.564 -        386 asm code replacing longest_match().
 225.565 -   contrib/iostream/ by Kevin Ruland <kevin@rodin.wustl.edu>
 225.566 -        A C++ I/O streams interface to the zlib gz* functions
 225.567 -   contrib/iostream2/  by Tyge Løvset <Tyge.Lovset@cmr.no>
 225.568 -        Another C++ I/O streams interface
 225.569 -   contrib/untgz/  by "Pedro A. Aranda Guti\irrez" <paag@tid.es>
 225.570 -        A very simple tar.gz file extractor using zlib
 225.571 -   contrib/visual-basic.txt by Carlos Rios <c_rios@sonda.cl>
 225.572 -        How to use compress(), uncompress() and the gz* functions from VB.
 225.573 -- pass params -f (filtered data), -h (huffman only), -1 to -9 (compression
 225.574 -  level) in minigzip (thanks to Tom Lane)
 225.575 -
 225.576 -- use const for rommable constants in deflate
 225.577 -- added test for gzseek and gztell in example.c
 225.578 -- add undocumented function inflateSyncPoint() (hack for Paul Mackerras)
 225.579 -- add undocumented function zError to convert error code to string
 225.580 -  (for Tim Smithers)
 225.581 -- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code.
 225.582 -- Use default memcpy for Symantec MSDOS compiler.
 225.583 -- Add EXPORT keyword for check_func (needed for Windows DLL)
 225.584 -- add current directory to LD_LIBRARY_PATH for "make test"
 225.585 -- create also a link for libz.so.1
 225.586 -- added support for FUJITSU UXP/DS (thanks to Toshiaki Nomura)
 225.587 -- use $(SHAREDLIB) instead of libz.so in Makefile.in (for HPUX)
 225.588 -- added -soname for Linux in configure (Chun-Chung Chen,
 225.589 -- assign numbers to the exported functions in zlib.def (for Windows DLL)
 225.590 -- add advice in zlib.h for best usage of deflateSetDictionary
 225.591 -- work around compiler bug on Atari (cast Z_NULL in call of s->checkfn)
 225.592 -- allow compilation with ANSI keywords only enabled for TurboC in large model
 225.593 -- avoid "versionString"[0] (Borland bug)
 225.594 -- add NEED_DUMMY_RETURN for Borland
 225.595 -- use variable z_verbose for tracing in debug mode (L. Peter Deutsch).
 225.596 -- allow compilation with CC
 225.597 -- defined STDC for OS/2 (David Charlap)
 225.598 -- limit external names to 8 chars for MVS (Thomas Lund)
 225.599 -- in minigzip.c, use static buffers only for 16-bit systems
 225.600 -- fix suffix check for "minigzip -d foo.gz"
 225.601 -- do not return an error for the 2nd of two consecutive gzflush() (Felix Lee)
 225.602 -- use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau)
 225.603 -- added makelcc.bat for lcc-win32 (Tom St Denis)
 225.604 -- in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe)
 225.605 -- Avoid expanded $Id$. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion.
 225.606 -- check for unistd.h in configure (for off_t)
 225.607 -- remove useless check parameter in inflate_blocks_free
 225.608 -- avoid useless assignment of s->check to itself in inflate_blocks_new
 225.609 -- do not flush twice in gzclose (thanks to Ken Raeburn)
 225.610 -- rename FOPEN as F_OPEN to avoid clash with /usr/include/sys/file.h
 225.611 -- use NO_ERRNO_H instead of enumeration of operating systems with errno.h
 225.612 -- work around buggy fclose on pipes for HP/UX
 225.613 -- support zlib DLL with BORLAND C++ 5.0 (thanks to Glenn Randers-Pehrson)
 225.614 -- fix configure if CC is already equal to gcc
 225.615 -
 225.616 -Changes in 1.0.5 (3 Jan 98)
 225.617 -- Fix inflate to terminate gracefully when fed corrupted or invalid data
 225.618 -- Use const for rommable constants in inflate
 225.619 -- Eliminate memory leaks on error conditions in inflate
 225.620 -- Removed some vestigial code in inflate
 225.621 -- Update web address in README
 225.622 -
 225.623 -Changes in 1.0.4 (24 Jul 96)
 225.624 -- In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF
 225.625 -  bit, so the decompressor could decompress all the correct data but went
 225.626 -  on to attempt decompressing extra garbage data. This affected minigzip too.
 225.627 -- zlibVersion and gzerror return const char* (needed for DLL)
 225.628 -- port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno)
 225.629 -- use z_error only for DEBUG (avoid problem with DLLs)
 225.630 -
 225.631 -Changes in 1.0.3 (2 Jul 96)
 225.632 -- use z_streamp instead of z_stream *, which is now a far pointer in MSDOS
 225.633 -  small and medium models; this makes the library incompatible with previous
 225.634 -  versions for these models. (No effect in large model or on other systems.)
 225.635 -- return OK instead of BUF_ERROR if previous deflate call returned with
 225.636 -  avail_out as zero but there is nothing to do
 225.637 -- added memcmp for non STDC compilers
 225.638 -- define NO_DUMMY_DECL for more Mac compilers (.h files merged incorrectly)
 225.639 -- define __32BIT__ if __386__ or i386 is defined (pb. with Watcom and SCO)
 225.640 -- better check for 16-bit mode MSC (avoids problem with Symantec)
 225.641 -
 225.642 -Changes in 1.0.2 (23 May 96)
 225.643 -- added Windows DLL support
 225.644 -- added a function zlibVersion (for the DLL support)
 225.645 -- fixed declarations using Bytef in infutil.c (pb with MSDOS medium model)
 225.646 -- Bytef is define's instead of typedef'd only for Borland C
 225.647 -- avoid reading uninitialized memory in example.c
 225.648 -- mention in README that the zlib format is now RFC1950
 225.649 -- updated Makefile.dj2
 225.650 -- added algorithm.doc
 225.651 -
 225.652 -Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion]
 225.653 -- fix array overlay in deflate.c which sometimes caused bad compressed data
 225.654 -- fix inflate bug with empty stored block
 225.655 -- fix MSDOS medium model which was broken in 0.99
 225.656 -- fix deflateParams() which could generated bad compressed data.
 225.657 -- Bytef is define'd instead of typedef'ed (work around Borland bug)
 225.658 -- added an INDEX file
 225.659 -- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32),
 225.660 -  Watcom (Makefile.wat), Amiga SAS/C (Makefile.sas)
 225.661 -- speed up adler32 for modern machines without auto-increment
 225.662 -- added -ansi for IRIX in configure
 225.663 -- static_init_done in trees.c is an int
 225.664 -- define unlink as delete for VMS
 225.665 -- fix configure for QNX
 225.666 -- add configure branch for SCO and HPUX
 225.667 -- avoid many warnings (unused variables, dead assignments, etc...)
 225.668 -- no fdopen for BeOS
 225.669 -- fix the Watcom fix for 32 bit mode (define FAR as empty)
 225.670 -- removed redefinition of Byte for MKWERKS
 225.671 -- work around an MWKERKS bug (incorrect merge of all .h files)
 225.672 -
 225.673 -Changes in 0.99 (27 Jan 96)
 225.674 -- allow preset dictionary shared between compressor and decompressor
 225.675 -- allow compression level 0 (no compression)
 225.676 -- add deflateParams in zlib.h: allow dynamic change of compression level
 225.677 -  and compression strategy.
 225.678 -- test large buffers and deflateParams in example.c
 225.679 -- add optional "configure" to build zlib as a shared library
 225.680 -- suppress Makefile.qnx, use configure instead
 225.681 -- fixed deflate for 64-bit systems (detected on Cray)
 225.682 -- fixed inflate_blocks for 64-bit systems (detected on Alpha)
 225.683 -- declare Z_DEFLATED in zlib.h (possible parameter for deflateInit2)
 225.684 -- always return Z_BUF_ERROR when deflate() has nothing to do
 225.685 -- deflateInit and inflateInit are now macros to allow version checking
 225.686 -- prefix all global functions and types with z_ with -DZ_PREFIX
 225.687 -- make falloc completely reentrant (inftrees.c)
 225.688 -- fixed very unlikely race condition in ct_static_init
 225.689 -- free in reverse order of allocation to help memory manager
 225.690 -- use zlib-1.0/* instead of zlib/* inside the tar.gz
 225.691 -- make zlib warning-free with "gcc -O3 -Wall -Wwrite-strings -Wpointer-arith
 225.692 -  -Wconversion -Wstrict-prototypes -Wmissing-prototypes"
 225.693 -- allow gzread on concatenated .gz files
 225.694 -- deflateEnd now returns Z_DATA_ERROR if it was premature
 225.695 -- deflate is finally (?) fully deterministic (no matches beyond end of input)
 225.696 -- Document Z_SYNC_FLUSH
 225.697 -- add uninstall in Makefile
 225.698 -- Check for __cpluplus in zlib.h
 225.699 -- Better test in ct_align for partial flush
 225.700 -- avoid harmless warnings for Borland C++
 225.701 -- initialize hash_head in deflate.c
 225.702 -- avoid warning on fdopen (gzio.c) for HP cc -Aa
 225.703 -- include stdlib.h for STDC compilers
 225.704 -- include errno.h for Cray
 225.705 -- ignore error if ranlib doesn't exist
 225.706 -- call ranlib twice for NeXTSTEP
 225.707 -- use exec_prefix instead of prefix for libz.a
 225.708 -- renamed ct_* as _tr_* to avoid conflict with applications
 225.709 -- clear z->msg in inflateInit2 before any error return
 225.710 -- initialize opaque in example.c, gzio.c, deflate.c and inflate.c
 225.711 -- fixed typo in zconf.h (_GNUC__ => __GNUC__)
 225.712 -- check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode)
 225.713 -- fix typo in Make_vms.com (f$trnlnm -> f$getsyi)
 225.714 -- in fcalloc, normalize pointer if size > 65520 bytes
 225.715 -- don't use special fcalloc for 32 bit Borland C++
 225.716 -- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc...
 225.717 -- use Z_BINARY instead of BINARY
 225.718 -- document that gzclose after gzdopen will close the file
 225.719 -- allow "a" as mode in gzopen.
 225.720 -- fix error checking in gzread
 225.721 -- allow skipping .gz extra-field on pipes
 225.722 -- added reference to Perl interface in README
 225.723 -- put the crc table in FAR data (I dislike more and more the medium model :)
 225.724 -- added get_crc_table
 225.725 -- added a dimension to all arrays (Borland C can't count).
 225.726 -- workaround Borland C bug in declaration of inflate_codes_new & inflate_fast
 225.727 -- guard against multiple inclusion of *.h (for precompiled header on Mac)
 225.728 -- Watcom C pretends to be Microsoft C small model even in 32 bit mode.
 225.729 -- don't use unsized arrays to avoid silly warnings by Visual C++:
 225.730 -     warning C4746: 'inflate_mask' : unsized array treated as  '__far'
 225.731 -     (what's wrong with far data in far model?).
 225.732 -- define enum out of inflate_blocks_state to allow compilation with C++
 225.733 -
 225.734 -Changes in 0.95 (16 Aug 95)
 225.735 -- fix MSDOS small and medium model (now easier to adapt to any compiler)
 225.736 -- inlined send_bits
 225.737 -- fix the final (:-) bug for deflate with flush (output was correct but
 225.738 -  not completely flushed in rare occasions).
 225.739 -- default window size is same for compression and decompression
 225.740 -  (it's now sufficient to set MAX_WBITS in zconf.h).
 225.741 -- voidp -> voidpf and voidnp -> voidp (for consistency with other
 225.742 -  typedefs and because voidnp was not near in large model).
 225.743 -
 225.744 -Changes in 0.94 (13 Aug 95)
 225.745 -- support MSDOS medium model
 225.746 -- fix deflate with flush (could sometimes generate bad output)
 225.747 -- fix deflateReset (zlib header was incorrectly suppressed)
 225.748 -- added support for VMS
 225.749 -- allow a compression level in gzopen()
 225.750 -- gzflush now calls fflush
 225.751 -- For deflate with flush, flush even if no more input is provided.
 225.752 -- rename libgz.a as libz.a
 225.753 -- avoid complex expression in infcodes.c triggering Turbo C bug
 225.754 -- work around a problem with gcc on Alpha (in INSERT_STRING)
 225.755 -- don't use inline functions (problem with some gcc versions)
 225.756 -- allow renaming of Byte, uInt, etc... with #define.
 225.757 -- avoid warning about (unused) pointer before start of array in deflate.c
 225.758 -- avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c
 225.759 -- avoid reserved word 'new' in trees.c
 225.760 -
 225.761 -Changes in 0.93 (25 June 95)
 225.762 -- temporarily disable inline functions
 225.763 -- make deflate deterministic
 225.764 -- give enough lookahead for PARTIAL_FLUSH
 225.765 -- Set binary mode for stdin/stdout in minigzip.c for OS/2
 225.766 -- don't even use signed char in inflate (not portable enough)
 225.767 -- fix inflate memory leak for segmented architectures
 225.768 -
 225.769 -Changes in 0.92 (3 May 95)
 225.770 -- don't assume that char is signed (problem on SGI)
 225.771 -- Clear bit buffer when starting a stored block
 225.772 -- no memcpy on Pyramid
 225.773 -- suppressed inftest.c
 225.774 -- optimized fill_window, put longest_match inline for gcc
 225.775 -- optimized inflate on stored blocks.
 225.776 -- untabify all sources to simplify patches
 225.777 -
 225.778 -Changes in 0.91 (2 May 95)
 225.779 -- Default MEM_LEVEL is 8 (not 9 for Unix) as documented in zlib.h
 225.780 -- Document the memory requirements in zconf.h
 225.781 -- added "make install"
 225.782 -- fix sync search logic in inflateSync
 225.783 -- deflate(Z_FULL_FLUSH) now works even if output buffer too short
 225.784 -- after inflateSync, don't scare people with just "lo world"
 225.785 -- added support for DJGPP
 225.786 -
 225.787 -Changes in 0.9 (1 May 95)
 225.788 -- don't assume that zalloc clears the allocated memory (the TurboC bug
 225.789 -  was Mark's bug after all :)
 225.790 -- let again gzread copy uncompressed data unchanged (was working in 0.71)
 225.791 -- deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented
 225.792 -- added a test of inflateSync in example.c
 225.793 -- moved MAX_WBITS to zconf.h because users might want to change that.
 225.794 -- document explicitly that zalloc(64K) on MSDOS must return a normalized
 225.795 -  pointer (zero offset)
 225.796 -- added Makefiles for Microsoft C, Turbo C, Borland C++
 225.797 -- faster crc32()
 225.798 -
 225.799 -Changes in 0.8 (29 April 95)
 225.800 -- added fast inflate (inffast.c)
 225.801 -- deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this
 225.802 -  is incompatible with previous versions of zlib which returned Z_OK.
 225.803 -- work around a TurboC compiler bug (bad code for b << 0, see infutil.h)
 225.804 -  (actually that was not a compiler bug, see 0.81 above)
 225.805 -- gzread no longer reads one extra byte in certain cases
 225.806 -- In gzio destroy(), don't reference a freed structure
 225.807 -- avoid many warnings for MSDOS
 225.808 -- avoid the ERROR symbol which is used by MS Windows
 225.809 -
 225.810 -Changes in 0.71 (14 April 95)
 225.811 -- Fixed more MSDOS compilation problems :( There is still a bug with
 225.812 -  TurboC large model.
 225.813 -
 225.814 -Changes in 0.7 (14 April 95)
 225.815 -- Added full inflate support.
 225.816 -- Simplified the crc32() interface. The pre- and post-conditioning
 225.817 -  (one's complement) is now done inside crc32(). WARNING: this is
 225.818 -  incompatible with previous versions; see zlib.h for the new usage.
 225.819 -
 225.820 -Changes in 0.61 (12 April 95)
 225.821 -- workaround for a bug in TurboC. example and minigzip now work on MSDOS.
 225.822 -
 225.823 -Changes in 0.6 (11 April 95)
 225.824 -- added minigzip.c
 225.825 -- added gzdopen to reopen a file descriptor as gzFile
 225.826 -- added transparent reading of non-gziped files in gzread.
 225.827 -- fixed bug in gzread (don't read crc as data)
 225.828 -- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose).
 225.829 -- don't allocate big arrays in the stack (for MSDOS)
 225.830 -- fix some MSDOS compilation problems
 225.831 -
 225.832 -Changes in 0.5:
 225.833 -- do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but
 225.834 -  not yet Z_FULL_FLUSH.
 225.835 -- support decompression but only in a single step (forced Z_FINISH)
 225.836 -- added opaque object for zalloc and zfree.
 225.837 -- added deflateReset and inflateReset
 225.838 -- added a variable zlib_version for consistency checking.
 225.839 -- renamed the 'filter' parameter of deflateInit2 as 'strategy'.
 225.840 -  Added Z_FILTERED and Z_HUFFMAN_ONLY constants.
 225.841 -
 225.842 -Changes in 0.4:
 225.843 -- avoid "zip" everywhere, use zlib instead of ziplib.
 225.844 -- suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush
 225.845 -  if compression method == 8.
 225.846 -- added adler32 and crc32
 225.847 -- renamed deflateOptions as deflateInit2, call one or the other but not both
 225.848 -- added the method parameter for deflateInit2.
 225.849 -- added inflateInit2
 225.850 -- simplied considerably deflateInit and inflateInit by not supporting
 225.851 -  user-provided history buffer. This is supported only in deflateInit2
 225.852 -  and inflateInit2.
 225.853 -
 225.854 -Changes in 0.3:
 225.855 -- prefix all macro names with Z_
 225.856 -- use Z_FINISH instead of deflateEnd to finish compression.
 225.857 -- added Z_HUFFMAN_ONLY
 225.858 -- added gzerror()
   226.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/README	Tue Dec 06 16:31:58 2011 -0800
   226.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   226.3 @@ -1,125 +0,0 @@
   226.4 -ZLIB DATA COMPRESSION LIBRARY
   226.5 -
   226.6 -zlib 1.2.3 is a general purpose data compression library.  All the code is
   226.7 -thread safe.  The data format used by the zlib library is described by RFCs
   226.8 -(Request for Comments) 1950 to 1952 in the files
   226.9 -http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format)
  226.10 -and rfc1952.txt (gzip format). These documents are also available in other
  226.11 -formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html
  226.12 -
  226.13 -All functions of the compression library are documented in the file zlib.h
  226.14 -(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example
  226.15 -of the library is given in the file example.c which also tests that the library
  226.16 -is working correctly. Another example is given in the file minigzip.c. The
  226.17 -compression library itself is composed of all source files except example.c and
  226.18 -minigzip.c.
  226.19 -
  226.20 -To compile all files and run the test program, follow the instructions given at
  226.21 -the top of Makefile. In short "make test; make install" should work for most
  226.22 -machines. For Unix: "./configure; make test; make install". For MSDOS, use one
  226.23 -of the special makefiles such as Makefile.msc. For VMS, use make_vms.com.
  226.24 -
  226.25 -Questions about zlib should be sent to <zlib@gzip.org>, or to Gilles Vollant
  226.26 -<info@winimage.com> for the Windows DLL version. The zlib home page is
  226.27 -http://www.zlib.org or http://www.gzip.org/zlib/ Before reporting a problem,
  226.28 -please check this site to verify that you have the latest version of zlib;
  226.29 -otherwise get the latest version and check whether the problem still exists or
  226.30 -not.
  226.31 -
  226.32 -PLEASE read the zlib FAQ http://www.gzip.org/zlib/zlib_faq.html before asking
  226.33 -for help.
  226.34 -
  226.35 -Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
  226.36 -issue of  Dr. Dobb's Journal; a copy of the article is available in
  226.37 -http://dogma.net/markn/articles/zlibtool/zlibtool.htm
  226.38 -
  226.39 -The changes made in version 1.2.3 are documented in the file ChangeLog.
  226.40 -
  226.41 -Unsupported third party contributions are provided in directory "contrib".
  226.42 -
  226.43 -A Java implementation of zlib is available in the Java Development Kit
  226.44 -http://java.sun.com/j2se/1.4.2/docs/api/java/util/zip/package-summary.html
  226.45 -See the zlib home page http://www.zlib.org for details.
  226.46 -
  226.47 -A Perl interface to zlib written by Paul Marquess <pmqs@cpan.org> is in the
  226.48 -CPAN (Comprehensive Perl Archive Network) sites
  226.49 -http://www.cpan.org/modules/by-module/Compress/
  226.50 -
  226.51 -A Python interface to zlib written by A.M. Kuchling <amk@amk.ca> is
  226.52 -available in Python 1.5 and later versions, see
  226.53 -http://www.python.org/doc/lib/module-zlib.html
  226.54 -
  226.55 -A zlib binding for TCL written by Andreas Kupries <a.kupries@westend.com> is
  226.56 -availlable at http://www.oche.de/~akupries/soft/trf/trf_zip.html
  226.57 -
  226.58 -An experimental package to read and write files in .zip format, written on top
  226.59 -of zlib by Gilles Vollant <info@winimage.com>, is available in the
  226.60 -contrib/minizip directory of zlib.
  226.61 -
  226.62 -
  226.63 -Notes for some targets:
  226.64 -
  226.65 -- For Windows DLL versions, please see win32/DLL_FAQ.txt
  226.66 -
  226.67 -- For 64-bit Irix, deflate.c must be compiled without any optimization. With
  226.68 -  -O, one libpng test fails. The test works in 32 bit mode (with the -n32
  226.69 -  compiler flag). The compiler bug has been reported to SGI.
  226.70 -
  226.71 -- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
  226.72 -  when compiled with cc.
  226.73 -
  226.74 -- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is
  226.75 -  necessary to get gzprintf working correctly. This is done by configure.
  226.76 -
  226.77 -- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
  226.78 -  other compilers. Use "make test" to check your compiler.
  226.79 -
  226.80 -- gzdopen is not supported on RISCOS, BEOS and by some Mac compilers.
  226.81 -
  226.82 -- For PalmOs, see http://palmzlib.sourceforge.net/
  226.83 -
  226.84 -- When building a shared, i.e. dynamic library on Mac OS X, the library must be
  226.85 -  installed before testing (do "make install" before "make test"), since the
  226.86 -  library location is specified in the library.
  226.87 -
  226.88 -
  226.89 -Acknowledgments:
  226.90 -
  226.91 -  The deflate format used by zlib was defined by Phil Katz. The deflate
  226.92 -  and zlib specifications were written by L. Peter Deutsch. Thanks to all the
  226.93 -  people who reported problems and suggested various improvements in zlib;
  226.94 -  they are too numerous to cite here.
  226.95 -
  226.96 -Copyright notice:
  226.97 -
  226.98 - (C) 1995-2004 Jean-loup Gailly and Mark Adler
  226.99 -
 226.100 -  This software is provided 'as-is', without any express or implied
 226.101 -  warranty.  In no event will the authors be held liable for any damages
 226.102 -  arising from the use of this software.
 226.103 -
 226.104 -  Permission is granted to anyone to use this software for any purpose,
 226.105 -  including commercial applications, and to alter it and redistribute it
 226.106 -  freely, subject to the following restrictions:
 226.107 -
 226.108 -  1. The origin of this software must not be misrepresented; you must not
 226.109 -     claim that you wrote the original software. If you use this software
 226.110 -     in a product, an acknowledgment in the product documentation would be
 226.111 -     appreciated but is not required.
 226.112 -  2. Altered source versions must be plainly marked as such, and must not be
 226.113 -     misrepresented as being the original software.
 226.114 -  3. This notice may not be removed or altered from any source distribution.
 226.115 -
 226.116 -  Jean-loup Gailly        Mark Adler
 226.117 -  jloup@gzip.org          madler@alumni.caltech.edu
 226.118 -
 226.119 -If you use the zlib library in a product, we would appreciate *not*
 226.120 -receiving lengthy legal documents to sign. The sources are provided
 226.121 -for free but without warranty of any kind.  The library has been
 226.122 -entirely written by Jean-loup Gailly and Mark Adler; it does not
 226.123 -include third-party code.
 226.124 -
 226.125 -If you redistribute modified sources, we would appreciate that you include
 226.126 -in the file ChangeLog history information documenting your changes. Please
 226.127 -read the FAQ for more information on the distribution of modified source
 226.128 -versions.
   227.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/compress.c	Tue Dec 06 16:31:58 2011 -0800
   227.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   227.3 @@ -1,103 +0,0 @@
   227.4 -/*
   227.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   227.6 - *
   227.7 - * This code is free software; you can redistribute it and/or modify it
   227.8 - * under the terms of the GNU General Public License version 2 only, as
   227.9 - * published by the Free Software Foundation.  Oracle designates this
  227.10 - * particular file as subject to the "Classpath" exception as provided
  227.11 - * by Oracle in the LICENSE file that accompanied this code.
  227.12 - *
  227.13 - * This code is distributed in the hope that it will be useful, but WITHOUT
  227.14 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  227.15 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  227.16 - * version 2 for more details (a copy is included in the LICENSE file that
  227.17 - * accompanied this code).
  227.18 - *
  227.19 - * You should have received a copy of the GNU General Public License version
  227.20 - * 2 along with this work; if not, write to the Free Software Foundation,
  227.21 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  227.22 - *
  227.23 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  227.24 - * or visit www.oracle.com if you need additional information or have any
  227.25 - * questions.
  227.26 - */
  227.27 -
  227.28 -/* compress.c -- compress a memory buffer
  227.29 - * Copyright (C) 1995-2003 Jean-loup Gailly.
  227.30 - * For conditions of distribution and use, see copyright notice in zlib.h
  227.31 - */
  227.32 -
  227.33 -/* @(#) $Id$ */
  227.34 -
  227.35 -#define ZLIB_INTERNAL
  227.36 -#include "zlib.h"
  227.37 -
  227.38 -/* ===========================================================================
  227.39 -     Compresses the source buffer into the destination buffer. The level
  227.40 -   parameter has the same meaning as in deflateInit.  sourceLen is the byte
  227.41 -   length of the source buffer. Upon entry, destLen is the total size of the
  227.42 -   destination buffer, which must be at least 0.1% larger than sourceLen plus
  227.43 -   12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
  227.44 -
  227.45 -     compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
  227.46 -   memory, Z_BUF_ERROR if there was not enough room in the output buffer,
  227.47 -   Z_STREAM_ERROR if the level parameter is invalid.
  227.48 -*/
  227.49 -int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
  227.50 -    Bytef *dest;
  227.51 -    uLongf *destLen;
  227.52 -    const Bytef *source;
  227.53 -    uLong sourceLen;
  227.54 -    int level;
  227.55 -{
  227.56 -    z_stream stream;
  227.57 -    int err;
  227.58 -
  227.59 -    stream.next_in = (Bytef*)source;
  227.60 -    stream.avail_in = (uInt)sourceLen;
  227.61 -#ifdef MAXSEG_64K
  227.62 -    /* Check for source > 64K on 16-bit machine: */
  227.63 -    if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
  227.64 -#endif
  227.65 -    stream.next_out = dest;
  227.66 -    stream.avail_out = (uInt)*destLen;
  227.67 -    if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
  227.68 -
  227.69 -    stream.zalloc = (alloc_func)0;
  227.70 -    stream.zfree = (free_func)0;
  227.71 -    stream.opaque = (voidpf)0;
  227.72 -
  227.73 -    err = deflateInit(&stream, level);
  227.74 -    if (err != Z_OK) return err;
  227.75 -
  227.76 -    err = deflate(&stream, Z_FINISH);
  227.77 -    if (err != Z_STREAM_END) {
  227.78 -        deflateEnd(&stream);
  227.79 -        return err == Z_OK ? Z_BUF_ERROR : err;
  227.80 -    }
  227.81 -    *destLen = (uLong)stream.total_out;
  227.82 -
  227.83 -    err = deflateEnd(&stream);
  227.84 -    return err;
  227.85 -}
  227.86 -
  227.87 -/* ===========================================================================
  227.88 - */
  227.89 -int ZEXPORT compress (dest, destLen, source, sourceLen)
  227.90 -    Bytef *dest;
  227.91 -    uLongf *destLen;
  227.92 -    const Bytef *source;
  227.93 -    uLong sourceLen;
  227.94 -{
  227.95 -    return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
  227.96 -}
  227.97 -
  227.98 -/* ===========================================================================
  227.99 -     If the default memLevel or windowBits for deflateInit() is changed, then
 227.100 -   this function needs to be updated.
 227.101 - */
 227.102 -uLong ZEXPORT compressBound (sourceLen)
 227.103 -    uLong sourceLen;
 227.104 -{
 227.105 -    return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 11;
 227.106 -}
   228.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/crc32.h	Tue Dec 06 16:31:58 2011 -0800
   228.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   228.3 @@ -1,465 +0,0 @@
   228.4 -/*
   228.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   228.6 - *
   228.7 - * This code is free software; you can redistribute it and/or modify it
   228.8 - * under the terms of the GNU General Public License version 2 only, as
   228.9 - * published by the Free Software Foundation.  Oracle designates this
  228.10 - * particular file as subject to the "Classpath" exception as provided
  228.11 - * by Oracle in the LICENSE file that accompanied this code.
  228.12 - *
  228.13 - * This code is distributed in the hope that it will be useful, but WITHOUT
  228.14 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  228.15 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  228.16 - * version 2 for more details (a copy is included in the LICENSE file that
  228.17 - * accompanied this code).
  228.18 - *
  228.19 - * You should have received a copy of the GNU General Public License version
  228.20 - * 2 along with this work; if not, write to the Free Software Foundation,
  228.21 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  228.22 - *
  228.23 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  228.24 - * or visit www.oracle.com if you need additional information or have any
  228.25 - * questions.
  228.26 - */
  228.27 -
  228.28 -/* crc32.h -- tables for rapid CRC calculation
  228.29 - * Generated automatically by crc32.c
  228.30 - */
  228.31 -
  228.32 -local const unsigned long FAR crc_table[TBLS][256] =
  228.33 -{
  228.34 -  {
  228.35 -    0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
  228.36 -    0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL,
  228.37 -    0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL,
  228.38 -    0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL,
  228.39 -    0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL,
  228.40 -    0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL,
  228.41 -    0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL,
  228.42 -    0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL,
  228.43 -    0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL,
  228.44 -    0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL,
  228.45 -    0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL,
  228.46 -    0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL,
  228.47 -    0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL,
  228.48 -    0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL,
  228.49 -    0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL,
  228.50 -    0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL,
  228.51 -    0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL,
  228.52 -    0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL,
  228.53 -    0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL,
  228.54 -    0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL,
  228.55 -    0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL,
  228.56 -    0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL,
  228.57 -    0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL,
  228.58 -    0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL,
  228.59 -    0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL,
  228.60 -    0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL,
  228.61 -    0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL,
  228.62 -    0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL,
  228.63 -    0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL,
  228.64 -    0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL,
  228.65 -    0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL,
  228.66 -    0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL,
  228.67 -    0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL,
  228.68 -    0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL,
  228.69 -    0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL,
  228.70 -    0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL,
  228.71 -    0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL,
  228.72 -    0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL,
  228.73 -    0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL,
  228.74 -    0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL,
  228.75 -    0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL,
  228.76 -    0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL,
  228.77 -    0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL,
  228.78 -    0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL,
  228.79 -    0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL,
  228.80 -    0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL,
  228.81 -    0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL,
  228.82 -    0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL,
  228.83 -    0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL,
  228.84 -    0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL,
  228.85 -    0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL,
  228.86 -    0x2d02ef8dUL
  228.87 -#ifdef BYFOUR
  228.88 -  },
  228.89 -  {
  228.90 -    0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL,
  228.91 -    0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL,
  228.92 -    0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL,
  228.93 -    0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL,
  228.94 -    0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL,
  228.95 -    0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL,
  228.96 -    0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL,
  228.97 -    0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL,
  228.98 -    0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL,
  228.99 -    0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL,
 228.100 -    0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL,
 228.101 -    0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL,
 228.102 -    0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL,
 228.103 -    0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL,
 228.104 -    0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL,
 228.105 -    0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL,
 228.106 -    0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL,
 228.107 -    0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL,
 228.108 -    0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL,
 228.109 -    0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL,
 228.110 -    0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL,
 228.111 -    0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL,
 228.112 -    0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL,
 228.113 -    0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL,
 228.114 -    0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL,
 228.115 -    0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL,
 228.116 -    0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL,
 228.117 -    0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL,
 228.118 -    0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL,
 228.119 -    0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL,
 228.120 -    0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL,
 228.121 -    0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL,
 228.122 -    0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL,
 228.123 -    0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL,
 228.124 -    0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL,
 228.125 -    0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL,
 228.126 -    0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL,
 228.127 -    0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL,
 228.128 -    0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL,
 228.129 -    0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL,
 228.130 -    0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL,
 228.131 -    0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL,
 228.132 -    0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL,
 228.133 -    0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL,
 228.134 -    0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL,
 228.135 -    0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL,
 228.136 -    0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL,
 228.137 -    0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL,
 228.138 -    0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL,
 228.139 -    0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL,
 228.140 -    0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL,
 228.141 -    0x9324fd72UL
 228.142 -  },
 228.143 -  {
 228.144 -    0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL,
 228.145 -    0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL,
 228.146 -    0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL,
 228.147 -    0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL,
 228.148 -    0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL,
 228.149 -    0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL,
 228.150 -    0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL,
 228.151 -    0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL,
 228.152 -    0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL,
 228.153 -    0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL,
 228.154 -    0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL,
 228.155 -    0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL,
 228.156 -    0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL,
 228.157 -    0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL,
 228.158 -    0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL,
 228.159 -    0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL,
 228.160 -    0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL,
 228.161 -    0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL,
 228.162 -    0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL,
 228.163 -    0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL,
 228.164 -    0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL,
 228.165 -    0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL,
 228.166 -    0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL,
 228.167 -    0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL,
 228.168 -    0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL,
 228.169 -    0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL,
 228.170 -    0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL,
 228.171 -    0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL,
 228.172 -    0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL,
 228.173 -    0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL,
 228.174 -    0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL,
 228.175 -    0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL,
 228.176 -    0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL,
 228.177 -    0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL,
 228.178 -    0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL,
 228.179 -    0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL,
 228.180 -    0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL,
 228.181 -    0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL,
 228.182 -    0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL,
 228.183 -    0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL,
 228.184 -    0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL,
 228.185 -    0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL,
 228.186 -    0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL,
 228.187 -    0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL,
 228.188 -    0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL,
 228.189 -    0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL,
 228.190 -    0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL,
 228.191 -    0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL,
 228.192 -    0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL,
 228.193 -    0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL,
 228.194 -    0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL,
 228.195 -    0xbe9834edUL
 228.196 -  },
 228.197 -  {
 228.198 -    0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL,
 228.199 -    0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL,
 228.200 -    0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL,
 228.201 -    0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL,
 228.202 -    0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL,
 228.203 -    0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL,
 228.204 -    0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL,
 228.205 -    0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL,
 228.206 -    0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL,
 228.207 -    0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL,
 228.208 -    0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL,
 228.209 -    0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL,
 228.210 -    0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL,
 228.211 -    0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL,
 228.212 -    0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL,
 228.213 -    0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL,
 228.214 -    0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL,
 228.215 -    0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL,
 228.216 -    0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL,
 228.217 -    0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL,
 228.218 -    0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL,
 228.219 -    0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL,
 228.220 -    0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL,
 228.221 -    0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL,
 228.222 -    0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL,
 228.223 -    0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL,
 228.224 -    0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL,
 228.225 -    0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL,
 228.226 -    0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL,
 228.227 -    0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL,
 228.228 -    0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL,
 228.229 -    0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL,
 228.230 -    0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL,
 228.231 -    0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL,
 228.232 -    0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL,
 228.233 -    0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL,
 228.234 -    0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL,
 228.235 -    0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL,
 228.236 -    0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL,
 228.237 -    0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL,
 228.238 -    0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL,
 228.239 -    0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL,
 228.240 -    0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL,
 228.241 -    0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL,
 228.242 -    0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL,
 228.243 -    0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL,
 228.244 -    0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL,
 228.245 -    0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL,
 228.246 -    0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL,
 228.247 -    0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL,
 228.248 -    0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL,
 228.249 -    0xde0506f1UL
 228.250 -  },
 228.251 -  {
 228.252 -    0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL,
 228.253 -    0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL,
 228.254 -    0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL,
 228.255 -    0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL,
 228.256 -    0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL,
 228.257 -    0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL,
 228.258 -    0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL,
 228.259 -    0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL,
 228.260 -    0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL,
 228.261 -    0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL,
 228.262 -    0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL,
 228.263 -    0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL,
 228.264 -    0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL,
 228.265 -    0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL,
 228.266 -    0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL,
 228.267 -    0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL,
 228.268 -    0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL,
 228.269 -    0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL,
 228.270 -    0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL,
 228.271 -    0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL,
 228.272 -    0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL,
 228.273 -    0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL,
 228.274 -    0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL,
 228.275 -    0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL,
 228.276 -    0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL,
 228.277 -    0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL,
 228.278 -    0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL,
 228.279 -    0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL,
 228.280 -    0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL,
 228.281 -    0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL,
 228.282 -    0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL,
 228.283 -    0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL,
 228.284 -    0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL,
 228.285 -    0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL,
 228.286 -    0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL,
 228.287 -    0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL,
 228.288 -    0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL,
 228.289 -    0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL,
 228.290 -    0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL,
 228.291 -    0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL,
 228.292 -    0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL,
 228.293 -    0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL,
 228.294 -    0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL,
 228.295 -    0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL,
 228.296 -    0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL,
 228.297 -    0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL,
 228.298 -    0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL,
 228.299 -    0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL,
 228.300 -    0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL,
 228.301 -    0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL,
 228.302 -    0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL,
 228.303 -    0x8def022dUL
 228.304 -  },
 228.305 -  {
 228.306 -    0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL,
 228.307 -    0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL,
 228.308 -    0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL,
 228.309 -    0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL,
 228.310 -    0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL,
 228.311 -    0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL,
 228.312 -    0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL,
 228.313 -    0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL,
 228.314 -    0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL,
 228.315 -    0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL,
 228.316 -    0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL,
 228.317 -    0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL,
 228.318 -    0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL,
 228.319 -    0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL,
 228.320 -    0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL,
 228.321 -    0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL,
 228.322 -    0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL,
 228.323 -    0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL,
 228.324 -    0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL,
 228.325 -    0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL,
 228.326 -    0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL,
 228.327 -    0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL,
 228.328 -    0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL,
 228.329 -    0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL,
 228.330 -    0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL,
 228.331 -    0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL,
 228.332 -    0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL,
 228.333 -    0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL,
 228.334 -    0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL,
 228.335 -    0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL,
 228.336 -    0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL,
 228.337 -    0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL,
 228.338 -    0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL,
 228.339 -    0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL,
 228.340 -    0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL,
 228.341 -    0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL,
 228.342 -    0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL,
 228.343 -    0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL,
 228.344 -    0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL,
 228.345 -    0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL,
 228.346 -    0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL,
 228.347 -    0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL,
 228.348 -    0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL,
 228.349 -    0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL,
 228.350 -    0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL,
 228.351 -    0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL,
 228.352 -    0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL,
 228.353 -    0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL,
 228.354 -    0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL,
 228.355 -    0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL,
 228.356 -    0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL,
 228.357 -    0x72fd2493UL
 228.358 -  },
 228.359 -  {
 228.360 -    0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL,
 228.361 -    0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL,
 228.362 -    0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL,
 228.363 -    0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL,
 228.364 -    0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL,
 228.365 -    0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL,
 228.366 -    0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL,
 228.367 -    0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL,
 228.368 -    0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL,
 228.369 -    0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL,
 228.370 -    0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL,
 228.371 -    0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL,
 228.372 -    0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL,
 228.373 -    0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL,
 228.374 -    0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL,
 228.375 -    0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL,
 228.376 -    0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL,
 228.377 -    0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL,
 228.378 -    0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL,
 228.379 -    0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL,
 228.380 -    0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL,
 228.381 -    0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL,
 228.382 -    0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL,
 228.383 -    0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL,
 228.384 -    0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL,
 228.385 -    0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL,
 228.386 -    0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL,
 228.387 -    0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL,
 228.388 -    0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL,
 228.389 -    0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL,
 228.390 -    0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL,
 228.391 -    0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL,
 228.392 -    0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL,
 228.393 -    0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL,
 228.394 -    0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL,
 228.395 -    0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL,
 228.396 -    0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL,
 228.397 -    0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL,
 228.398 -    0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL,
 228.399 -    0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL,
 228.400 -    0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL,
 228.401 -    0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL,
 228.402 -    0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL,
 228.403 -    0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL,
 228.404 -    0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL,
 228.405 -    0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL,
 228.406 -    0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL,
 228.407 -    0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL,
 228.408 -    0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL,
 228.409 -    0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL,
 228.410 -    0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL,
 228.411 -    0xed3498beUL
 228.412 -  },
 228.413 -  {
 228.414 -    0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL,
 228.415 -    0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL,
 228.416 -    0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL,
 228.417 -    0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL,
 228.418 -    0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL,
 228.419 -    0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL,
 228.420 -    0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL,
 228.421 -    0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL,
 228.422 -    0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL,
 228.423 -    0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL,
 228.424 -    0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL,
 228.425 -    0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL,
 228.426 -    0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL,
 228.427 -    0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL,
 228.428 -    0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL,
 228.429 -    0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL,
 228.430 -    0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL,
 228.431 -    0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL,
 228.432 -    0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL,
 228.433 -    0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL,
 228.434 -    0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL,
 228.435 -    0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL,
 228.436 -    0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL,
 228.437 -    0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL,
 228.438 -    0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL,
 228.439 -    0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL,
 228.440 -    0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL,
 228.441 -    0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL,
 228.442 -    0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL,
 228.443 -    0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL,
 228.444 -    0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL,
 228.445 -    0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL,
 228.446 -    0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL,
 228.447 -    0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL,
 228.448 -    0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL,
 228.449 -    0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL,
 228.450 -    0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL,
 228.451 -    0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL,
 228.452 -    0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL,
 228.453 -    0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL,
 228.454 -    0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL,
 228.455 -    0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL,
 228.456 -    0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL,
 228.457 -    0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL,
 228.458 -    0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL,
 228.459 -    0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL,
 228.460 -    0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL,
 228.461 -    0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL,
 228.462 -    0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL,
 228.463 -    0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL,
 228.464 -    0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL,
 228.465 -    0xf10605deUL
 228.466 -#endif
 228.467 -  }
 228.468 -};
   229.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/deflate.c	Tue Dec 06 16:31:58 2011 -0800
   229.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   229.3 @@ -1,1760 +0,0 @@
   229.4 -/*
   229.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   229.6 - *
   229.7 - * This code is free software; you can redistribute it and/or modify it
   229.8 - * under the terms of the GNU General Public License version 2 only, as
   229.9 - * published by the Free Software Foundation.  Oracle designates this
  229.10 - * particular file as subject to the "Classpath" exception as provided
  229.11 - * by Oracle in the LICENSE file that accompanied this code.
  229.12 - *
  229.13 - * This code is distributed in the hope that it will be useful, but WITHOUT
  229.14 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  229.15 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  229.16 - * version 2 for more details (a copy is included in the LICENSE file that
  229.17 - * accompanied this code).
  229.18 - *
  229.19 - * You should have received a copy of the GNU General Public License version
  229.20 - * 2 along with this work; if not, write to the Free Software Foundation,
  229.21 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  229.22 - *
  229.23 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  229.24 - * or visit www.oracle.com if you need additional information or have any
  229.25 - * questions.
  229.26 - */
  229.27 -
  229.28 -/* deflate.c -- compress data using the deflation algorithm
  229.29 - * Copyright (C) 1995-2005 Jean-loup Gailly.
  229.30 - * For conditions of distribution and use, see copyright notice in zlib.h
  229.31 - */
  229.32 -
  229.33 -/*
  229.34 - *  ALGORITHM
  229.35 - *
  229.36 - *      The "deflation" process depends on being able to identify portions
  229.37 - *      of the input text which are identical to earlier input (within a
  229.38 - *      sliding window trailing behind the input currently being processed).
  229.39 - *
  229.40 - *      The most straightforward technique turns out to be the fastest for
  229.41 - *      most input files: try all possible matches and select the longest.
  229.42 - *      The key feature of this algorithm is that insertions into the string
  229.43 - *      dictionary are very simple and thus fast, and deletions are avoided
  229.44 - *      completely. Insertions are performed at each input character, whereas
  229.45 - *      string matches are performed only when the previous match ends. So it
  229.46 - *      is preferable to spend more time in matches to allow very fast string
  229.47 - *      insertions and avoid deletions. The matching algorithm for small
  229.48 - *      strings is inspired from that of Rabin & Karp. A brute force approach
  229.49 - *      is used to find longer strings when a small match has been found.
  229.50 - *      A similar algorithm is used in comic (by Jan-Mark Wams) and freeze
  229.51 - *      (by Leonid Broukhis).
  229.52 - *         A previous version of this file used a more sophisticated algorithm
  229.53 - *      (by Fiala and Greene) which is guaranteed to run in linear amortized
  229.54 - *      time, but has a larger average cost, uses more memory and is patented.
  229.55 - *      However the F&G algorithm may be faster for some highly redundant
  229.56 - *      files if the parameter max_chain_length (described below) is too large.
  229.57 - *
  229.58 - *  ACKNOWLEDGEMENTS
  229.59 - *
  229.60 - *      The idea of lazy evaluation of matches is due to Jan-Mark Wams, and
  229.61 - *      I found it in 'freeze' written by Leonid Broukhis.
  229.62 - *      Thanks to many people for bug reports and testing.
  229.63 - *
  229.64 - *  REFERENCES
  229.65 - *
  229.66 - *      Deutsch, L.P.,"DEFLATE Compressed Data Format Specification".
  229.67 - *      Available in http://www.ietf.org/rfc/rfc1951.txt
  229.68 - *
  229.69 - *      A description of the Rabin and Karp algorithm is given in the book
  229.70 - *         "Algorithms" by R. Sedgewick, Addison-Wesley, p252.
  229.71 - *
  229.72 - *      Fiala,E.R., and Greene,D.H.
  229.73 - *         Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595
  229.74 - *
  229.75 - */
  229.76 -
  229.77 -/* @(#) $Id$ */
  229.78 -
  229.79 -#include "deflate.h"
  229.80 -
  229.81 -const char deflate_copyright[] =
  229.82 -   " deflate 1.2.3 Copyright 1995-2005 Jean-loup Gailly ";
  229.83 -/*
  229.84 -  If you use the zlib library in a product, an acknowledgment is welcome
  229.85 -  in the documentation of your product. If for some reason you cannot
  229.86 -  include such an acknowledgment, I would appreciate that you keep this
  229.87 -  copyright string in the executable of your product.
  229.88 - */
  229.89 -
  229.90 -/* ===========================================================================
  229.91 - *  Function prototypes.
  229.92 - */
  229.93 -typedef enum {
  229.94 -    need_more,      /* block not completed, need more input or more output */
  229.95 -    block_done,     /* block flush performed */
  229.96 -    finish_started, /* finish started, need only more output at next deflate */
  229.97 -    finish_done     /* finish done, accept no more input or output */
  229.98 -} block_state;
  229.99 -
 229.100 -typedef block_state (*compress_func) OF((deflate_state *s, int flush));
 229.101 -/* Compression function. Returns the block state after the call. */
 229.102 -
 229.103 -local void fill_window    OF((deflate_state *s));
 229.104 -local block_state deflate_stored OF((deflate_state *s, int flush));
 229.105 -local block_state deflate_fast   OF((deflate_state *s, int flush));
 229.106 -#ifndef FASTEST
 229.107 -local block_state deflate_slow   OF((deflate_state *s, int flush));
 229.108 -#endif
 229.109 -local void lm_init        OF((deflate_state *s));
 229.110 -local void putShortMSB    OF((deflate_state *s, uInt b));
 229.111 -local void flush_pending  OF((z_streamp strm));
 229.112 -local int read_buf        OF((z_streamp strm, Bytef *buf, unsigned size));
 229.113 -#ifndef FASTEST
 229.114 -#ifdef ASMV
 229.115 -      void match_init OF((void)); /* asm code initialization */
 229.116 -      uInt longest_match  OF((deflate_state *s, IPos cur_match));
 229.117 -#else
 229.118 -local uInt longest_match  OF((deflate_state *s, IPos cur_match));
 229.119 -#endif
 229.120 -#endif
 229.121 -local uInt longest_match_fast OF((deflate_state *s, IPos cur_match));
 229.122 -
 229.123 -#ifdef DEBUG
 229.124 -local  void check_match OF((deflate_state *s, IPos start, IPos match,
 229.125 -                            int length));
 229.126 -#endif
 229.127 -
 229.128 -/* ===========================================================================
 229.129 - * Local data
 229.130 - */
 229.131 -
 229.132 -#define NIL 0
 229.133 -/* Tail of hash chains */
 229.134 -
 229.135 -#ifndef TOO_FAR
 229.136 -#  define TOO_FAR 4096
 229.137 -#endif
 229.138 -/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
 229.139 -
 229.140 -#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
 229.141 -/* Minimum amount of lookahead, except at the end of the input file.
 229.142 - * See deflate.c for comments about the MIN_MATCH+1.
 229.143 - */
 229.144 -
 229.145 -/* Values for max_lazy_match, good_match and max_chain_length, depending on
 229.146 - * the desired pack level (0..9). The values given below have been tuned to
 229.147 - * exclude worst case performance for pathological files. Better values may be
 229.148 - * found for specific files.
 229.149 - */
 229.150 -typedef struct config_s {
 229.151 -   ush good_length; /* reduce lazy search above this match length */
 229.152 -   ush max_lazy;    /* do not perform lazy search above this match length */
 229.153 -   ush nice_length; /* quit search above this match length */
 229.154 -   ush max_chain;
 229.155 -   compress_func func;
 229.156 -} config;
 229.157 -
 229.158 -#ifdef FASTEST
 229.159 -local const config configuration_table[2] = {
 229.160 -/*      good lazy nice chain */
 229.161 -/* 0 */ {0,    0,  0,    0, deflate_stored},  /* store only */
 229.162 -/* 1 */ {4,    4,  8,    4, deflate_fast}}; /* max speed, no lazy matches */
 229.163 -#else
 229.164 -local const config configuration_table[10] = {
 229.165 -/*      good lazy nice chain */
 229.166 -/* 0 */ {0,    0,  0,    0, deflate_stored},  /* store only */
 229.167 -/* 1 */ {4,    4,  8,    4, deflate_fast}, /* max speed, no lazy matches */
 229.168 -/* 2 */ {4,    5, 16,    8, deflate_fast},
 229.169 -/* 3 */ {4,    6, 32,   32, deflate_fast},
 229.170 -
 229.171 -/* 4 */ {4,    4, 16,   16, deflate_slow},  /* lazy matches */
 229.172 -/* 5 */ {8,   16, 32,   32, deflate_slow},
 229.173 -/* 6 */ {8,   16, 128, 128, deflate_slow},
 229.174 -/* 7 */ {8,   32, 128, 256, deflate_slow},
 229.175 -/* 8 */ {32, 128, 258, 1024, deflate_slow},
 229.176 -/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */
 229.177 -#endif
 229.178 -
 229.179 -/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4
 229.180 - * For deflate_fast() (levels <= 3) good is ignored and lazy has a different
 229.181 - * meaning.
 229.182 - */
 229.183 -
 229.184 -#define EQUAL 0
 229.185 -/* result of memcmp for equal strings */
 229.186 -
 229.187 -#ifndef NO_DUMMY_DECL
 229.188 -struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
 229.189 -#endif
 229.190 -
 229.191 -/* ===========================================================================
 229.192 - * Update a hash value with the given input byte
 229.193 - * IN  assertion: all calls to to UPDATE_HASH are made with consecutive
 229.194 - *    input characters, so that a running hash key can be computed from the
 229.195 - *    previous key instead of complete recalculation each time.
 229.196 - */
 229.197 -#define UPDATE_HASH(s,h,c) (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask)
 229.198 -
 229.199 -
 229.200 -/* ===========================================================================
 229.201 - * Insert string str in the dictionary and set match_head to the previous head
 229.202 - * of the hash chain (the most recent string with same hash key). Return
 229.203 - * the previous length of the hash chain.
 229.204 - * If this file is compiled with -DFASTEST, the compression level is forced
 229.205 - * to 1, and no hash chains are maintained.
 229.206 - * IN  assertion: all calls to to INSERT_STRING are made with consecutive
 229.207 - *    input characters and the first MIN_MATCH bytes of str are valid
 229.208 - *    (except for the last MIN_MATCH-1 bytes of the input file).
 229.209 - */
 229.210 -#ifdef FASTEST
 229.211 -#define INSERT_STRING(s, str, match_head) \
 229.212 -   (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
 229.213 -    match_head = s->head[s->ins_h], \
 229.214 -    s->head[s->ins_h] = (Pos)(str))
 229.215 -#else
 229.216 -#define INSERT_STRING(s, str, match_head) \
 229.217 -   (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
 229.218 -    match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \
 229.219 -    s->head[s->ins_h] = (Pos)(str))
 229.220 -#endif
 229.221 -
 229.222 -/* ===========================================================================
 229.223 - * Initialize the hash table (avoiding 64K overflow for 16 bit systems).
 229.224 - * prev[] will be initialized on the fly.
 229.225 - */
 229.226 -#define CLEAR_HASH(s) \
 229.227 -    s->head[s->hash_size-1] = NIL; \
 229.228 -    zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
 229.229 -
 229.230 -/* ========================================================================= */
 229.231 -int ZEXPORT deflateInit_(strm, level, version, stream_size)
 229.232 -    z_streamp strm;
 229.233 -    int level;
 229.234 -    const char *version;
 229.235 -    int stream_size;
 229.236 -{
 229.237 -    return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
 229.238 -                         Z_DEFAULT_STRATEGY, version, stream_size);
 229.239 -    /* To do: ignore strm->next_in if we use it as window */
 229.240 -}
 229.241 -
 229.242 -/* ========================================================================= */
 229.243 -int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
 229.244 -                  version, stream_size)
 229.245 -    z_streamp strm;
 229.246 -    int  level;
 229.247 -    int  method;
 229.248 -    int  windowBits;
 229.249 -    int  memLevel;
 229.250 -    int  strategy;
 229.251 -    const char *version;
 229.252 -    int stream_size;
 229.253 -{
 229.254 -    deflate_state *s;
 229.255 -    int wrap = 1;
 229.256 -    static const char my_version[] = ZLIB_VERSION;
 229.257 -
 229.258 -    ushf *overlay;
 229.259 -    /* We overlay pending_buf and d_buf+l_buf. This works since the average
 229.260 -     * output size for (length,distance) codes is <= 24 bits.
 229.261 -     */
 229.262 -
 229.263 -    if (version == Z_NULL || version[0] != my_version[0] ||
 229.264 -        stream_size != sizeof(z_stream)) {
 229.265 -        return Z_VERSION_ERROR;
 229.266 -    }
 229.267 -    if (strm == Z_NULL) return Z_STREAM_ERROR;
 229.268 -
 229.269 -    strm->msg = Z_NULL;
 229.270 -    if (strm->zalloc == (alloc_func)0) {
 229.271 -        strm->zalloc = zcalloc;
 229.272 -        strm->opaque = (voidpf)0;
 229.273 -    }
 229.274 -    if (strm->zfree == (free_func)0) strm->zfree = zcfree;
 229.275 -
 229.276 -#ifdef FASTEST
 229.277 -    if (level != 0) level = 1;
 229.278 -#else
 229.279 -    if (level == Z_DEFAULT_COMPRESSION) level = 6;
 229.280 -#endif
 229.281 -
 229.282 -    if (windowBits < 0) { /* suppress zlib wrapper */
 229.283 -        wrap = 0;
 229.284 -        windowBits = -windowBits;
 229.285 -    }
 229.286 -#ifdef GZIP
 229.287 -    else if (windowBits > 15) {
 229.288 -        wrap = 2;       /* write gzip wrapper instead */
 229.289 -        windowBits -= 16;
 229.290 -    }
 229.291 -#endif
 229.292 -    if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
 229.293 -        windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
 229.294 -        strategy < 0 || strategy > Z_FIXED) {
 229.295 -        return Z_STREAM_ERROR;
 229.296 -    }
 229.297 -    if (windowBits == 8) windowBits = 9;  /* until 256-byte window bug fixed */
 229.298 -    s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));
 229.299 -    if (s == Z_NULL) return Z_MEM_ERROR;
 229.300 -    strm->state = (struct internal_state FAR *)s;
 229.301 -    s->strm = strm;
 229.302 -
 229.303 -    s->wrap = wrap;
 229.304 -    s->gzhead = Z_NULL;
 229.305 -    s->w_bits = windowBits;
 229.306 -    s->w_size = 1 << s->w_bits;
 229.307 -    s->w_mask = s->w_size - 1;
 229.308 -
 229.309 -    s->hash_bits = memLevel + 7;
 229.310 -    s->hash_size = 1 << s->hash_bits;
 229.311 -    s->hash_mask = s->hash_size - 1;
 229.312 -    s->hash_shift =  ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH);
 229.313 -
 229.314 -    s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
 229.315 -    s->prev   = (Posf *)  ZALLOC(strm, s->w_size, sizeof(Pos));
 229.316 -    s->head   = (Posf *)  ZALLOC(strm, s->hash_size, sizeof(Pos));
 229.317 -
 229.318 -    s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
 229.319 -
 229.320 -    overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
 229.321 -    s->pending_buf = (uchf *) overlay;
 229.322 -    s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);
 229.323 -
 229.324 -    if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
 229.325 -        s->pending_buf == Z_NULL) {
 229.326 -        s->status = FINISH_STATE;
 229.327 -        strm->msg = (char*)ERR_MSG(Z_MEM_ERROR);
 229.328 -        deflateEnd (strm);
 229.329 -        return Z_MEM_ERROR;
 229.330 -    }
 229.331 -    s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
 229.332 -    s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
 229.333 -
 229.334 -    s->level = level;
 229.335 -    s->strategy = strategy;
 229.336 -    s->method = (Byte)method;
 229.337 -
 229.338 -    return deflateReset(strm);
 229.339 -}
 229.340 -
 229.341 -/* ========================================================================= */
 229.342 -int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
 229.343 -    z_streamp strm;
 229.344 -    const Bytef *dictionary;
 229.345 -    uInt  dictLength;
 229.346 -{
 229.347 -    deflate_state *s;
 229.348 -    uInt length = dictLength;
 229.349 -    uInt n;
 229.350 -    IPos hash_head = 0;
 229.351 -
 229.352 -    if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL ||
 229.353 -        strm->state->wrap == 2 ||
 229.354 -        (strm->state->wrap == 1 && strm->state->status != INIT_STATE))
 229.355 -        return Z_STREAM_ERROR;
 229.356 -
 229.357 -    s = strm->state;
 229.358 -    if (s->wrap)
 229.359 -        strm->adler = adler32(strm->adler, dictionary, dictLength);
 229.360 -
 229.361 -    if (length < MIN_MATCH) return Z_OK;
 229.362 -    if (length > MAX_DIST(s)) {
 229.363 -        length = MAX_DIST(s);
 229.364 -        dictionary += dictLength - length; /* use the tail of the dictionary */
 229.365 -    }
 229.366 -    zmemcpy(s->window, dictionary, length);
 229.367 -    s->strstart = length;
 229.368 -    s->block_start = (long)length;
 229.369 -
 229.370 -    /* Insert all strings in the hash table (except for the last two bytes).
 229.371 -     * s->lookahead stays null, so s->ins_h will be recomputed at the next
 229.372 -     * call of fill_window.
 229.373 -     */
 229.374 -    s->ins_h = s->window[0];
 229.375 -    UPDATE_HASH(s, s->ins_h, s->window[1]);
 229.376 -    for (n = 0; n <= length - MIN_MATCH; n++) {
 229.377 -        INSERT_STRING(s, n, hash_head);
 229.378 -    }
 229.379 -    if (hash_head) hash_head = 0;  /* to make compiler happy */
 229.380 -    return Z_OK;
 229.381 -}
 229.382 -
 229.383 -/* ========================================================================= */
 229.384 -int ZEXPORT deflateReset (strm)
 229.385 -    z_streamp strm;
 229.386 -{
 229.387 -    deflate_state *s;
 229.388 -
 229.389 -    if (strm == Z_NULL || strm->state == Z_NULL ||
 229.390 -        strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) {
 229.391 -        return Z_STREAM_ERROR;
 229.392 -    }
 229.393 -
 229.394 -    strm->total_in = strm->total_out = 0;
 229.395 -    strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */
 229.396 -    strm->data_type = Z_UNKNOWN;
 229.397 -
 229.398 -    s = (deflate_state *)strm->state;
 229.399 -    s->pending = 0;
 229.400 -    s->pending_out = s->pending_buf;
 229.401 -
 229.402 -    if (s->wrap < 0) {
 229.403 -        s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */
 229.404 -    }
 229.405 -    s->status = s->wrap ? INIT_STATE : BUSY_STATE;
 229.406 -    strm->adler =
 229.407 -#ifdef GZIP
 229.408 -        s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
 229.409 -#endif
 229.410 -        adler32(0L, Z_NULL, 0);
 229.411 -    s->last_flush = Z_NO_FLUSH;
 229.412 -
 229.413 -    _tr_init(s);
 229.414 -    lm_init(s);
 229.415 -
 229.416 -    return Z_OK;
 229.417 -}
 229.418 -
 229.419 -/* ========================================================================= */
 229.420 -int ZEXPORT deflateSetHeader (strm, head)
 229.421 -    z_streamp strm;
 229.422 -    gz_headerp head;
 229.423 -{
 229.424 -    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
 229.425 -    if (strm->state->wrap != 2) return Z_STREAM_ERROR;
 229.426 -    strm->state->gzhead = head;
 229.427 -    return Z_OK;
 229.428 -}
 229.429 -
 229.430 -/* ========================================================================= */
 229.431 -int ZEXPORT deflatePrime (strm, bits, value)
 229.432 -    z_streamp strm;
 229.433 -    int bits;
 229.434 -    int value;
 229.435 -{
 229.436 -    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
 229.437 -    strm->state->bi_valid = bits;
 229.438 -    strm->state->bi_buf = (ush)(value & ((1 << bits) - 1));
 229.439 -    return Z_OK;
 229.440 -}
 229.441 -
 229.442 -/* ========================================================================= */
 229.443 -int ZEXPORT deflateParams(strm, level, strategy)
 229.444 -    z_streamp strm;
 229.445 -    int level;
 229.446 -    int strategy;
 229.447 -{
 229.448 -    deflate_state *s;
 229.449 -    compress_func func;
 229.450 -    int err = Z_OK;
 229.451 -
 229.452 -    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
 229.453 -    s = strm->state;
 229.454 -
 229.455 -#ifdef FASTEST
 229.456 -    if (level != 0) level = 1;
 229.457 -#else
 229.458 -    if (level == Z_DEFAULT_COMPRESSION) level = 6;
 229.459 -#endif
 229.460 -    if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) {
 229.461 -        return Z_STREAM_ERROR;
 229.462 -    }
 229.463 -    func = configuration_table[s->level].func;
 229.464 -
 229.465 -    if (func != configuration_table[level].func && strm->total_in != 0) {
 229.466 -        /* Flush the last buffer: */
 229.467 -        err = deflate(strm, Z_PARTIAL_FLUSH);
 229.468 -    }
 229.469 -    if (s->level != level) {
 229.470 -        s->level = level;
 229.471 -        s->max_lazy_match   = configuration_table[level].max_lazy;
 229.472 -        s->good_match       = configuration_table[level].good_length;
 229.473 -        s->nice_match       = configuration_table[level].nice_length;
 229.474 -        s->max_chain_length = configuration_table[level].max_chain;
 229.475 -    }
 229.476 -    s->strategy = strategy;
 229.477 -    return err;
 229.478 -}
 229.479 -
 229.480 -/* ========================================================================= */
 229.481 -int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)
 229.482 -    z_streamp strm;
 229.483 -    int good_length;
 229.484 -    int max_lazy;
 229.485 -    int nice_length;
 229.486 -    int max_chain;
 229.487 -{
 229.488 -    deflate_state *s;
 229.489 -
 229.490 -    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
 229.491 -    s = strm->state;
 229.492 -    s->good_match = good_length;
 229.493 -    s->max_lazy_match = max_lazy;
 229.494 -    s->nice_match = nice_length;
 229.495 -    s->max_chain_length = max_chain;
 229.496 -    return Z_OK;
 229.497 -}
 229.498 -
 229.499 -/* =========================================================================
 229.500 - * For the default windowBits of 15 and memLevel of 8, this function returns
 229.501 - * a close to exact, as well as small, upper bound on the compressed size.
 229.502 - * They are coded as constants here for a reason--if the #define's are
 229.503 - * changed, then this function needs to be changed as well.  The return
 229.504 - * value for 15 and 8 only works for those exact settings.
 229.505 - *
 229.506 - * For any setting other than those defaults for windowBits and memLevel,
 229.507 - * the value returned is a conservative worst case for the maximum expansion
 229.508 - * resulting from using fixed blocks instead of stored blocks, which deflate
 229.509 - * can emit on compressed data for some combinations of the parameters.
 229.510 - *
 229.511 - * This function could be more sophisticated to provide closer upper bounds
 229.512 - * for every combination of windowBits and memLevel, as well as wrap.
 229.513 - * But even the conservative upper bound of about 14% expansion does not
 229.514 - * seem onerous for output buffer allocation.
 229.515 - */
 229.516 -uLong ZEXPORT deflateBound(strm, sourceLen)
 229.517 -    z_streamp strm;
 229.518 -    uLong sourceLen;
 229.519 -{
 229.520 -    deflate_state *s;
 229.521 -    uLong destLen;
 229.522 -
 229.523 -    /* conservative upper bound */
 229.524 -    destLen = sourceLen +
 229.525 -              ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 11;
 229.526 -
 229.527 -    /* if can't get parameters, return conservative bound */
 229.528 -    if (strm == Z_NULL || strm->state == Z_NULL)
 229.529 -        return destLen;
 229.530 -
 229.531 -    /* if not default parameters, return conservative bound */
 229.532 -    s = strm->state;
 229.533 -    if (s->w_bits != 15 || s->hash_bits != 8 + 7)
 229.534 -        return destLen;
 229.535 -
 229.536 -    /* default settings: return tight bound for that case */
 229.537 -    return compressBound(sourceLen);
 229.538 -}
 229.539 -
 229.540 -/* =========================================================================
 229.541 - * Put a short in the pending buffer. The 16-bit value is put in MSB order.
 229.542 - * IN assertion: the stream state is correct and there is enough room in
 229.543 - * pending_buf.
 229.544 - */
 229.545 -local void putShortMSB (s, b)
 229.546 -    deflate_state *s;
 229.547 -    uInt b;
 229.548 -{
 229.549 -    put_byte(s, (Byte)(b >> 8));
 229.550 -    put_byte(s, (Byte)(b & 0xff));
 229.551 -}
 229.552 -
 229.553 -/* =========================================================================
 229.554 - * Flush as much pending output as possible. All deflate() output goes
 229.555 - * through this function so some applications may wish to modify it
 229.556 - * to avoid allocating a large strm->next_out buffer and copying into it.
 229.557 - * (See also read_buf()).
 229.558 - */
 229.559 -local void flush_pending(strm)
 229.560 -    z_streamp strm;
 229.561 -{
 229.562 -    unsigned len = strm->state->pending;
 229.563 -
 229.564 -    if (len > strm->avail_out) len = strm->avail_out;
 229.565 -    if (len == 0) return;
 229.566 -
 229.567 -    zmemcpy(strm->next_out, strm->state->pending_out, len);
 229.568 -    strm->next_out  += len;
 229.569 -    strm->state->pending_out  += len;
 229.570 -    strm->total_out += len;
 229.571 -    strm->avail_out  -= len;
 229.572 -    strm->state->pending -= len;
 229.573 -    if (strm->state->pending == 0) {
 229.574 -        strm->state->pending_out = strm->state->pending_buf;
 229.575 -    }
 229.576 -}
 229.577 -
 229.578 -/* ========================================================================= */
 229.579 -int ZEXPORT deflate (strm, flush)
 229.580 -    z_streamp strm;
 229.581 -    int flush;
 229.582 -{
 229.583 -    int old_flush; /* value of flush param for previous deflate call */
 229.584 -    deflate_state *s;
 229.585 -
 229.586 -    if (strm == Z_NULL || strm->state == Z_NULL ||
 229.587 -        flush > Z_FINISH || flush < 0) {
 229.588 -        return Z_STREAM_ERROR;
 229.589 -    }
 229.590 -    s = strm->state;
 229.591 -
 229.592 -    if (strm->next_out == Z_NULL ||
 229.593 -        (strm->next_in == Z_NULL && strm->avail_in != 0) ||
 229.594 -        (s->status == FINISH_STATE && flush != Z_FINISH)) {
 229.595 -        ERR_RETURN(strm, Z_STREAM_ERROR);
 229.596 -    }
 229.597 -    if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR);
 229.598 -
 229.599 -    s->strm = strm; /* just in case */
 229.600 -    old_flush = s->last_flush;
 229.601 -    s->last_flush = flush;
 229.602 -
 229.603 -    /* Write the header */
 229.604 -    if (s->status == INIT_STATE) {
 229.605 -#ifdef GZIP
 229.606 -        if (s->wrap == 2) {
 229.607 -            strm->adler = crc32(0L, Z_NULL, 0);
 229.608 -            put_byte(s, 31);
 229.609 -            put_byte(s, 139);
 229.610 -            put_byte(s, 8);
 229.611 -            if (s->gzhead == NULL) {
 229.612 -                put_byte(s, 0);
 229.613 -                put_byte(s, 0);
 229.614 -                put_byte(s, 0);
 229.615 -                put_byte(s, 0);
 229.616 -                put_byte(s, 0);
 229.617 -                put_byte(s, s->level == 9 ? 2 :
 229.618 -                            (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
 229.619 -                             4 : 0));
 229.620 -                put_byte(s, OS_CODE);
 229.621 -                s->status = BUSY_STATE;
 229.622 -            }
 229.623 -            else {
 229.624 -                put_byte(s, (s->gzhead->text ? 1 : 0) +
 229.625 -                            (s->gzhead->hcrc ? 2 : 0) +
 229.626 -                            (s->gzhead->extra == Z_NULL ? 0 : 4) +
 229.627 -                            (s->gzhead->name == Z_NULL ? 0 : 8) +
 229.628 -                            (s->gzhead->comment == Z_NULL ? 0 : 16)
 229.629 -                        );
 229.630 -                put_byte(s, (Byte)(s->gzhead->time & 0xff));
 229.631 -                put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff));
 229.632 -                put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff));
 229.633 -                put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff));
 229.634 -                put_byte(s, s->level == 9 ? 2 :
 229.635 -                            (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
 229.636 -                             4 : 0));
 229.637 -                put_byte(s, s->gzhead->os & 0xff);
 229.638 -                if (s->gzhead->extra != NULL) {
 229.639 -                    put_byte(s, s->gzhead->extra_len & 0xff);
 229.640 -                    put_byte(s, (s->gzhead->extra_len >> 8) & 0xff);
 229.641 -                }
 229.642 -                if (s->gzhead->hcrc)
 229.643 -                    strm->adler = crc32(strm->adler, s->pending_buf,
 229.644 -                                        s->pending);
 229.645 -                s->gzindex = 0;
 229.646 -                s->status = EXTRA_STATE;
 229.647 -            }
 229.648 -        }
 229.649 -        else
 229.650 -#endif
 229.651 -        {
 229.652 -            uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;
 229.653 -            uInt level_flags;
 229.654 -
 229.655 -            if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2)
 229.656 -                level_flags = 0;
 229.657 -            else if (s->level < 6)
 229.658 -                level_flags = 1;
 229.659 -            else if (s->level == 6)
 229.660 -                level_flags = 2;
 229.661 -            else
 229.662 -                level_flags = 3;
 229.663 -            header |= (level_flags << 6);
 229.664 -            if (s->strstart != 0) header |= PRESET_DICT;
 229.665 -            header += 31 - (header % 31);
 229.666 -
 229.667 -            s->status = BUSY_STATE;
 229.668 -            putShortMSB(s, header);
 229.669 -
 229.670 -            /* Save the adler32 of the preset dictionary: */
 229.671 -            if (s->strstart != 0) {
 229.672 -                putShortMSB(s, (uInt)(strm->adler >> 16));
 229.673 -                putShortMSB(s, (uInt)(strm->adler & 0xffff));
 229.674 -            }
 229.675 -            strm->adler = adler32(0L, Z_NULL, 0);
 229.676 -        }
 229.677 -    }
 229.678 -#ifdef GZIP
 229.679 -    if (s->status == EXTRA_STATE) {
 229.680 -        if (s->gzhead->extra != NULL) {
 229.681 -            uInt beg = s->pending;  /* start of bytes to update crc */
 229.682 -
 229.683 -            while (s->gzindex < (s->gzhead->extra_len & 0xffff)) {
 229.684 -                if (s->pending == s->pending_buf_size) {
 229.685 -                    if (s->gzhead->hcrc && s->pending > beg)
 229.686 -                        strm->adler = crc32(strm->adler, s->pending_buf + beg,
 229.687 -                                            s->pending - beg);
 229.688 -                    flush_pending(strm);
 229.689 -                    beg = s->pending;
 229.690 -                    if (s->pending == s->pending_buf_size)
 229.691 -                        break;
 229.692 -                }
 229.693 -                put_byte(s, s->gzhead->extra[s->gzindex]);
 229.694 -                s->gzindex++;
 229.695 -            }
 229.696 -            if (s->gzhead->hcrc && s->pending > beg)
 229.697 -                strm->adler = crc32(strm->adler, s->pending_buf + beg,
 229.698 -                                    s->pending - beg);
 229.699 -            if (s->gzindex == s->gzhead->extra_len) {
 229.700 -                s->gzindex = 0;
 229.701 -                s->status = NAME_STATE;
 229.702 -            }
 229.703 -        }
 229.704 -        else
 229.705 -            s->status = NAME_STATE;
 229.706 -    }
 229.707 -    if (s->status == NAME_STATE) {
 229.708 -        if (s->gzhead->name != NULL) {
 229.709 -            uInt beg = s->pending;  /* start of bytes to update crc */
 229.710 -            int val;
 229.711 -
 229.712 -            do {
 229.713 -                if (s->pending == s->pending_buf_size) {
 229.714 -                    if (s->gzhead->hcrc && s->pending > beg)
 229.715 -                        strm->adler = crc32(strm->adler, s->pending_buf + beg,
 229.716 -                                            s->pending - beg);
 229.717 -                    flush_pending(strm);
 229.718 -                    beg = s->pending;
 229.719 -                    if (s->pending == s->pending_buf_size) {
 229.720 -                        val = 1;
 229.721 -                        break;
 229.722 -                    }
 229.723 -                }
 229.724 -                val = s->gzhead->name[s->gzindex++];
 229.725 -                put_byte(s, val);
 229.726 -            } while (val != 0);
 229.727 -            if (s->gzhead->hcrc && s->pending > beg)
 229.728 -                strm->adler = crc32(strm->adler, s->pending_buf + beg,
 229.729 -                                    s->pending - beg);
 229.730 -            if (val == 0) {
 229.731 -                s->gzindex = 0;
 229.732 -                s->status = COMMENT_STATE;
 229.733 -            }
 229.734 -        }
 229.735 -        else
 229.736 -            s->status = COMMENT_STATE;
 229.737 -    }
 229.738 -    if (s->status == COMMENT_STATE) {
 229.739 -        if (s->gzhead->comment != NULL) {
 229.740 -            uInt beg = s->pending;  /* start of bytes to update crc */
 229.741 -            int val;
 229.742 -
 229.743 -            do {
 229.744 -                if (s->pending == s->pending_buf_size) {
 229.745 -                    if (s->gzhead->hcrc && s->pending > beg)
 229.746 -                        strm->adler = crc32(strm->adler, s->pending_buf + beg,
 229.747 -                                            s->pending - beg);
 229.748 -                    flush_pending(strm);
 229.749 -                    beg = s->pending;
 229.750 -                    if (s->pending == s->pending_buf_size) {
 229.751 -                        val = 1;
 229.752 -                        break;
 229.753 -                    }
 229.754 -                }
 229.755 -                val = s->gzhead->comment[s->gzindex++];
 229.756 -                put_byte(s, val);
 229.757 -            } while (val != 0);
 229.758 -            if (s->gzhead->hcrc && s->pending > beg)
 229.759 -                strm->adler = crc32(strm->adler, s->pending_buf + beg,
 229.760 -                                    s->pending - beg);
 229.761 -            if (val == 0)
 229.762 -                s->status = HCRC_STATE;
 229.763 -        }
 229.764 -        else
 229.765 -            s->status = HCRC_STATE;
 229.766 -    }
 229.767 -    if (s->status == HCRC_STATE) {
 229.768 -        if (s->gzhead->hcrc) {
 229.769 -            if (s->pending + 2 > s->pending_buf_size)
 229.770 -                flush_pending(strm);
 229.771 -            if (s->pending + 2 <= s->pending_buf_size) {
 229.772 -                put_byte(s, (Byte)(strm->adler & 0xff));
 229.773 -                put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
 229.774 -                strm->adler = crc32(0L, Z_NULL, 0);
 229.775 -                s->status = BUSY_STATE;
 229.776 -            }
 229.777 -        }
 229.778 -        else
 229.779 -            s->status = BUSY_STATE;
 229.780 -    }
 229.781 -#endif
 229.782 -
 229.783 -    /* Flush as much pending output as possible */
 229.784 -    if (s->pending != 0) {
 229.785 -        flush_pending(strm);
 229.786 -        if (strm->avail_out == 0) {
 229.787 -            /* Since avail_out is 0, deflate will be called again with
 229.788 -             * more output space, but possibly with both pending and
 229.789 -             * avail_in equal to zero. There won't be anything to do,
 229.790 -             * but this is not an error situation so make sure we
 229.791 -             * return OK instead of BUF_ERROR at next call of deflate:
 229.792 -             */
 229.793 -            s->last_flush = -1;
 229.794 -            return Z_OK;
 229.795 -        }
 229.796 -
 229.797 -    /* Make sure there is something to do and avoid duplicate consecutive
 229.798 -     * flushes. For repeated and useless calls with Z_FINISH, we keep
 229.799 -     * returning Z_STREAM_END instead of Z_BUF_ERROR.
 229.800 -     */
 229.801 -    } else if (strm->avail_in == 0 && flush <= old_flush &&
 229.802 -               flush != Z_FINISH) {
 229.803 -        ERR_RETURN(strm, Z_BUF_ERROR);
 229.804 -    }
 229.805 -
 229.806 -    /* User must not provide more input after the first FINISH: */
 229.807 -    if (s->status == FINISH_STATE && strm->avail_in != 0) {
 229.808 -        ERR_RETURN(strm, Z_BUF_ERROR);
 229.809 -    }
 229.810 -
 229.811 -    /* Start a new block or continue the current one.
 229.812 -     */
 229.813 -    if (strm->avail_in != 0 || s->lookahead != 0 ||
 229.814 -        (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
 229.815 -        block_state bstate;
 229.816 -
 229.817 -        bstate = (*(configuration_table[s->level].func))(s, flush);
 229.818 -
 229.819 -        if (bstate == finish_started || bstate == finish_done) {
 229.820 -            s->status = FINISH_STATE;
 229.821 -        }
 229.822 -        if (bstate == need_more || bstate == finish_started) {
 229.823 -            if (strm->avail_out == 0) {
 229.824 -                s->last_flush = -1; /* avoid BUF_ERROR next call, see above */
 229.825 -            }
 229.826 -            return Z_OK;
 229.827 -            /* If flush != Z_NO_FLUSH && avail_out == 0, the next call
 229.828 -             * of deflate should use the same flush parameter to make sure
 229.829 -             * that the flush is complete. So we don't have to output an
 229.830 -             * empty block here, this will be done at next call. This also
 229.831 -             * ensures that for a very small output buffer, we emit at most
 229.832 -             * one empty block.
 229.833 -             */
 229.834 -        }
 229.835 -        if (bstate == block_done) {
 229.836 -            if (flush == Z_PARTIAL_FLUSH) {
 229.837 -                _tr_align(s);
 229.838 -            } else { /* FULL_FLUSH or SYNC_FLUSH */
 229.839 -                _tr_stored_block(s, (char*)0, 0L, 0);
 229.840 -                /* For a full flush, this empty block will be recognized
 229.841 -                 * as a special marker by inflate_sync().
 229.842 -                 */
 229.843 -                if (flush == Z_FULL_FLUSH) {
 229.844 -                    CLEAR_HASH(s);             /* forget history */
 229.845 -                }
 229.846 -            }
 229.847 -            flush_pending(strm);
 229.848 -            if (strm->avail_out == 0) {
 229.849 -              s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */
 229.850 -              return Z_OK;
 229.851 -            }
 229.852 -        }
 229.853 -    }
 229.854 -    Assert(strm->avail_out > 0, "bug2");
 229.855 -
 229.856 -    if (flush != Z_FINISH) return Z_OK;
 229.857 -    if (s->wrap <= 0) return Z_STREAM_END;
 229.858 -
 229.859 -    /* Write the trailer */
 229.860 -#ifdef GZIP
 229.861 -    if (s->wrap == 2) {
 229.862 -        put_byte(s, (Byte)(strm->adler & 0xff));
 229.863 -        put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
 229.864 -        put_byte(s, (Byte)((strm->adler >> 16) & 0xff));
 229.865 -        put_byte(s, (Byte)((strm->adler >> 24) & 0xff));
 229.866 -        put_byte(s, (Byte)(strm->total_in & 0xff));
 229.867 -        put_byte(s, (Byte)((strm->total_in >> 8) & 0xff));
 229.868 -        put_byte(s, (Byte)((strm->total_in >> 16) & 0xff));
 229.869 -        put_byte(s, (Byte)((strm->total_in >> 24) & 0xff));
 229.870 -    }
 229.871 -    else
 229.872 -#endif
 229.873 -    {
 229.874 -        putShortMSB(s, (uInt)(strm->adler >> 16));
 229.875 -        putShortMSB(s, (uInt)(strm->adler & 0xffff));
 229.876 -    }
 229.877 -    flush_pending(strm);
 229.878 -    /* If avail_out is zero, the application will call deflate again
 229.879 -     * to flush the rest.
 229.880 -     */
 229.881 -    if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */
 229.882 -    return s->pending != 0 ? Z_OK : Z_STREAM_END;
 229.883 -}
 229.884 -
 229.885 -/* ========================================================================= */
 229.886 -int ZEXPORT deflateEnd (strm)
 229.887 -    z_streamp strm;
 229.888 -{
 229.889 -    int status;
 229.890 -
 229.891 -    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
 229.892 -
 229.893 -    status = strm->state->status;
 229.894 -    if (status != INIT_STATE &&
 229.895 -        status != EXTRA_STATE &&
 229.896 -        status != NAME_STATE &&
 229.897 -        status != COMMENT_STATE &&
 229.898 -        status != HCRC_STATE &&
 229.899 -        status != BUSY_STATE &&
 229.900 -        status != FINISH_STATE) {
 229.901 -      return Z_STREAM_ERROR;
 229.902 -    }
 229.903 -
 229.904 -    /* Deallocate in reverse order of allocations: */
 229.905 -    TRY_FREE(strm, strm->state->pending_buf);
 229.906 -    TRY_FREE(strm, strm->state->head);
 229.907 -    TRY_FREE(strm, strm->state->prev);
 229.908 -    TRY_FREE(strm, strm->state->window);
 229.909 -
 229.910 -    ZFREE(strm, strm->state);
 229.911 -    strm->state = Z_NULL;
 229.912 -
 229.913 -    return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
 229.914 -}
 229.915 -
 229.916 -/* =========================================================================
 229.917 - * Copy the source state to the destination state.
 229.918 - * To simplify the source, this is not supported for 16-bit MSDOS (which
 229.919 - * doesn't have enough memory anyway to duplicate compression states).
 229.920 - */
 229.921 -int ZEXPORT deflateCopy (dest, source)
 229.922 -    z_streamp dest;
 229.923 -    z_streamp source;
 229.924 -{
 229.925 -#ifdef MAXSEG_64K
 229.926 -    return Z_STREAM_ERROR;
 229.927 -#else
 229.928 -    deflate_state *ds;
 229.929 -    deflate_state *ss;
 229.930 -    ushf *overlay;
 229.931 -
 229.932 -
 229.933 -    if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) {
 229.934 -        return Z_STREAM_ERROR;
 229.935 -    }
 229.936 -
 229.937 -    ss = source->state;
 229.938 -
 229.939 -    zmemcpy(dest, source, sizeof(z_stream));
 229.940 -
 229.941 -    ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
 229.942 -    if (ds == Z_NULL) return Z_MEM_ERROR;
 229.943 -    dest->state = (struct internal_state FAR *) ds;
 229.944 -    zmemcpy(ds, ss, sizeof(deflate_state));
 229.945 -    ds->strm = dest;
 229.946 -
 229.947 -    ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
 229.948 -    ds->prev   = (Posf *)  ZALLOC(dest, ds->w_size, sizeof(Pos));
 229.949 -    ds->head   = (Posf *)  ZALLOC(dest, ds->hash_size, sizeof(Pos));
 229.950 -    overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2);
 229.951 -    ds->pending_buf = (uchf *) overlay;
 229.952 -
 229.953 -    if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
 229.954 -        ds->pending_buf == Z_NULL) {
 229.955 -        deflateEnd (dest);
 229.956 -        return Z_MEM_ERROR;
 229.957 -    }
 229.958 -    /* following zmemcpy do not work for 16-bit MSDOS */
 229.959 -    zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));
 229.960 -    zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos));
 229.961 -    zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos));
 229.962 -    zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
 229.963 -
 229.964 -    ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
 229.965 -    ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush);
 229.966 -    ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize;
 229.967 -
 229.968 -    ds->l_desc.dyn_tree = ds->dyn_ltree;
 229.969 -    ds->d_desc.dyn_tree = ds->dyn_dtree;
 229.970 -    ds->bl_desc.dyn_tree = ds->bl_tree;
 229.971 -
 229.972 -    return Z_OK;
 229.973 -#endif /* MAXSEG_64K */
 229.974 -}
 229.975 -
 229.976 -/* ===========================================================================
 229.977 - * Read a new buffer from the current input stream, update the adler32
 229.978 - * and total number of bytes read.  All deflate() input goes through
 229.979 - * this function so some applications may wish to modify it to avoid
 229.980 - * allocating a large strm->next_in buffer and copying from it.
 229.981 - * (See also flush_pending()).
 229.982 - */
 229.983 -local int read_buf(strm, buf, size)
 229.984 -    z_streamp strm;
 229.985 -    Bytef *buf;
 229.986 -    unsigned size;
 229.987 -{
 229.988 -    unsigned len = strm->avail_in;
 229.989 -
 229.990 -    if (len > size) len = size;
 229.991 -    if (len == 0) return 0;
 229.992 -
 229.993 -    strm->avail_in  -= len;
 229.994 -
 229.995 -    if (strm->state->wrap == 1) {
 229.996 -        strm->adler = adler32(strm->adler, strm->next_in, len);
 229.997 -    }
 229.998 -#ifdef GZIP
 229.999 -    else if (strm->state->wrap == 2) {
229.1000 -        strm->adler = crc32(strm->adler, strm->next_in, len);
229.1001 -    }
229.1002 -#endif
229.1003 -    zmemcpy(buf, strm->next_in, len);
229.1004 -    strm->next_in  += len;
229.1005 -    strm->total_in += len;
229.1006 -
229.1007 -    return (int)len;
229.1008 -}
229.1009 -
229.1010 -/* ===========================================================================
229.1011 - * Initialize the "longest match" routines for a new zlib stream
229.1012 - */
229.1013 -local void lm_init (s)
229.1014 -    deflate_state *s;
229.1015 -{
229.1016 -    s->window_size = (ulg)2L*s->w_size;
229.1017 -
229.1018 -    CLEAR_HASH(s);
229.1019 -
229.1020 -    /* Set the default configuration parameters:
229.1021 -     */
229.1022 -    s->max_lazy_match   = configuration_table[s->level].max_lazy;
229.1023 -    s->good_match       = configuration_table[s->level].good_length;
229.1024 -    s->nice_match       = configuration_table[s->level].nice_length;
229.1025 -    s->max_chain_length = configuration_table[s->level].max_chain;
229.1026 -
229.1027 -    s->strstart = 0;
229.1028 -    s->block_start = 0L;
229.1029 -    s->lookahead = 0;
229.1030 -    s->match_length = s->prev_length = MIN_MATCH-1;
229.1031 -    s->match_available = 0;
229.1032 -    s->ins_h = 0;
229.1033 -#ifndef FASTEST
229.1034 -#ifdef ASMV
229.1035 -    match_init(); /* initialize the asm code */
229.1036 -#endif
229.1037 -#endif
229.1038 -}
229.1039 -
229.1040 -#ifndef FASTEST
229.1041 -/* ===========================================================================
229.1042 - * Set match_start to the longest match starting at the given string and
229.1043 - * return its length. Matches shorter or equal to prev_length are discarded,
229.1044 - * in which case the result is equal to prev_length and match_start is
229.1045 - * garbage.
229.1046 - * IN assertions: cur_match is the head of the hash chain for the current
229.1047 - *   string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
229.1048 - * OUT assertion: the match length is not greater than s->lookahead.
229.1049 - */
229.1050 -#ifndef ASMV
229.1051 -/* For 80x86 and 680x0, an optimized version will be provided in match.asm or
229.1052 - * match.S. The code will be functionally equivalent.
229.1053 - */
229.1054 -local uInt longest_match(s, cur_match)
229.1055 -    deflate_state *s;
229.1056 -    IPos cur_match;                             /* current match */
229.1057 -{
229.1058 -    unsigned chain_length = s->max_chain_length;/* max hash chain length */
229.1059 -    register Bytef *scan = s->window + s->strstart; /* current string */
229.1060 -    register Bytef *match;                       /* matched string */
229.1061 -    register int len;                           /* length of current match */
229.1062 -    int best_len = s->prev_length;              /* best match length so far */
229.1063 -    int nice_match = s->nice_match;             /* stop if match long enough */
229.1064 -    IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
229.1065 -        s->strstart - (IPos)MAX_DIST(s) : NIL;
229.1066 -    /* Stop when cur_match becomes <= limit. To simplify the code,
229.1067 -     * we prevent matches with the string of window index 0.
229.1068 -     */
229.1069 -    Posf *prev = s->prev;
229.1070 -    uInt wmask = s->w_mask;
229.1071 -
229.1072 -#ifdef UNALIGNED_OK
229.1073 -    /* Compare two bytes at a time. Note: this is not always beneficial.
229.1074 -     * Try with and without -DUNALIGNED_OK to check.
229.1075 -     */
229.1076 -    register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
229.1077 -    register ush scan_start = *(ushf*)scan;
229.1078 -    register ush scan_end   = *(ushf*)(scan+best_len-1);
229.1079 -#else
229.1080 -    register Bytef *strend = s->window + s->strstart + MAX_MATCH;
229.1081 -    register Byte scan_end1  = scan[best_len-1];
229.1082 -    register Byte scan_end   = scan[best_len];
229.1083 -#endif
229.1084 -
229.1085 -    /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
229.1086 -     * It is easy to get rid of this optimization if necessary.
229.1087 -     */
229.1088 -    Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
229.1089 -
229.1090 -    /* Do not waste too much time if we already have a good match: */
229.1091 -    if (s->prev_length >= s->good_match) {
229.1092 -        chain_length >>= 2;
229.1093 -    }
229.1094 -    /* Do not look for matches beyond the end of the input. This is necessary
229.1095 -     * to make deflate deterministic.
229.1096 -     */
229.1097 -    if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
229.1098 -
229.1099 -    Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
229.1100 -
229.1101 -    do {
229.1102 -        Assert(cur_match < s->strstart, "no future");
229.1103 -        match = s->window + cur_match;
229.1104 -
229.1105 -        /* Skip to next match if the match length cannot increase
229.1106 -         * or if the match length is less than 2.  Note that the checks below
229.1107 -         * for insufficient lookahead only occur occasionally for performance
229.1108 -         * reasons.  Therefore uninitialized memory will be accessed, and
229.1109 -         * conditional jumps will be made that depend on those values.
229.1110 -         * However the length of the match is limited to the lookahead, so
229.1111 -         * the output of deflate is not affected by the uninitialized values.
229.1112 -         */
229.1113 -#if (defined(UNALIGNED_OK) && MAX_MATCH == 258)
229.1114 -        /* This code assumes sizeof(unsigned short) == 2. Do not use
229.1115 -         * UNALIGNED_OK if your compiler uses a different size.
229.1116 -         */
229.1117 -        if (*(ushf*)(match+best_len-1) != scan_end ||
229.1118 -            *(ushf*)match != scan_start) continue;
229.1119 -
229.1120 -        /* It is not necessary to compare scan[2] and match[2] since they are
229.1121 -         * always equal when the other bytes match, given that the hash keys
229.1122 -         * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at
229.1123 -         * strstart+3, +5, ... up to strstart+257. We check for insufficient
229.1124 -         * lookahead only every 4th comparison; the 128th check will be made
229.1125 -         * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is
229.1126 -         * necessary to put more guard bytes at the end of the window, or
229.1127 -         * to check more often for insufficient lookahead.
229.1128 -         */
229.1129 -        Assert(scan[2] == match[2], "scan[2]?");
229.1130 -        scan++, match++;
229.1131 -        do {
229.1132 -        } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
229.1133 -                 *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
229.1134 -                 *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
229.1135 -                 *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
229.1136 -                 scan < strend);
229.1137 -        /* The funny "do {}" generates better code on most compilers */
229.1138 -
229.1139 -        /* Here, scan <= window+strstart+257 */
229.1140 -        Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
229.1141 -        if (*scan == *match) scan++;
229.1142 -
229.1143 -        len = (MAX_MATCH - 1) - (int)(strend-scan);
229.1144 -        scan = strend - (MAX_MATCH-1);
229.1145 -
229.1146 -#else /* UNALIGNED_OK */
229.1147 -
229.1148 -        if (match[best_len]   != scan_end  ||
229.1149 -            match[best_len-1] != scan_end1 ||
229.1150 -            *match            != *scan     ||
229.1151 -            *++match          != scan[1])      continue;
229.1152 -
229.1153 -        /* The check at best_len-1 can be removed because it will be made
229.1154 -         * again later. (This heuristic is not always a win.)
229.1155 -         * It is not necessary to compare scan[2] and match[2] since they
229.1156 -         * are always equal when the other bytes match, given that
229.1157 -         * the hash keys are equal and that HASH_BITS >= 8.
229.1158 -         */
229.1159 -        scan += 2, match++;
229.1160 -        Assert(*scan == *match, "match[2]?");
229.1161 -
229.1162 -        /* We check for insufficient lookahead only every 8th comparison;
229.1163 -         * the 256th check will be made at strstart+258.
229.1164 -         */
229.1165 -        do {
229.1166 -        } while (*++scan == *++match && *++scan == *++match &&
229.1167 -                 *++scan == *++match && *++scan == *++match &&
229.1168 -                 *++scan == *++match && *++scan == *++match &&
229.1169 -                 *++scan == *++match && *++scan == *++match &&
229.1170 -                 scan < strend);
229.1171 -
229.1172 -        Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
229.1173 -
229.1174 -        len = MAX_MATCH - (int)(strend - scan);
229.1175 -        scan = strend - MAX_MATCH;
229.1176 -
229.1177 -#endif /* UNALIGNED_OK */
229.1178 -
229.1179 -        if (len > best_len) {
229.1180 -            s->match_start = cur_match;
229.1181 -            best_len = len;
229.1182 -            if (len >= nice_match) break;
229.1183 -#ifdef UNALIGNED_OK
229.1184 -            scan_end = *(ushf*)(scan+best_len-1);
229.1185 -#else
229.1186 -            scan_end1  = scan[best_len-1];
229.1187 -            scan_end   = scan[best_len];
229.1188 -#endif
229.1189 -        }
229.1190 -    } while ((cur_match = prev[cur_match & wmask]) > limit
229.1191 -             && --chain_length != 0);
229.1192 -
229.1193 -    if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
229.1194 -    return s->lookahead;
229.1195 -}
229.1196 -#endif /* ASMV */
229.1197 -#endif /* FASTEST */
229.1198 -
229.1199 -/* ---------------------------------------------------------------------------
229.1200 - * Optimized version for level == 1 or strategy == Z_RLE only
229.1201 - */
229.1202 -local uInt longest_match_fast(s, cur_match)
229.1203 -    deflate_state *s;
229.1204 -    IPos cur_match;                             /* current match */
229.1205 -{
229.1206 -    register Bytef *scan = s->window + s->strstart; /* current string */
229.1207 -    register Bytef *match;                       /* matched string */
229.1208 -    register int len;                           /* length of current match */
229.1209 -    register Bytef *strend = s->window + s->strstart + MAX_MATCH;
229.1210 -
229.1211 -    /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
229.1212 -     * It is easy to get rid of this optimization if necessary.
229.1213 -     */
229.1214 -    Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
229.1215 -
229.1216 -    Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
229.1217 -
229.1218 -    Assert(cur_match < s->strstart, "no future");
229.1219 -
229.1220 -    match = s->window + cur_match;
229.1221 -
229.1222 -    /* Return failure if the match length is less than 2:
229.1223 -     */
229.1224 -    if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1;
229.1225 -
229.1226 -    /* The check at best_len-1 can be removed because it will be made
229.1227 -     * again later. (This heuristic is not always a win.)
229.1228 -     * It is not necessary to compare scan[2] and match[2] since they
229.1229 -     * are always equal when the other bytes match, given that
229.1230 -     * the hash keys are equal and that HASH_BITS >= 8.
229.1231 -     */
229.1232 -    scan += 2, match += 2;
229.1233 -    Assert(*scan == *match, "match[2]?");
229.1234 -
229.1235 -    /* We check for insufficient lookahead only every 8th comparison;
229.1236 -     * the 256th check will be made at strstart+258.
229.1237 -     */
229.1238 -    do {
229.1239 -    } while (*++scan == *++match && *++scan == *++match &&
229.1240 -             *++scan == *++match && *++scan == *++match &&
229.1241 -             *++scan == *++match && *++scan == *++match &&
229.1242 -             *++scan == *++match && *++scan == *++match &&
229.1243 -             scan < strend);
229.1244 -
229.1245 -    Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
229.1246 -
229.1247 -    len = MAX_MATCH - (int)(strend - scan);
229.1248 -
229.1249 -    if (len < MIN_MATCH) return MIN_MATCH - 1;
229.1250 -
229.1251 -    s->match_start = cur_match;
229.1252 -    return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead;
229.1253 -}
229.1254 -
229.1255 -#ifdef DEBUG
229.1256 -/* ===========================================================================
229.1257 - * Check that the match at match_start is indeed a match.
229.1258 - */
229.1259 -local void check_match(s, start, match, length)
229.1260 -    deflate_state *s;
229.1261 -    IPos start, match;
229.1262 -    int length;
229.1263 -{
229.1264 -    /* check that the match is indeed a match */
229.1265 -    if (zmemcmp(s->window + match,
229.1266 -                s->window + start, length) != EQUAL) {
229.1267 -        fprintf(stderr, " start %u, match %u, length %d\n",
229.1268 -                start, match, length);
229.1269 -        do {
229.1270 -            fprintf(stderr, "%c%c", s->window[match++], s->window[start++]);
229.1271 -        } while (--length != 0);
229.1272 -        z_error("invalid match");
229.1273 -    }
229.1274 -    if (z_verbose > 1) {
229.1275 -        fprintf(stderr,"\\[%d,%d]", start-match, length);
229.1276 -        do { putc(s->window[start++], stderr); } while (--length != 0);
229.1277 -    }
229.1278 -}
229.1279 -#else
229.1280 -#  define check_match(s, start, match, length)
229.1281 -#endif /* DEBUG */
229.1282 -
229.1283 -/* ===========================================================================
229.1284 - * Fill the window when the lookahead becomes insufficient.
229.1285 - * Updates strstart and lookahead.
229.1286 - *
229.1287 - * IN assertion: lookahead < MIN_LOOKAHEAD
229.1288 - * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
229.1289 - *    At least one byte has been read, or avail_in == 0; reads are
229.1290 - *    performed for at least two bytes (required for the zip translate_eol
229.1291 - *    option -- not supported here).
229.1292 - */
229.1293 -local void fill_window(s)
229.1294 -    deflate_state *s;
229.1295 -{
229.1296 -    register unsigned n, m;
229.1297 -    register Posf *p;
229.1298 -    unsigned more;    /* Amount of free space at the end of the window. */
229.1299 -    uInt wsize = s->w_size;
229.1300 -
229.1301 -    do {
229.1302 -        more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
229.1303 -
229.1304 -        /* Deal with !@#$% 64K limit: */
229.1305 -        if (sizeof(int) <= 2) {
229.1306 -            if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
229.1307 -                more = wsize;
229.1308 -
229.1309 -            } else if (more == (unsigned)(-1)) {
229.1310 -                /* Very unlikely, but possible on 16 bit machine if
229.1311 -                 * strstart == 0 && lookahead == 1 (input done a byte at time)
229.1312 -                 */
229.1313 -                more--;
229.1314 -            }
229.1315 -        }
229.1316 -
229.1317 -        /* If the window is almost full and there is insufficient lookahead,
229.1318 -         * move the upper half to the lower one to make room in the upper half.
229.1319 -         */
229.1320 -        if (s->strstart >= wsize+MAX_DIST(s)) {
229.1321 -
229.1322 -            zmemcpy(s->window, s->window+wsize, (unsigned)wsize);
229.1323 -            s->match_start -= wsize;
229.1324 -            s->strstart    -= wsize; /* we now have strstart >= MAX_DIST */
229.1325 -            s->block_start -= (long) wsize;
229.1326 -
229.1327 -            /* Slide the hash table (could be avoided with 32 bit values
229.1328 -               at the expense of memory usage). We slide even when level == 0
229.1329 -               to keep the hash table consistent if we switch back to level > 0
229.1330 -               later. (Using level 0 permanently is not an optimal usage of
229.1331 -               zlib, so we don't care about this pathological case.)
229.1332 -             */
229.1333 -            /* %%% avoid this when Z_RLE */
229.1334 -            n = s->hash_size;
229.1335 -            p = &s->head[n];
229.1336 -            do {
229.1337 -                m = *--p;
229.1338 -                *p = (Pos)(m >= wsize ? m-wsize : NIL);
229.1339 -            } while (--n);
229.1340 -
229.1341 -            n = wsize;
229.1342 -#ifndef FASTEST
229.1343 -            p = &s->prev[n];
229.1344 -            do {
229.1345 -                m = *--p;
229.1346 -                *p = (Pos)(m >= wsize ? m-wsize : NIL);
229.1347 -                /* If n is not on any hash chain, prev[n] is garbage but
229.1348 -                 * its value will never be used.
229.1349 -                 */
229.1350 -            } while (--n);
229.1351 -#endif
229.1352 -            more += wsize;
229.1353 -        }
229.1354 -        if (s->strm->avail_in == 0) return;
229.1355 -
229.1356 -        /* If there was no sliding:
229.1357 -         *    strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
229.1358 -         *    more == window_size - lookahead - strstart
229.1359 -         * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
229.1360 -         * => more >= window_size - 2*WSIZE + 2
229.1361 -         * In the BIG_MEM or MMAP case (not yet supported),
229.1362 -         *   window_size == input_size + MIN_LOOKAHEAD  &&
229.1363 -         *   strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
229.1364 -         * Otherwise, window_size == 2*WSIZE so more >= 2.
229.1365 -         * If there was sliding, more >= WSIZE. So in all cases, more >= 2.
229.1366 -         */
229.1367 -        Assert(more >= 2, "more < 2");
229.1368 -
229.1369 -        n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
229.1370 -        s->lookahead += n;
229.1371 -
229.1372 -        /* Initialize the hash value now that we have some input: */
229.1373 -        if (s->lookahead >= MIN_MATCH) {
229.1374 -            s->ins_h = s->window[s->strstart];
229.1375 -            UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
229.1376 -#if MIN_MATCH != 3
229.1377 -            Call UPDATE_HASH() MIN_MATCH-3 more times
229.1378 -#endif
229.1379 -        }
229.1380 -        /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
229.1381 -         * but this is not important since only literal bytes will be emitted.
229.1382 -         */
229.1383 -
229.1384 -    } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
229.1385 -}
229.1386 -
229.1387 -/* ===========================================================================
229.1388 - * Flush the current block, with given end-of-file flag.
229.1389 - * IN assertion: strstart is set to the end of the current match.
229.1390 - */
229.1391 -#define FLUSH_BLOCK_ONLY(s, eof) { \
229.1392 -   _tr_flush_block(s, (s->block_start >= 0L ? \
229.1393 -                   (charf *)&s->window[(unsigned)s->block_start] : \
229.1394 -                   (charf *)Z_NULL), \
229.1395 -                (ulg)((long)s->strstart - s->block_start), \
229.1396 -                (eof)); \
229.1397 -   s->block_start = s->strstart; \
229.1398 -   flush_pending(s->strm); \
229.1399 -   Tracev((stderr,"[FLUSH]")); \
229.1400 -}
229.1401 -
229.1402 -/* Same but force premature exit if necessary. */
229.1403 -#define FLUSH_BLOCK(s, eof) { \
229.1404 -   FLUSH_BLOCK_ONLY(s, eof); \
229.1405 -   if (s->strm->avail_out == 0) return (eof) ? finish_started : need_more; \
229.1406 -}
229.1407 -
229.1408 -/* ===========================================================================
229.1409 - * Copy without compression as much as possible from the input stream, return
229.1410 - * the current block state.
229.1411 - * This function does not insert new strings in the dictionary since
229.1412 - * uncompressible data is probably not useful. This function is used
229.1413 - * only for the level=0 compression option.
229.1414 - * NOTE: this function should be optimized to avoid extra copying from
229.1415 - * window to pending_buf.
229.1416 - */
229.1417 -local block_state deflate_stored(s, flush)
229.1418 -    deflate_state *s;
229.1419 -    int flush;
229.1420 -{
229.1421 -    /* Stored blocks are limited to 0xffff bytes, pending_buf is limited
229.1422 -     * to pending_buf_size, and each stored block has a 5 byte header:
229.1423 -     */
229.1424 -    ulg max_block_size = 0xffff;
229.1425 -    ulg max_start;
229.1426 -
229.1427 -    if (max_block_size > s->pending_buf_size - 5) {
229.1428 -        max_block_size = s->pending_buf_size - 5;
229.1429 -    }
229.1430 -
229.1431 -    /* Copy as much as possible from input to output: */
229.1432 -    for (;;) {
229.1433 -        /* Fill the window as much as possible: */
229.1434 -        if (s->lookahead <= 1) {
229.1435 -
229.1436 -            Assert(s->strstart < s->w_size+MAX_DIST(s) ||
229.1437 -                   s->block_start >= (long)s->w_size, "slide too late");
229.1438 -
229.1439 -            fill_window(s);
229.1440 -            if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more;
229.1441 -
229.1442 -            if (s->lookahead == 0) break; /* flush the current block */
229.1443 -        }
229.1444 -        Assert(s->block_start >= 0L, "block gone");
229.1445 -
229.1446 -        s->strstart += s->lookahead;
229.1447 -        s->lookahead = 0;
229.1448 -
229.1449 -        /* Emit a stored block if pending_buf will be full: */
229.1450 -        max_start = s->block_start + max_block_size;
229.1451 -        if (s->strstart == 0 || (ulg)s->strstart >= max_start) {
229.1452 -            /* strstart == 0 is possible when wraparound on 16-bit machine */
229.1453 -            s->lookahead = (uInt)(s->strstart - max_start);
229.1454 -            s->strstart = (uInt)max_start;
229.1455 -            FLUSH_BLOCK(s, 0);
229.1456 -        }
229.1457 -        /* Flush if we may have to slide, otherwise block_start may become
229.1458 -         * negative and the data will be gone:
229.1459 -         */
229.1460 -        if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) {
229.1461 -            FLUSH_BLOCK(s, 0);
229.1462 -        }
229.1463 -    }
229.1464 -    FLUSH_BLOCK(s, flush == Z_FINISH);
229.1465 -    return flush == Z_FINISH ? finish_done : block_done;
229.1466 -}
229.1467 -
229.1468 -/* ===========================================================================
229.1469 - * Compress as much as possible from the input stream, return the current
229.1470 - * block state.
229.1471 - * This function does not perform lazy evaluation of matches and inserts
229.1472 - * new strings in the dictionary only for unmatched strings or for short
229.1473 - * matches. It is used only for the fast compression options.
229.1474 - */
229.1475 -local block_state deflate_fast(s, flush)
229.1476 -    deflate_state *s;
229.1477 -    int flush;
229.1478 -{
229.1479 -    IPos hash_head = NIL; /* head of the hash chain */
229.1480 -    int bflush;           /* set if current block must be flushed */
229.1481 -
229.1482 -    for (;;) {
229.1483 -        /* Make sure that we always have enough lookahead, except
229.1484 -         * at the end of the input file. We need MAX_MATCH bytes
229.1485 -         * for the next match, plus MIN_MATCH bytes to insert the
229.1486 -         * string following the next match.
229.1487 -         */
229.1488 -        if (s->lookahead < MIN_LOOKAHEAD) {
229.1489 -            fill_window(s);
229.1490 -            if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
229.1491 -                return need_more;
229.1492 -            }
229.1493 -            if (s->lookahead == 0) break; /* flush the current block */
229.1494 -        }
229.1495 -
229.1496 -        /* Insert the string window[strstart .. strstart+2] in the
229.1497 -         * dictionary, and set hash_head to the head of the hash chain:
229.1498 -         */
229.1499 -        if (s->lookahead >= MIN_MATCH) {
229.1500 -            INSERT_STRING(s, s->strstart, hash_head);
229.1501 -        }
229.1502 -
229.1503 -        /* Find the longest match, discarding those <= prev_length.
229.1504 -         * At this point we have always match_length < MIN_MATCH
229.1505 -         */
229.1506 -        if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) {
229.1507 -            /* To simplify the code, we prevent matches with the string
229.1508 -             * of window index 0 (in particular we have to avoid a match
229.1509 -             * of the string with itself at the start of the input file).
229.1510 -             */
229.1511 -#ifdef FASTEST
229.1512 -            if ((s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) ||
229.1513 -                (s->strategy == Z_RLE && s->strstart - hash_head == 1)) {
229.1514 -                s->match_length = longest_match_fast (s, hash_head);
229.1515 -            }
229.1516 -#else
229.1517 -            if (s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) {
229.1518 -                s->match_length = longest_match (s, hash_head);
229.1519 -            } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) {
229.1520 -                s->match_length = longest_match_fast (s, hash_head);
229.1521 -            }
229.1522 -#endif
229.1523 -            /* longest_match() or longest_match_fast() sets match_start */
229.1524 -        }
229.1525 -        if (s->match_length >= MIN_MATCH) {
229.1526 -            check_match(s, s->strstart, s->match_start, s->match_length);
229.1527 -
229.1528 -            _tr_tally_dist(s, s->strstart - s->match_start,
229.1529 -                           s->match_length - MIN_MATCH, bflush);
229.1530 -
229.1531 -            s->lookahead -= s->match_length;
229.1532 -
229.1533 -            /* Insert new strings in the hash table only if the match length
229.1534 -             * is not too large. This saves time but degrades compression.
229.1535 -             */
229.1536 -#ifndef FASTEST
229.1537 -            if (s->match_length <= s->max_insert_length &&
229.1538 -                s->lookahead >= MIN_MATCH) {
229.1539 -                s->match_length--; /* string at strstart already in table */
229.1540 -                do {
229.1541 -                    s->strstart++;
229.1542 -                    INSERT_STRING(s, s->strstart, hash_head);
229.1543 -                    /* strstart never exceeds WSIZE-MAX_MATCH, so there are
229.1544 -                     * always MIN_MATCH bytes ahead.
229.1545 -                     */
229.1546 -                } while (--s->match_length != 0);
229.1547 -                s->strstart++;
229.1548 -            } else
229.1549 -#endif
229.1550 -            {
229.1551 -                s->strstart += s->match_length;
229.1552 -                s->match_length = 0;
229.1553 -                s->ins_h = s->window[s->strstart];
229.1554 -                UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
229.1555 -#if MIN_MATCH != 3
229.1556 -                Call UPDATE_HASH() MIN_MATCH-3 more times
229.1557 -#endif
229.1558 -                /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not
229.1559 -                 * matter since it will be recomputed at next deflate call.
229.1560 -                 */
229.1561 -            }
229.1562 -        } else {
229.1563 -            /* No match, output a literal byte */
229.1564 -            Tracevv((stderr,"%c", s->window[s->strstart]));
229.1565 -            _tr_tally_lit (s, s->window[s->strstart], bflush);
229.1566 -            s->lookahead--;
229.1567 -            s->strstart++;
229.1568 -        }
229.1569 -        if (bflush) FLUSH_BLOCK(s, 0);
229.1570 -    }
229.1571 -    FLUSH_BLOCK(s, flush == Z_FINISH);
229.1572 -    return flush == Z_FINISH ? finish_done : block_done;
229.1573 -}
229.1574 -
229.1575 -#ifndef FASTEST
229.1576 -/* ===========================================================================
229.1577 - * Same as above, but achieves better compression. We use a lazy
229.1578 - * evaluation for matches: a match is finally adopted only if there is
229.1579 - * no better match at the next window position.
229.1580 - */
229.1581 -local block_state deflate_slow(s, flush)
229.1582 -    deflate_state *s;
229.1583 -    int flush;
229.1584 -{
229.1585 -    IPos hash_head = NIL;    /* head of hash chain */
229.1586 -    int bflush;              /* set if current block must be flushed */
229.1587 -
229.1588 -    /* Process the input block. */
229.1589 -    for (;;) {
229.1590 -        /* Make sure that we always have enough lookahead, except
229.1591 -         * at the end of the input file. We need MAX_MATCH bytes
229.1592 -         * for the next match, plus MIN_MATCH bytes to insert the
229.1593 -         * string following the next match.
229.1594 -         */
229.1595 -        if (s->lookahead < MIN_LOOKAHEAD) {
229.1596 -            fill_window(s);
229.1597 -            if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
229.1598 -                return need_more;
229.1599 -            }
229.1600 -            if (s->lookahead == 0) break; /* flush the current block */
229.1601 -        }
229.1602 -
229.1603 -        /* Insert the string window[strstart .. strstart+2] in the
229.1604 -         * dictionary, and set hash_head to the head of the hash chain:
229.1605 -         */
229.1606 -        if (s->lookahead >= MIN_MATCH) {
229.1607 -            INSERT_STRING(s, s->strstart, hash_head);
229.1608 -        }
229.1609 -
229.1610 -        /* Find the longest match, discarding those <= prev_length.
229.1611 -         */
229.1612 -        s->prev_length = s->match_length, s->prev_match = s->match_start;
229.1613 -        s->match_length = MIN_MATCH-1;
229.1614 -
229.1615 -        if (hash_head != NIL && s->prev_length < s->max_lazy_match &&
229.1616 -            s->strstart - hash_head <= MAX_DIST(s)) {
229.1617 -            /* To simplify the code, we prevent matches with the string
229.1618 -             * of window index 0 (in particular we have to avoid a match
229.1619 -             * of the string with itself at the start of the input file).
229.1620 -             */
229.1621 -            if (s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) {
229.1622 -                s->match_length = longest_match (s, hash_head);
229.1623 -            } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) {
229.1624 -                s->match_length = longest_match_fast (s, hash_head);
229.1625 -            }
229.1626 -            /* longest_match() or longest_match_fast() sets match_start */
229.1627 -
229.1628 -            if (s->match_length <= 5 && (s->strategy == Z_FILTERED
229.1629 -#if TOO_FAR <= 32767
229.1630 -                || (s->match_length == MIN_MATCH &&
229.1631 -                    s->strstart - s->match_start > TOO_FAR)
229.1632 -#endif
229.1633 -                )) {
229.1634 -
229.1635 -                /* If prev_match is also MIN_MATCH, match_start is garbage
229.1636 -                 * but we will ignore the current match anyway.
229.1637 -                 */
229.1638 -                s->match_length = MIN_MATCH-1;
229.1639 -            }
229.1640 -        }
229.1641 -        /* If there was a match at the previous step and the current
229.1642 -         * match is not better, output the previous match:
229.1643 -         */
229.1644 -        if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) {
229.1645 -            uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
229.1646 -            /* Do not insert strings in hash table beyond this. */
229.1647 -
229.1648 -            check_match(s, s->strstart-1, s->prev_match, s->prev_length);
229.1649 -
229.1650 -            _tr_tally_dist(s, s->strstart -1 - s->prev_match,
229.1651 -                           s->prev_length - MIN_MATCH, bflush);
229.1652 -
229.1653 -            /* Insert in hash table all strings up to the end of the match.
229.1654 -             * strstart-1 and strstart are already inserted. If there is not
229.1655 -             * enough lookahead, the last two strings are not inserted in
229.1656 -             * the hash table.
229.1657 -             */
229.1658 -            s->lookahead -= s->prev_length-1;
229.1659 -            s->prev_length -= 2;
229.1660 -            do {
229.1661 -                if (++s->strstart <= max_insert) {
229.1662 -                    INSERT_STRING(s, s->strstart, hash_head);
229.1663 -                }
229.1664 -            } while (--s->prev_length != 0);
229.1665 -            s->match_available = 0;
229.1666 -            s->match_length = MIN_MATCH-1;
229.1667 -            s->strstart++;
229.1668 -
229.1669 -            if (bflush) FLUSH_BLOCK(s, 0);
229.1670 -
229.1671 -        } else if (s->match_available) {
229.1672 -            /* If there was no match at the previous position, output a
229.1673 -             * single literal. If there was a match but the current match
229.1674 -             * is longer, truncate the previous match to a single literal.
229.1675 -             */
229.1676 -            Tracevv((stderr,"%c", s->window[s->strstart-1]));
229.1677 -            _tr_tally_lit(s, s->window[s->strstart-1], bflush);
229.1678 -            if (bflush) {
229.1679 -                FLUSH_BLOCK_ONLY(s, 0);
229.1680 -            }
229.1681 -            s->strstart++;
229.1682 -            s->lookahead--;
229.1683 -            if (s->strm->avail_out == 0) return need_more;
229.1684 -        } else {
229.1685 -            /* There is no previous match to compare with, wait for
229.1686 -             * the next step to decide.
229.1687 -             */
229.1688 -            s->match_available = 1;
229.1689 -            s->strstart++;
229.1690 -            s->lookahead--;
229.1691 -        }
229.1692 -    }
229.1693 -    Assert (flush != Z_NO_FLUSH, "no flush?");
229.1694 -    if (s->match_available) {
229.1695 -        Tracevv((stderr,"%c", s->window[s->strstart-1]));
229.1696 -        _tr_tally_lit(s, s->window[s->strstart-1], bflush);
229.1697 -        s->match_available = 0;
229.1698 -    }
229.1699 -    FLUSH_BLOCK(s, flush == Z_FINISH);
229.1700 -    return flush == Z_FINISH ? finish_done : block_done;
229.1701 -}
229.1702 -#endif /* FASTEST */
229.1703 -
229.1704 -#if 0
229.1705 -/* ===========================================================================
229.1706 - * For Z_RLE, simply look for runs of bytes, generate matches only of distance
229.1707 - * one.  Do not maintain a hash table.  (It will be regenerated if this run of
229.1708 - * deflate switches away from Z_RLE.)
229.1709 - */
229.1710 -local block_state deflate_rle(s, flush)
229.1711 -    deflate_state *s;
229.1712 -    int flush;
229.1713 -{
229.1714 -    int bflush;         /* set if current block must be flushed */
229.1715 -    uInt run;           /* length of run */
229.1716 -    uInt max;           /* maximum length of run */
229.1717 -    uInt prev;          /* byte at distance one to match */
229.1718 -    Bytef *scan;        /* scan for end of run */
229.1719 -
229.1720 -    for (;;) {
229.1721 -        /* Make sure that we always have enough lookahead, except
229.1722 -         * at the end of the input file. We need MAX_MATCH bytes
229.1723 -         * for the longest encodable run.
229.1724 -         */
229.1725 -        if (s->lookahead < MAX_MATCH) {
229.1726 -            fill_window(s);
229.1727 -            if (s->lookahead < MAX_MATCH && flush == Z_NO_FLUSH) {
229.1728 -                return need_more;
229.1729 -            }
229.1730 -            if (s->lookahead == 0) break; /* flush the current block */
229.1731 -        }
229.1732 -
229.1733 -        /* See how many times the previous byte repeats */
229.1734 -        run = 0;
229.1735 -        if (s->strstart > 0) {      /* if there is a previous byte, that is */
229.1736 -            max = s->lookahead < MAX_MATCH ? s->lookahead : MAX_MATCH;
229.1737 -            scan = s->window + s->strstart - 1;
229.1738 -            prev = *scan++;
229.1739 -            do {
229.1740 -                if (*scan++ != prev)
229.1741 -                    break;
229.1742 -            } while (++run < max);
229.1743 -        }
229.1744 -
229.1745 -        /* Emit match if have run of MIN_MATCH or longer, else emit literal */
229.1746 -        if (run >= MIN_MATCH) {
229.1747 -            check_match(s, s->strstart, s->strstart - 1, run);
229.1748 -            _tr_tally_dist(s, 1, run - MIN_MATCH, bflush);
229.1749 -            s->lookahead -= run;
229.1750 -            s->strstart += run;
229.1751 -        } else {
229.1752 -            /* No match, output a literal byte */
229.1753 -            Tracevv((stderr,"%c", s->window[s->strstart]));
229.1754 -            _tr_tally_lit (s, s->window[s->strstart], bflush);
229.1755 -            s->lookahead--;
229.1756 -            s->strstart++;
229.1757 -        }
229.1758 -        if (bflush) FLUSH_BLOCK(s, 0);
229.1759 -    }
229.1760 -    FLUSH_BLOCK(s, flush == Z_FINISH);
229.1761 -    return flush == Z_FINISH ? finish_done : block_done;
229.1762 -}
229.1763 -#endif
   230.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/deflate.h	Tue Dec 06 16:31:58 2011 -0800
   230.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   230.3 @@ -1,355 +0,0 @@
   230.4 -/*
   230.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   230.6 - *
   230.7 - * This code is free software; you can redistribute it and/or modify it
   230.8 - * under the terms of the GNU General Public License version 2 only, as
   230.9 - * published by the Free Software Foundation.  Oracle designates this
  230.10 - * particular file as subject to the "Classpath" exception as provided
  230.11 - * by Oracle in the LICENSE file that accompanied this code.
  230.12 - *
  230.13 - * This code is distributed in the hope that it will be useful, but WITHOUT
  230.14 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  230.15 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  230.16 - * version 2 for more details (a copy is included in the LICENSE file that
  230.17 - * accompanied this code).
  230.18 - *
  230.19 - * You should have received a copy of the GNU General Public License version
  230.20 - * 2 along with this work; if not, write to the Free Software Foundation,
  230.21 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  230.22 - *
  230.23 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  230.24 - * or visit www.oracle.com if you need additional information or have any
  230.25 - * questions.
  230.26 - */
  230.27 -
  230.28 -/* deflate.h -- internal compression state
  230.29 - * Copyright (C) 1995-2004 Jean-loup Gailly
  230.30 - * For conditions of distribution and use, see copyright notice in zlib.h
  230.31 - */
  230.32 -
  230.33 -/* WARNING: this file should *not* be used by applications. It is
  230.34 -   part of the implementation of the compression library and is
  230.35 -   subject to change. Applications should only use zlib.h.
  230.36 - */
  230.37 -
  230.38 -/* @(#) $Id$ */
  230.39 -
  230.40 -#ifndef DEFLATE_H
  230.41 -#define DEFLATE_H
  230.42 -
  230.43 -#include "zutil.h"
  230.44 -
  230.45 -/* define NO_GZIP when compiling if you want to disable gzip header and
  230.46 -   trailer creation by deflate().  NO_GZIP would be used to avoid linking in
  230.47 -   the crc code when it is not needed.  For shared libraries, gzip encoding
  230.48 -   should be left enabled. */
  230.49 -#ifndef NO_GZIP
  230.50 -#  define GZIP
  230.51 -#endif
  230.52 -
  230.53 -/* ===========================================================================
  230.54 - * Internal compression state.
  230.55 - */
  230.56 -
  230.57 -#define LENGTH_CODES 29
  230.58 -/* number of length codes, not counting the special END_BLOCK code */
  230.59 -
  230.60 -#define LITERALS  256
  230.61 -/* number of literal bytes 0..255 */
  230.62 -
  230.63 -#define L_CODES (LITERALS+1+LENGTH_CODES)
  230.64 -/* number of Literal or Length codes, including the END_BLOCK code */
  230.65 -
  230.66 -#define D_CODES   30
  230.67 -/* number of distance codes */
  230.68 -
  230.69 -#define BL_CODES  19
  230.70 -/* number of codes used to transfer the bit lengths */
  230.71 -
  230.72 -#define HEAP_SIZE (2*L_CODES+1)
  230.73 -/* maximum heap size */
  230.74 -
  230.75 -#define MAX_BITS 15
  230.76 -/* All codes must not exceed MAX_BITS bits */
  230.77 -
  230.78 -#define INIT_STATE    42
  230.79 -#define EXTRA_STATE   69
  230.80 -#define NAME_STATE    73
  230.81 -#define COMMENT_STATE 91
  230.82 -#define HCRC_STATE   103
  230.83 -#define BUSY_STATE   113
  230.84 -#define FINISH_STATE 666
  230.85 -/* Stream status */
  230.86 -
  230.87 -
  230.88 -/* Data structure describing a single value and its code string. */
  230.89 -typedef struct ct_data_s {
  230.90 -    union {
  230.91 -        ush  freq;       /* frequency count */
  230.92 -        ush  code;       /* bit string */
  230.93 -    } fc;
  230.94 -    union {
  230.95 -        ush  dad;        /* father node in Huffman tree */
  230.96 -        ush  len;        /* length of bit string */
  230.97 -    } dl;
  230.98 -} FAR ct_data;
  230.99 -
 230.100 -#define Freq fc.freq
 230.101 -#define Code fc.code
 230.102 -#define Dad  dl.dad
 230.103 -#define Len  dl.len
 230.104 -
 230.105 -typedef struct static_tree_desc_s  static_tree_desc;
 230.106 -
 230.107 -typedef struct tree_desc_s {
 230.108 -    ct_data *dyn_tree;           /* the dynamic tree */
 230.109 -    int     max_code;            /* largest code with non zero frequency */
 230.110 -    static_tree_desc *stat_desc; /* the corresponding static tree */
 230.111 -} FAR tree_desc;
 230.112 -
 230.113 -typedef ush Pos;
 230.114 -typedef Pos FAR Posf;
 230.115 -typedef unsigned IPos;
 230.116 -
 230.117 -/* A Pos is an index in the character window. We use short instead of int to
 230.118 - * save space in the various tables. IPos is used only for parameter passing.
 230.119 - */
 230.120 -
 230.121 -typedef struct internal_state {
 230.122 -    z_streamp strm;      /* pointer back to this zlib stream */
 230.123 -    int   status;        /* as the name implies */
 230.124 -    Bytef *pending_buf;  /* output still pending */
 230.125 -    ulg   pending_buf_size; /* size of pending_buf */
 230.126 -    Bytef *pending_out;  /* next pending byte to output to the stream */
 230.127 -    uInt   pending;      /* nb of bytes in the pending buffer */
 230.128 -    int   wrap;          /* bit 0 true for zlib, bit 1 true for gzip */
 230.129 -    gz_headerp  gzhead;  /* gzip header information to write */
 230.130 -    uInt   gzindex;      /* where in extra, name, or comment */
 230.131 -    Byte  method;        /* STORED (for zip only) or DEFLATED */
 230.132 -    int   last_flush;    /* value of flush param for previous deflate call */
 230.133 -
 230.134 -                /* used by deflate.c: */
 230.135 -
 230.136 -    uInt  w_size;        /* LZ77 window size (32K by default) */
 230.137 -    uInt  w_bits;        /* log2(w_size)  (8..16) */
 230.138 -    uInt  w_mask;        /* w_size - 1 */
 230.139 -
 230.140 -    Bytef *window;
 230.141 -    /* Sliding window. Input bytes are read into the second half of the window,
 230.142 -     * and move to the first half later to keep a dictionary of at least wSize
 230.143 -     * bytes. With this organization, matches are limited to a distance of
 230.144 -     * wSize-MAX_MATCH bytes, but this ensures that IO is always
 230.145 -     * performed with a length multiple of the block size. Also, it limits
 230.146 -     * the window size to 64K, which is quite useful on MSDOS.
 230.147 -     * To do: use the user input buffer as sliding window.
 230.148 -     */
 230.149 -
 230.150 -    ulg window_size;
 230.151 -    /* Actual size of window: 2*wSize, except when the user input buffer
 230.152 -     * is directly used as sliding window.
 230.153 -     */
 230.154 -
 230.155 -    Posf *prev;
 230.156 -    /* Link to older string with same hash index. To limit the size of this
 230.157 -     * array to 64K, this link is maintained only for the last 32K strings.
 230.158 -     * An index in this array is thus a window index modulo 32K.
 230.159 -     */
 230.160 -
 230.161 -    Posf *head; /* Heads of the hash chains or NIL. */
 230.162 -
 230.163 -    uInt  ins_h;          /* hash index of string to be inserted */
 230.164 -    uInt  hash_size;      /* number of elements in hash table */
 230.165 -    uInt  hash_bits;      /* log2(hash_size) */
 230.166 -    uInt  hash_mask;      /* hash_size-1 */
 230.167 -
 230.168 -    uInt  hash_shift;
 230.169 -    /* Number of bits by which ins_h must be shifted at each input
 230.170 -     * step. It must be such that after MIN_MATCH steps, the oldest
 230.171 -     * byte no longer takes part in the hash key, that is:
 230.172 -     *   hash_shift * MIN_MATCH >= hash_bits
 230.173 -     */
 230.174 -
 230.175 -    long block_start;
 230.176 -    /* Window position at the beginning of the current output block. Gets
 230.177 -     * negative when the window is moved backwards.
 230.178 -     */
 230.179 -
 230.180 -    uInt match_length;           /* length of best match */
 230.181 -    IPos prev_match;             /* previous match */
 230.182 -    int match_available;         /* set if previous match exists */
 230.183 -    uInt strstart;               /* start of string to insert */
 230.184 -    uInt match_start;            /* start of matching string */
 230.185 -    uInt lookahead;              /* number of valid bytes ahead in window */
 230.186 -
 230.187 -    uInt prev_length;
 230.188 -    /* Length of the best match at previous step. Matches not greater than this
 230.189 -     * are discarded. This is used in the lazy match evaluation.
 230.190 -     */
 230.191 -
 230.192 -    uInt max_chain_length;
 230.193 -    /* To speed up deflation, hash chains are never searched beyond this
 230.194 -     * length.  A higher limit improves compression ratio but degrades the
 230.195 -     * speed.
 230.196 -     */
 230.197 -
 230.198 -    uInt max_lazy_match;
 230.199 -    /* Attempt to find a better match only when the current match is strictly
 230.200 -     * smaller than this value. This mechanism is used only for compression
 230.201 -     * levels >= 4.
 230.202 -     */
 230.203 -#   define max_insert_length  max_lazy_match
 230.204 -    /* Insert new strings in the hash table only if the match length is not
 230.205 -     * greater than this length. This saves time but degrades compression.
 230.206 -     * max_insert_length is used only for compression levels <= 3.
 230.207 -     */
 230.208 -
 230.209 -    int level;    /* compression level (1..9) */
 230.210 -    int strategy; /* favor or force Huffman coding*/
 230.211 -
 230.212 -    uInt good_match;
 230.213 -    /* Use a faster search when the previous match is longer than this */
 230.214 -
 230.215 -    int nice_match; /* Stop searching when current match exceeds this */
 230.216 -
 230.217 -                /* used by trees.c: */
 230.218 -    /* Didn't use ct_data typedef below to supress compiler warning */
 230.219 -    struct ct_data_s dyn_ltree[HEAP_SIZE];   /* literal and length tree */
 230.220 -    struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
 230.221 -    struct ct_data_s bl_tree[2*BL_CODES+1];  /* Huffman tree for bit lengths */
 230.222 -
 230.223 -    struct tree_desc_s l_desc;               /* desc. for literal tree */
 230.224 -    struct tree_desc_s d_desc;               /* desc. for distance tree */
 230.225 -    struct tree_desc_s bl_desc;              /* desc. for bit length tree */
 230.226 -
 230.227 -    ush bl_count[MAX_BITS+1];
 230.228 -    /* number of codes at each bit length for an optimal tree */
 230.229 -
 230.230 -    int heap[2*L_CODES+1];      /* heap used to build the Huffman trees */
 230.231 -    int heap_len;               /* number of elements in the heap */
 230.232 -    int heap_max;               /* element of largest frequency */
 230.233 -    /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
 230.234 -     * The same heap array is used to build all trees.
 230.235 -     */
 230.236 -
 230.237 -    uch depth[2*L_CODES+1];
 230.238 -    /* Depth of each subtree used as tie breaker for trees of equal frequency
 230.239 -     */
 230.240 -
 230.241 -    uchf *l_buf;          /* buffer for literals or lengths */
 230.242 -
 230.243 -    uInt  lit_bufsize;
 230.244 -    /* Size of match buffer for literals/lengths.  There are 4 reasons for
 230.245 -     * limiting lit_bufsize to 64K:
 230.246 -     *   - frequencies can be kept in 16 bit counters
 230.247 -     *   - if compression is not successful for the first block, all input
 230.248 -     *     data is still in the window so we can still emit a stored block even
 230.249 -     *     when input comes from standard input.  (This can also be done for
 230.250 -     *     all blocks if lit_bufsize is not greater than 32K.)
 230.251 -     *   - if compression is not successful for a file smaller than 64K, we can
 230.252 -     *     even emit a stored file instead of a stored block (saving 5 bytes).
 230.253 -     *     This is applicable only for zip (not gzip or zlib).
 230.254 -     *   - creating new Huffman trees less frequently may not provide fast
 230.255 -     *     adaptation to changes in the input data statistics. (Take for
 230.256 -     *     example a binary file with poorly compressible code followed by
 230.257 -     *     a highly compressible string table.) Smaller buffer sizes give
 230.258 -     *     fast adaptation but have of course the overhead of transmitting
 230.259 -     *     trees more frequently.
 230.260 -     *   - I can't count above 4
 230.261 -     */
 230.262 -
 230.263 -    uInt last_lit;      /* running index in l_buf */
 230.264 -
 230.265 -    ushf *d_buf;
 230.266 -    /* Buffer for distances. To simplify the code, d_buf and l_buf have
 230.267 -     * the same number of elements. To use different lengths, an extra flag
 230.268 -     * array would be necessary.
 230.269 -     */
 230.270 -
 230.271 -    ulg opt_len;        /* bit length of current block with optimal trees */
 230.272 -    ulg static_len;     /* bit length of current block with static trees */
 230.273 -    uInt matches;       /* number of string matches in current block */
 230.274 -    int last_eob_len;   /* bit length of EOB code for last block */
 230.275 -
 230.276 -#ifdef DEBUG
 230.277 -    ulg compressed_len; /* total bit length of compressed file mod 2^32 */
 230.278 -    ulg bits_sent;      /* bit length of compressed data sent mod 2^32 */
 230.279 -#endif
 230.280 -
 230.281 -    ush bi_buf;
 230.282 -    /* Output buffer. bits are inserted starting at the bottom (least
 230.283 -     * significant bits).
 230.284 -     */
 230.285 -    int bi_valid;
 230.286 -    /* Number of valid bits in bi_buf.  All bits above the last valid bit
 230.287 -     * are always zero.
 230.288 -     */
 230.289 -
 230.290 -} FAR deflate_state;
 230.291 -
 230.292 -/* Output a byte on the stream.
 230.293 - * IN assertion: there is enough room in pending_buf.
 230.294 - */
 230.295 -#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);}
 230.296 -
 230.297 -
 230.298 -#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
 230.299 -/* Minimum amount of lookahead, except at the end of the input file.
 230.300 - * See deflate.c for comments about the MIN_MATCH+1.
 230.301 - */
 230.302 -
 230.303 -#define MAX_DIST(s)  ((s)->w_size-MIN_LOOKAHEAD)
 230.304 -/* In order to simplify the code, particularly on 16 bit machines, match
 230.305 - * distances are limited to MAX_DIST instead of WSIZE.
 230.306 - */
 230.307 -
 230.308 -        /* in trees.c */
 230.309 -void _tr_init         OF((deflate_state *s));
 230.310 -int  _tr_tally        OF((deflate_state *s, unsigned dist, unsigned lc));
 230.311 -void _tr_flush_block  OF((deflate_state *s, charf *buf, ulg stored_len,
 230.312 -                          int eof));
 230.313 -void _tr_align        OF((deflate_state *s));
 230.314 -void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
 230.315 -                          int eof));
 230.316 -
 230.317 -#define d_code(dist) \
 230.318 -   ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
 230.319 -/* Mapping from a distance to a distance code. dist is the distance - 1 and
 230.320 - * must not have side effects. _dist_code[256] and _dist_code[257] are never
 230.321 - * used.
 230.322 - */
 230.323 -
 230.324 -#ifndef DEBUG
 230.325 -/* Inline versions of _tr_tally for speed: */
 230.326 -
 230.327 -#if defined(GEN_TREES_H) || !defined(STDC)
 230.328 -  extern uch _length_code[];
 230.329 -  extern uch _dist_code[];
 230.330 -#else
 230.331 -  extern const uch _length_code[];
 230.332 -  extern const uch _dist_code[];
 230.333 -#endif
 230.334 -
 230.335 -# define _tr_tally_lit(s, c, flush) \
 230.336 -  { uch cc = (c); \
 230.337 -    s->d_buf[s->last_lit] = 0; \
 230.338 -    s->l_buf[s->last_lit++] = cc; \
 230.339 -    s->dyn_ltree[cc].Freq++; \
 230.340 -    flush = (s->last_lit == s->lit_bufsize-1); \
 230.341 -   }
 230.342 -# define _tr_tally_dist(s, distance, length, flush) \
 230.343 -  { uch len = (length); \
 230.344 -    ush dist = (distance); \
 230.345 -    s->d_buf[s->last_lit] = dist; \
 230.346 -    s->l_buf[s->last_lit++] = len; \
 230.347 -    dist--; \
 230.348 -    s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
 230.349 -    s->dyn_dtree[d_code(dist)].Freq++; \
 230.350 -    flush = (s->last_lit == s->lit_bufsize-1); \
 230.351 -  }
 230.352 -#else
 230.353 -# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
 230.354 -# define _tr_tally_dist(s, distance, length, flush) \
 230.355 -              flush = _tr_tally(s, distance, length)
 230.356 -#endif
 230.357 -
 230.358 -#endif /* DEFLATE_H */
   231.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/gzio.c	Tue Dec 06 16:31:58 2011 -0800
   231.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   231.3 @@ -1,1050 +0,0 @@
   231.4 -/*
   231.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   231.6 - *
   231.7 - * This code is free software; you can redistribute it and/or modify it
   231.8 - * under the terms of the GNU General Public License version 2 only, as
   231.9 - * published by the Free Software Foundation.  Oracle designates this
  231.10 - * particular file as subject to the "Classpath" exception as provided
  231.11 - * by Oracle in the LICENSE file that accompanied this code.
  231.12 - *
  231.13 - * This code is distributed in the hope that it will be useful, but WITHOUT
  231.14 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  231.15 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  231.16 - * version 2 for more details (a copy is included in the LICENSE file that
  231.17 - * accompanied this code).
  231.18 - *
  231.19 - * You should have received a copy of the GNU General Public License version
  231.20 - * 2 along with this work; if not, write to the Free Software Foundation,
  231.21 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  231.22 - *
  231.23 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  231.24 - * or visit www.oracle.com if you need additional information or have any
  231.25 - * questions.
  231.26 - */
  231.27 -
  231.28 -/* gzio.c -- IO on .gz files
  231.29 - * Copyright (C) 1995-2005 Jean-loup Gailly.
  231.30 - * For conditions of distribution and use, see copyright notice in zlib.h
  231.31 - *
  231.32 - * Compile this file with -DNO_GZCOMPRESS to avoid the compression code.
  231.33 - */
  231.34 -
  231.35 -/* @(#) $Id$ */
  231.36 -
  231.37 -#include <stdio.h>
  231.38 -
  231.39 -#include "zutil.h"
  231.40 -
  231.41 -#ifdef NO_DEFLATE       /* for compatibility with old definition */
  231.42 -#  define NO_GZCOMPRESS
  231.43 -#endif
  231.44 -
  231.45 -#ifndef NO_DUMMY_DECL
  231.46 -struct internal_state {int dummy;}; /* for buggy compilers */
  231.47 -#endif
  231.48 -
  231.49 -#ifndef Z_BUFSIZE
  231.50 -#  ifdef MAXSEG_64K
  231.51 -#    define Z_BUFSIZE 4096 /* minimize memory usage for 16-bit DOS */
  231.52 -#  else
  231.53 -#    define Z_BUFSIZE 16384
  231.54 -#  endif
  231.55 -#endif
  231.56 -#ifndef Z_PRINTF_BUFSIZE
  231.57 -#  define Z_PRINTF_BUFSIZE 4096
  231.58 -#endif
  231.59 -
  231.60 -#ifdef __MVS__
  231.61 -#  pragma map (fdopen , "\174\174FDOPEN")
  231.62 -   FILE *fdopen(int, const char *);
  231.63 -#endif
  231.64 -
  231.65 -#ifndef STDC
  231.66 -extern voidp  malloc OF((uInt size));
  231.67 -extern void   free   OF((voidpf ptr));
  231.68 -#endif
  231.69 -
  231.70 -#define ALLOC(size) malloc(size)
  231.71 -#define TRYFREE(p) {if (p) free(p);}
  231.72 -
  231.73 -static int const gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */
  231.74 -
  231.75 -/* gzip flag byte */
  231.76 -#define ASCII_FLAG   0x01 /* bit 0 set: file probably ascii text */
  231.77 -#define HEAD_CRC     0x02 /* bit 1 set: header CRC present */
  231.78 -#define EXTRA_FIELD  0x04 /* bit 2 set: extra field present */
  231.79 -#define ORIG_NAME    0x08 /* bit 3 set: original file name present */
  231.80 -#define COMMENT      0x10 /* bit 4 set: file comment present */
  231.81 -#define RESERVED     0xE0 /* bits 5..7: reserved */
  231.82 -
  231.83 -typedef struct gz_stream {
  231.84 -    z_stream stream;
  231.85 -    int      z_err;   /* error code for last stream operation */
  231.86 -    int      z_eof;   /* set if end of input file */
  231.87 -    FILE     *file;   /* .gz file */
  231.88 -    Byte     *inbuf;  /* input buffer */
  231.89 -    Byte     *outbuf; /* output buffer */
  231.90 -    uLong    crc;     /* crc32 of uncompressed data */
  231.91 -    char     *msg;    /* error message */
  231.92 -    char     *path;   /* path name for debugging only */
  231.93 -    int      transparent; /* 1 if input file is not a .gz file */
  231.94 -    char     mode;    /* 'w' or 'r' */
  231.95 -    z_off_t  start;   /* start of compressed data in file (header skipped) */
  231.96 -    z_off_t  in;      /* bytes into deflate or inflate */
  231.97 -    z_off_t  out;     /* bytes out of deflate or inflate */
  231.98 -    int      back;    /* one character push-back */
  231.99 -    int      last;    /* true if push-back is last character */
 231.100 -} gz_stream;
 231.101 -
 231.102 -
 231.103 -local gzFile gz_open      OF((const char *path, const char *mode, int  fd));
 231.104 -local int do_flush        OF((gzFile file, int flush));
 231.105 -local int    get_byte     OF((gz_stream *s));
 231.106 -local void   check_header OF((gz_stream *s));
 231.107 -local int    destroy      OF((gz_stream *s));
 231.108 -local void   putLong      OF((FILE *file, uLong x));
 231.109 -local uLong  getLong      OF((gz_stream *s));
 231.110 -
 231.111 -/* ===========================================================================
 231.112 -     Opens a gzip (.gz) file for reading or writing. The mode parameter
 231.113 -   is as in fopen ("rb" or "wb"). The file is given either by file descriptor
 231.114 -   or path name (if fd == -1).
 231.115 -     gz_open returns NULL if the file could not be opened or if there was
 231.116 -   insufficient memory to allocate the (de)compression state; errno
 231.117 -   can be checked to distinguish the two cases (if errno is zero, the
 231.118 -   zlib error is Z_MEM_ERROR).
 231.119 -*/
 231.120 -local gzFile gz_open (path, mode, fd)
 231.121 -    const char *path;
 231.122 -    const char *mode;
 231.123 -    int  fd;
 231.124 -{
 231.125 -    int err;
 231.126 -    int level = Z_DEFAULT_COMPRESSION; /* compression level */
 231.127 -    int strategy = Z_DEFAULT_STRATEGY; /* compression strategy */
 231.128 -    char *p = (char*)mode;
 231.129 -    gz_stream *s;
 231.130 -    char fmode[80]; /* copy of mode, without the compression level */
 231.131 -    char *m = fmode;
 231.132 -
 231.133 -    if (!path || !mode) return Z_NULL;
 231.134 -
 231.135 -    s = (gz_stream *)ALLOC(sizeof(gz_stream));
 231.136 -    if (!s) return Z_NULL;
 231.137 -
 231.138 -    s->stream.zalloc = (alloc_func)0;
 231.139 -    s->stream.zfree = (free_func)0;
 231.140 -    s->stream.opaque = (voidpf)0;
 231.141 -    s->stream.next_in = s->inbuf = Z_NULL;
 231.142 -    s->stream.next_out = s->outbuf = Z_NULL;
 231.143 -    s->stream.avail_in = s->stream.avail_out = 0;
 231.144 -    s->file = NULL;
 231.145 -    s->z_err = Z_OK;
 231.146 -    s->z_eof = 0;
 231.147 -    s->in = 0;
 231.148 -    s->out = 0;
 231.149 -    s->back = EOF;
 231.150 -    s->crc = crc32(0L, Z_NULL, 0);
 231.151 -    s->msg = NULL;
 231.152 -    s->transparent = 0;
 231.153 -
 231.154 -    s->path = (char*)ALLOC(strlen(path)+1);
 231.155 -    if (s->path == NULL) {
 231.156 -        return destroy(s), (gzFile)Z_NULL;
 231.157 -    }
 231.158 -    strcpy(s->path, path); /* do this early for debugging */
 231.159 -
 231.160 -    s->mode = '\0';
 231.161 -    do {
 231.162 -        if (*p == 'r') s->mode = 'r';
 231.163 -        if (*p == 'w' || *p == 'a') s->mode = 'w';
 231.164 -        if (*p >= '0' && *p <= '9') {
 231.165 -            level = *p - '0';
 231.166 -        } else if (*p == 'f') {
 231.167 -          strategy = Z_FILTERED;
 231.168 -        } else if (*p == 'h') {
 231.169 -          strategy = Z_HUFFMAN_ONLY;
 231.170 -        } else if (*p == 'R') {
 231.171 -          strategy = Z_RLE;
 231.172 -        } else {
 231.173 -            *m++ = *p; /* copy the mode */
 231.174 -        }
 231.175 -    } while (*p++ && m != fmode + sizeof(fmode));
 231.176 -    if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL;
 231.177 -
 231.178 -    if (s->mode == 'w') {
 231.179 -#ifdef NO_GZCOMPRESS
 231.180 -        err = Z_STREAM_ERROR;
 231.181 -#else
 231.182 -        err = deflateInit2(&(s->stream), level,
 231.183 -                           Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, strategy);
 231.184 -        /* windowBits is passed < 0 to suppress zlib header */
 231.185 -
 231.186 -        s->stream.next_out = s->outbuf = (Byte*)ALLOC(Z_BUFSIZE);
 231.187 -#endif
 231.188 -        if (err != Z_OK || s->outbuf == Z_NULL) {
 231.189 -            return destroy(s), (gzFile)Z_NULL;
 231.190 -        }
 231.191 -    } else {
 231.192 -        s->stream.next_in  = s->inbuf = (Byte*)ALLOC(Z_BUFSIZE);
 231.193 -
 231.194 -        err = inflateInit2(&(s->stream), -MAX_WBITS);
 231.195 -        /* windowBits is passed < 0 to tell that there is no zlib header.
 231.196 -         * Note that in this case inflate *requires* an extra "dummy" byte
 231.197 -         * after the compressed stream in order to complete decompression and
 231.198 -         * return Z_STREAM_END. Here the gzip CRC32 ensures that 4 bytes are
 231.199 -         * present after the compressed stream.
 231.200 -         */
 231.201 -        if (err != Z_OK || s->inbuf == Z_NULL) {
 231.202 -            return destroy(s), (gzFile)Z_NULL;
 231.203 -        }
 231.204 -    }
 231.205 -    s->stream.avail_out = Z_BUFSIZE;
 231.206 -
 231.207 -    errno = 0;
 231.208 -    s->file = fd < 0 ? F_OPEN(path, fmode) : (FILE*)fdopen(fd, fmode);
 231.209 -
 231.210 -    if (s->file == NULL) {
 231.211 -        return destroy(s), (gzFile)Z_NULL;
 231.212 -    }
 231.213 -    if (s->mode == 'w') {
 231.214 -        /* Write a very simple .gz header:
 231.215 -         */
 231.216 -        fprintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1],
 231.217 -             Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE);
 231.218 -        s->start = 10L;
 231.219 -        /* We use 10L instead of ftell(s->file) to because ftell causes an
 231.220 -         * fflush on some systems. This version of the library doesn't use
 231.221 -         * start anyway in write mode, so this initialization is not
 231.222 -         * necessary.
 231.223 -         */
 231.224 -    } else {
 231.225 -        check_header(s); /* skip the .gz header */
 231.226 -        s->start = ftell(s->file) - s->stream.avail_in;
 231.227 -    }
 231.228 -
 231.229 -    return (gzFile)s;
 231.230 -}
 231.231 -
 231.232 -/* ===========================================================================
 231.233 -     Opens a gzip (.gz) file for reading or writing.
 231.234 -*/
 231.235 -gzFile ZEXPORT gzopen (path, mode)
 231.236 -    const char *path;
 231.237 -    const char *mode;
 231.238 -{
 231.239 -    return gz_open (path, mode, -1);
 231.240 -}
 231.241 -
 231.242 -/* ===========================================================================
 231.243 -     Associate a gzFile with the file descriptor fd. fd is not dup'ed here
 231.244 -   to mimic the behavio(u)r of fdopen.
 231.245 -*/
 231.246 -gzFile ZEXPORT gzdopen (fd, mode)
 231.247 -    int fd;
 231.248 -    const char *mode;
 231.249 -{
 231.250 -    char name[46];      /* allow for up to 128-bit integers */
 231.251 -
 231.252 -    if (fd < 0) return (gzFile)Z_NULL;
 231.253 -    sprintf(name, "<fd:%d>", fd); /* for debugging */
 231.254 -
 231.255 -    return gz_open (name, mode, fd);
 231.256 -}
 231.257 -
 231.258 -/* ===========================================================================
 231.259 - * Update the compression level and strategy
 231.260 - */
 231.261 -int ZEXPORT gzsetparams (file, level, strategy)
 231.262 -    gzFile file;
 231.263 -    int level;
 231.264 -    int strategy;
 231.265 -{
 231.266 -    gz_stream *s = (gz_stream*)file;
 231.267 -
 231.268 -    if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
 231.269 -
 231.270 -    /* Make room to allow flushing */
 231.271 -    if (s->stream.avail_out == 0) {
 231.272 -
 231.273 -        s->stream.next_out = s->outbuf;
 231.274 -        if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) {
 231.275 -            s->z_err = Z_ERRNO;
 231.276 -        }
 231.277 -        s->stream.avail_out = Z_BUFSIZE;
 231.278 -    }
 231.279 -
 231.280 -    return deflateParams (&(s->stream), level, strategy);
 231.281 -}
 231.282 -
 231.283 -/* ===========================================================================
 231.284 -     Read a byte from a gz_stream; update next_in and avail_in. Return EOF
 231.285 -   for end of file.
 231.286 -   IN assertion: the stream s has been sucessfully opened for reading.
 231.287 -*/
 231.288 -local int get_byte(s)
 231.289 -    gz_stream *s;
 231.290 -{
 231.291 -    if (s->z_eof) return EOF;
 231.292 -    if (s->stream.avail_in == 0) {
 231.293 -        errno = 0;
 231.294 -        s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file);
 231.295 -        if (s->stream.avail_in == 0) {
 231.296 -            s->z_eof = 1;
 231.297 -            if (ferror(s->file)) s->z_err = Z_ERRNO;
 231.298 -            return EOF;
 231.299 -        }
 231.300 -        s->stream.next_in = s->inbuf;
 231.301 -    }
 231.302 -    s->stream.avail_in--;
 231.303 -    return *(s->stream.next_in)++;
 231.304 -}
 231.305 -
 231.306 -/* ===========================================================================
 231.307 -      Check the gzip header of a gz_stream opened for reading. Set the stream
 231.308 -    mode to transparent if the gzip magic header is not present; set s->err
 231.309 -    to Z_DATA_ERROR if the magic header is present but the rest of the header
 231.310 -    is incorrect.
 231.311 -    IN assertion: the stream s has already been created sucessfully;
 231.312 -       s->stream.avail_in is zero for the first time, but may be non-zero
 231.313 -       for concatenated .gz files.
 231.314 -*/
 231.315 -local void check_header(s)
 231.316 -    gz_stream *s;
 231.317 -{
 231.318 -    int method; /* method byte */
 231.319 -    int flags;  /* flags byte */
 231.320 -    uInt len;
 231.321 -    int c;
 231.322 -
 231.323 -    /* Assure two bytes in the buffer so we can peek ahead -- handle case
 231.324 -       where first byte of header is at the end of the buffer after the last
 231.325 -       gzip segment */
 231.326 -    len = s->stream.avail_in;
 231.327 -    if (len < 2) {
 231.328 -        if (len) s->inbuf[0] = s->stream.next_in[0];
 231.329 -        errno = 0;
 231.330 -        len = (uInt)fread(s->inbuf + len, 1, Z_BUFSIZE >> len, s->file);
 231.331 -        if (len == 0 && ferror(s->file)) s->z_err = Z_ERRNO;
 231.332 -        s->stream.avail_in += len;
 231.333 -        s->stream.next_in = s->inbuf;
 231.334 -        if (s->stream.avail_in < 2) {
 231.335 -            s->transparent = s->stream.avail_in;
 231.336 -            return;
 231.337 -        }
 231.338 -    }
 231.339 -
 231.340 -    /* Peek ahead to check the gzip magic header */
 231.341 -    if (s->stream.next_in[0] != gz_magic[0] ||
 231.342 -        s->stream.next_in[1] != gz_magic[1]) {
 231.343 -        s->transparent = 1;
 231.344 -        return;
 231.345 -    }
 231.346 -    s->stream.avail_in -= 2;
 231.347 -    s->stream.next_in += 2;
 231.348 -
 231.349 -    /* Check the rest of the gzip header */
 231.350 -    method = get_byte(s);
 231.351 -    flags = get_byte(s);
 231.352 -    if (method != Z_DEFLATED || (flags & RESERVED) != 0) {
 231.353 -        s->z_err = Z_DATA_ERROR;
 231.354 -        return;
 231.355 -    }
 231.356 -
 231.357 -    /* Discard time, xflags and OS code: */
 231.358 -    for (len = 0; len < 6; len++) (void)get_byte(s);
 231.359 -
 231.360 -    if ((flags & EXTRA_FIELD) != 0) { /* skip the extra field */
 231.361 -        len  =  (uInt)get_byte(s);
 231.362 -        len += ((uInt)get_byte(s))<<8;
 231.363 -        /* len is garbage if EOF but the loop below will quit anyway */
 231.364 -        while (len-- != 0 && get_byte(s) != EOF) ;
 231.365 -    }
 231.366 -    if ((flags & ORIG_NAME) != 0) { /* skip the original file name */
 231.367 -        while ((c = get_byte(s)) != 0 && c != EOF) ;
 231.368 -    }
 231.369 -    if ((flags & COMMENT) != 0) {   /* skip the .gz file comment */
 231.370 -        while ((c = get_byte(s)) != 0 && c != EOF) ;
 231.371 -    }
 231.372 -    if ((flags & HEAD_CRC) != 0) {  /* skip the header crc */
 231.373 -        for (len = 0; len < 2; len++) (void)get_byte(s);
 231.374 -    }
 231.375 -    s->z_err = s->z_eof ? Z_DATA_ERROR : Z_OK;
 231.376 -}
 231.377 -
 231.378 - /* ===========================================================================
 231.379 - * Cleanup then free the given gz_stream. Return a zlib error code.
 231.380 -   Try freeing in the reverse order of allocations.
 231.381 - */
 231.382 -local int destroy (s)
 231.383 -    gz_stream *s;
 231.384 -{
 231.385 -    int err = Z_OK;
 231.386 -
 231.387 -    if (!s) return Z_STREAM_ERROR;
 231.388 -
 231.389 -    TRYFREE(s->msg);
 231.390 -
 231.391 -    if (s->stream.state != NULL) {
 231.392 -        if (s->mode == 'w') {
 231.393 -#ifdef NO_GZCOMPRESS
 231.394 -            err = Z_STREAM_ERROR;
 231.395 -#else
 231.396 -            err = deflateEnd(&(s->stream));
 231.397 -#endif
 231.398 -        } else if (s->mode == 'r') {
 231.399 -            err = inflateEnd(&(s->stream));
 231.400 -        }
 231.401 -    }
 231.402 -    if (s->file != NULL && fclose(s->file)) {
 231.403 -#ifdef ESPIPE
 231.404 -        if (errno != ESPIPE) /* fclose is broken for pipes in HP/UX */
 231.405 -#endif
 231.406 -            err = Z_ERRNO;
 231.407 -    }
 231.408 -    if (s->z_err < 0) err = s->z_err;
 231.409 -
 231.410 -    TRYFREE(s->inbuf);
 231.411 -    TRYFREE(s->outbuf);
 231.412 -    TRYFREE(s->path);
 231.413 -    TRYFREE(s);
 231.414 -    return err;
 231.415 -}
 231.416 -
 231.417 -/* ===========================================================================
 231.418 -     Reads the given number of uncompressed bytes from the compressed file.
 231.419 -   gzread returns the number of bytes actually read (0 for end of file).
 231.420 -*/
 231.421 -int ZEXPORT gzread (file, buf, len)
 231.422 -    gzFile file;
 231.423 -    voidp buf;
 231.424 -    unsigned len;
 231.425 -{
 231.426 -    gz_stream *s = (gz_stream*)file;
 231.427 -    Bytef *start = (Bytef*)buf; /* starting point for crc computation */
 231.428 -    Byte  *next_out; /* == stream.next_out but not forced far (for MSDOS) */
 231.429 -
 231.430 -    if (s == NULL || s->mode != 'r') return Z_STREAM_ERROR;
 231.431 -
 231.432 -    if (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO) return -1;
 231.433 -    if (s->z_err == Z_STREAM_END) return 0;  /* EOF */
 231.434 -
 231.435 -    next_out = (Byte*)buf;
 231.436 -    s->stream.next_out = (Bytef*)buf;
 231.437 -    s->stream.avail_out = len;
 231.438 -
 231.439 -    if (s->stream.avail_out && s->back != EOF) {
 231.440 -        *next_out++ = s->back;
 231.441 -        s->stream.next_out++;
 231.442 -        s->stream.avail_out--;
 231.443 -        s->back = EOF;
 231.444 -        s->out++;
 231.445 -        start++;
 231.446 -        if (s->last) {
 231.447 -            s->z_err = Z_STREAM_END;
 231.448 -            return 1;
 231.449 -        }
 231.450 -    }
 231.451 -
 231.452 -    while (s->stream.avail_out != 0) {
 231.453 -
 231.454 -        if (s->transparent) {
 231.455 -            /* Copy first the lookahead bytes: */
 231.456 -            uInt n = s->stream.avail_in;
 231.457 -            if (n > s->stream.avail_out) n = s->stream.avail_out;
 231.458 -            if (n > 0) {
 231.459 -                zmemcpy(s->stream.next_out, s->stream.next_in, n);
 231.460 -                next_out += n;
 231.461 -                s->stream.next_out = next_out;
 231.462 -                s->stream.next_in   += n;
 231.463 -                s->stream.avail_out -= n;
 231.464 -                s->stream.avail_in  -= n;
 231.465 -            }
 231.466 -            if (s->stream.avail_out > 0) {
 231.467 -                s->stream.avail_out -=
 231.468 -                    (uInt)fread(next_out, 1, s->stream.avail_out, s->file);
 231.469 -            }
 231.470 -            len -= s->stream.avail_out;
 231.471 -            s->in  += len;
 231.472 -            s->out += len;
 231.473 -            if (len == 0) s->z_eof = 1;
 231.474 -            return (int)len;
 231.475 -        }
 231.476 -        if (s->stream.avail_in == 0 && !s->z_eof) {
 231.477 -
 231.478 -            errno = 0;
 231.479 -            s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file);
 231.480 -            if (s->stream.avail_in == 0) {
 231.481 -                s->z_eof = 1;
 231.482 -                if (ferror(s->file)) {
 231.483 -                    s->z_err = Z_ERRNO;
 231.484 -                    break;
 231.485 -                }
 231.486 -            }
 231.487 -            s->stream.next_in = s->inbuf;
 231.488 -        }
 231.489 -        s->in += s->stream.avail_in;
 231.490 -        s->out += s->stream.avail_out;
 231.491 -        s->z_err = inflate(&(s->stream), Z_NO_FLUSH);
 231.492 -        s->in -= s->stream.avail_in;
 231.493 -        s->out -= s->stream.avail_out;
 231.494 -
 231.495 -        if (s->z_err == Z_STREAM_END) {
 231.496 -            /* Check CRC and original size */
 231.497 -            s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
 231.498 -            start = s->stream.next_out;
 231.499 -
 231.500 -            if (getLong(s) != s->crc) {
 231.501 -                s->z_err = Z_DATA_ERROR;
 231.502 -            } else {
 231.503 -                (void)getLong(s);
 231.504 -                /* The uncompressed length returned by above getlong() may be
 231.505 -                 * different from s->out in case of concatenated .gz files.
 231.506 -                 * Check for such files:
 231.507 -                 */
 231.508 -                check_header(s);
 231.509 -                if (s->z_err == Z_OK) {
 231.510 -                    inflateReset(&(s->stream));
 231.511 -                    s->crc = crc32(0L, Z_NULL, 0);
 231.512 -                }
 231.513 -            }
 231.514 -        }
 231.515 -        if (s->z_err != Z_OK || s->z_eof) break;
 231.516 -    }
 231.517 -    s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
 231.518 -
 231.519 -    if (len == s->stream.avail_out &&
 231.520 -        (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO))
 231.521 -        return -1;
 231.522 -    return (int)(len - s->stream.avail_out);
 231.523 -}
 231.524 -
 231.525 -
 231.526 -/* ===========================================================================
 231.527 -      Reads one byte from the compressed file. gzgetc returns this byte
 231.528 -   or -1 in case of end of file or error.
 231.529 -*/
 231.530 -int ZEXPORT gzgetc(file)
 231.531 -    gzFile file;
 231.532 -{
 231.533 -    unsigned char c;
 231.534 -
 231.535 -    return gzread(file, &c, 1) == 1 ? c : -1;
 231.536 -}
 231.537 -
 231.538 -
 231.539 -/* ===========================================================================
 231.540 -      Push one byte back onto the stream.
 231.541 -*/
 231.542 -int ZEXPORT gzungetc(c, file)
 231.543 -    int c;
 231.544 -    gzFile file;
 231.545 -{
 231.546 -    gz_stream *s = (gz_stream*)file;
 231.547 -
 231.548 -    if (s == NULL || s->mode != 'r' || c == EOF || s->back != EOF) return EOF;
 231.549 -    s->back = c;
 231.550 -    s->out--;
 231.551 -    s->last = (s->z_err == Z_STREAM_END);
 231.552 -    if (s->last) s->z_err = Z_OK;
 231.553 -    s->z_eof = 0;
 231.554 -    return c;
 231.555 -}
 231.556 -
 231.557 -
 231.558 -/* ===========================================================================
 231.559 -      Reads bytes from the compressed file until len-1 characters are
 231.560 -   read, or a newline character is read and transferred to buf, or an
 231.561 -   end-of-file condition is encountered.  The string is then terminated
 231.562 -   with a null character.
 231.563 -      gzgets returns buf, or Z_NULL in case of error.
 231.564 -
 231.565 -      The current implementation is not optimized at all.
 231.566 -*/
 231.567 -char * ZEXPORT gzgets(file, buf, len)
 231.568 -    gzFile file;
 231.569 -    char *buf;
 231.570 -    int len;
 231.571 -{
 231.572 -    char *b = buf;
 231.573 -    if (buf == Z_NULL || len <= 0) return Z_NULL;
 231.574 -
 231.575 -    while (--len > 0 && gzread(file, buf, 1) == 1 && *buf++ != '\n') ;
 231.576 -    *buf = '\0';
 231.577 -    return b == buf && len > 0 ? Z_NULL : b;
 231.578 -}
 231.579 -
 231.580 -
 231.581 -#ifndef NO_GZCOMPRESS
 231.582 -/* ===========================================================================
 231.583 -     Writes the given number of uncompressed bytes into the compressed file.
 231.584 -   gzwrite returns the number of bytes actually written (0 in case of error).
 231.585 -*/
 231.586 -int ZEXPORT gzwrite (file, buf, len)
 231.587 -    gzFile file;
 231.588 -    voidpc buf;
 231.589 -    unsigned len;
 231.590 -{
 231.591 -    gz_stream *s = (gz_stream*)file;
 231.592 -
 231.593 -    if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
 231.594 -
 231.595 -    s->stream.next_in = (Bytef*)buf;
 231.596 -    s->stream.avail_in = len;
 231.597 -
 231.598 -    while (s->stream.avail_in != 0) {
 231.599 -
 231.600 -        if (s->stream.avail_out == 0) {
 231.601 -
 231.602 -            s->stream.next_out = s->outbuf;
 231.603 -            if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) {
 231.604 -                s->z_err = Z_ERRNO;
 231.605 -                break;
 231.606 -            }
 231.607 -            s->stream.avail_out = Z_BUFSIZE;
 231.608 -        }
 231.609 -        s->in += s->stream.avail_in;
 231.610 -        s->out += s->stream.avail_out;
 231.611 -        s->z_err = deflate(&(s->stream), Z_NO_FLUSH);
 231.612 -        s->in -= s->stream.avail_in;
 231.613 -        s->out -= s->stream.avail_out;
 231.614 -        if (s->z_err != Z_OK) break;
 231.615 -    }
 231.616 -    s->crc = crc32(s->crc, (const Bytef *)buf, len);
 231.617 -
 231.618 -    return (int)(len - s->stream.avail_in);
 231.619 -}
 231.620 -
 231.621 -
 231.622 -/* ===========================================================================
 231.623 -     Converts, formats, and writes the args to the compressed file under
 231.624 -   control of the format string, as in fprintf. gzprintf returns the number of
 231.625 -   uncompressed bytes actually written (0 in case of error).
 231.626 -*/
 231.627 -#ifdef STDC
 231.628 -#include <stdarg.h>
 231.629 -
 231.630 -int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...)
 231.631 -{
 231.632 -    char buf[Z_PRINTF_BUFSIZE];
 231.633 -    va_list va;
 231.634 -    int len;
 231.635 -
 231.636 -    buf[sizeof(buf) - 1] = 0;
 231.637 -    va_start(va, format);
 231.638 -#ifdef NO_vsnprintf
 231.639 -#  ifdef HAS_vsprintf_void
 231.640 -    (void)vsprintf(buf, format, va);
 231.641 -    va_end(va);
 231.642 -    for (len = 0; len < sizeof(buf); len++)
 231.643 -        if (buf[len] == 0) break;
 231.644 -#  else
 231.645 -    len = vsprintf(buf, format, va);
 231.646 -    va_end(va);
 231.647 -#  endif
 231.648 -#else
 231.649 -#  ifdef HAS_vsnprintf_void
 231.650 -    (void)vsnprintf(buf, sizeof(buf), format, va);
 231.651 -    va_end(va);
 231.652 -    len = strlen(buf);
 231.653 -#  else
 231.654 -    len = vsnprintf(buf, sizeof(buf), format, va);
 231.655 -    va_end(va);
 231.656 -#  endif
 231.657 -#endif
 231.658 -    if (len <= 0 || len >= (int)sizeof(buf) || buf[sizeof(buf) - 1] != 0)
 231.659 -        return 0;
 231.660 -    return gzwrite(file, buf, (unsigned)len);
 231.661 -}
 231.662 -#else /* not ANSI C */
 231.663 -
 231.664 -int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
 231.665 -                       a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
 231.666 -    gzFile file;
 231.667 -    const char *format;
 231.668 -    int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
 231.669 -        a11, a12, a13, a14, a15, a16, a17, a18, a19, a20;
 231.670 -{
 231.671 -    char buf[Z_PRINTF_BUFSIZE];
 231.672 -    int len;
 231.673 -
 231.674 -    buf[sizeof(buf) - 1] = 0;
 231.675 -#ifdef NO_snprintf
 231.676 -#  ifdef HAS_sprintf_void
 231.677 -    sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8,
 231.678 -            a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
 231.679 -    for (len = 0; len < sizeof(buf); len++)
 231.680 -        if (buf[len] == 0) break;
 231.681 -#  else
 231.682 -    len = sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8,
 231.683 -                a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
 231.684 -#  endif
 231.685 -#else
 231.686 -#  ifdef HAS_snprintf_void
 231.687 -    snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8,
 231.688 -             a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
 231.689 -    len = strlen(buf);
 231.690 -#  else
 231.691 -    len = snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8,
 231.692 -                 a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
 231.693 -#  endif
 231.694 -#endif
 231.695 -    if (len <= 0 || len >= sizeof(buf) || buf[sizeof(buf) - 1] != 0)
 231.696 -        return 0;
 231.697 -    return gzwrite(file, buf, len);
 231.698 -}
 231.699 -#endif
 231.700 -
 231.701 -/* ===========================================================================
 231.702 -      Writes c, converted to an unsigned char, into the compressed file.
 231.703 -   gzputc returns the value that was written, or -1 in case of error.
 231.704 -*/
 231.705 -int ZEXPORT gzputc(file, c)
 231.706 -    gzFile file;
 231.707 -    int c;
 231.708 -{
 231.709 -    unsigned char cc = (unsigned char) c; /* required for big endian systems */
 231.710 -
 231.711 -    return gzwrite(file, &cc, 1) == 1 ? (int)cc : -1;
 231.712 -}
 231.713 -
 231.714 -
 231.715 -/* ===========================================================================
 231.716 -      Writes the given null-terminated string to the compressed file, excluding
 231.717 -   the terminating null character.
 231.718 -      gzputs returns the number of characters written, or -1 in case of error.
 231.719 -*/
 231.720 -int ZEXPORT gzputs(file, s)
 231.721 -    gzFile file;
 231.722 -    const char *s;
 231.723 -{
 231.724 -    return gzwrite(file, (char*)s, (unsigned)strlen(s));
 231.725 -}
 231.726 -
 231.727 -
 231.728 -/* ===========================================================================
 231.729 -     Flushes all pending output into the compressed file. The parameter
 231.730 -   flush is as in the deflate() function.
 231.731 -*/
 231.732 -local int do_flush (file, flush)
 231.733 -    gzFile file;
 231.734 -    int flush;
 231.735 -{
 231.736 -    uInt len;
 231.737 -    int done = 0;
 231.738 -    gz_stream *s = (gz_stream*)file;
 231.739 -
 231.740 -    if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
 231.741 -
 231.742 -    s->stream.avail_in = 0; /* should be zero already anyway */
 231.743 -
 231.744 -    for (;;) {
 231.745 -        len = Z_BUFSIZE - s->stream.avail_out;
 231.746 -
 231.747 -        if (len != 0) {
 231.748 -            if ((uInt)fwrite(s->outbuf, 1, len, s->file) != len) {
 231.749 -                s->z_err = Z_ERRNO;
 231.750 -                return Z_ERRNO;
 231.751 -            }
 231.752 -            s->stream.next_out = s->outbuf;
 231.753 -            s->stream.avail_out = Z_BUFSIZE;
 231.754 -        }
 231.755 -        if (done) break;
 231.756 -        s->out += s->stream.avail_out;
 231.757 -        s->z_err = deflate(&(s->stream), flush);
 231.758 -        s->out -= s->stream.avail_out;
 231.759 -
 231.760 -        /* Ignore the second of two consecutive flushes: */
 231.761 -        if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK;
 231.762 -
 231.763 -        /* deflate has finished flushing only when it hasn't used up
 231.764 -         * all the available space in the output buffer:
 231.765 -         */
 231.766 -        done = (s->stream.avail_out != 0 || s->z_err == Z_STREAM_END);
 231.767 -
 231.768 -        if (s->z_err != Z_OK && s->z_err != Z_STREAM_END) break;
 231.769 -    }
 231.770 -    return  s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
 231.771 -}
 231.772 -
 231.773 -int ZEXPORT gzflush (file, flush)
 231.774 -     gzFile file;
 231.775 -     int flush;
 231.776 -{
 231.777 -    gz_stream *s = (gz_stream*)file;
 231.778 -    int err = do_flush (file, flush);
 231.779 -
 231.780 -    if (err) return err;
 231.781 -    fflush(s->file);
 231.782 -    return  s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
 231.783 -}
 231.784 -#endif /* NO_GZCOMPRESS */
 231.785 -
 231.786 -/* ===========================================================================
 231.787 -      Sets the starting position for the next gzread or gzwrite on the given
 231.788 -   compressed file. The offset represents a number of bytes in the
 231.789 -      gzseek returns the resulting offset location as measured in bytes from
 231.790 -   the beginning of the uncompressed stream, or -1 in case of error.
 231.791 -      SEEK_END is not implemented, returns error.
 231.792 -      In this version of the library, gzseek can be extremely slow.
 231.793 -*/
 231.794 -z_off_t ZEXPORT gzseek (file, offset, whence)
 231.795 -    gzFile file;
 231.796 -    z_off_t offset;
 231.797 -    int whence;
 231.798 -{
 231.799 -    gz_stream *s = (gz_stream*)file;
 231.800 -
 231.801 -    if (s == NULL || whence == SEEK_END ||
 231.802 -        s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) {
 231.803 -        return -1L;
 231.804 -    }
 231.805 -
 231.806 -    if (s->mode == 'w') {
 231.807 -#ifdef NO_GZCOMPRESS
 231.808 -        return -1L;
 231.809 -#else
 231.810 -        if (whence == SEEK_SET) {
 231.811 -            offset -= s->in;
 231.812 -        }
 231.813 -        if (offset < 0) return -1L;
 231.814 -
 231.815 -        /* At this point, offset is the number of zero bytes to write. */
 231.816 -        if (s->inbuf == Z_NULL) {
 231.817 -            s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); /* for seeking */
 231.818 -            if (s->inbuf == Z_NULL) return -1L;
 231.819 -            zmemzero(s->inbuf, Z_BUFSIZE);
 231.820 -        }
 231.821 -        while (offset > 0)  {
 231.822 -            uInt size = Z_BUFSIZE;
 231.823 -            if (offset < Z_BUFSIZE) size = (uInt)offset;
 231.824 -
 231.825 -            size = gzwrite(file, s->inbuf, size);
 231.826 -            if (size == 0) return -1L;
 231.827 -
 231.828 -            offset -= size;
 231.829 -        }
 231.830 -        return s->in;
 231.831 -#endif
 231.832 -    }
 231.833 -    /* Rest of function is for reading only */
 231.834 -
 231.835 -    /* compute absolute position */
 231.836 -    if (whence == SEEK_CUR) {
 231.837 -        offset += s->out;
 231.838 -    }
 231.839 -    if (offset < 0) return -1L;
 231.840 -
 231.841 -    if (s->transparent) {
 231.842 -        /* map to fseek */
 231.843 -        s->back = EOF;
 231.844 -        s->stream.avail_in = 0;
 231.845 -        s->stream.next_in = s->inbuf;
 231.846 -        if (fseek(s->file, offset, SEEK_SET) < 0) return -1L;
 231.847 -
 231.848 -        s->in = s->out = offset;
 231.849 -        return offset;
 231.850 -    }
 231.851 -
 231.852 -    /* For a negative seek, rewind and use positive seek */
 231.853 -    if (offset >= s->out) {
 231.854 -        offset -= s->out;
 231.855 -    } else if (gzrewind(file) < 0) {
 231.856 -        return -1L;
 231.857 -    }
 231.858 -    /* offset is now the number of bytes to skip. */
 231.859 -
 231.860 -    if (offset != 0 && s->outbuf == Z_NULL) {
 231.861 -        s->outbuf = (Byte*)ALLOC(Z_BUFSIZE);
 231.862 -        if (s->outbuf == Z_NULL) return -1L;
 231.863 -    }
 231.864 -    if (offset && s->back != EOF) {
 231.865 -        s->back = EOF;
 231.866 -        s->out++;
 231.867 -        offset--;
 231.868 -        if (s->last) s->z_err = Z_STREAM_END;
 231.869 -    }
 231.870 -    while (offset > 0)  {
 231.871 -        int size = Z_BUFSIZE;
 231.872 -        if (offset < Z_BUFSIZE) size = (int)offset;
 231.873 -
 231.874 -        size = gzread(file, s->outbuf, (uInt)size);
 231.875 -        if (size <= 0) return -1L;
 231.876 -        offset -= size;
 231.877 -    }
 231.878 -    return s->out;
 231.879 -}
 231.880 -
 231.881 -/* ===========================================================================
 231.882 -     Rewinds input file.
 231.883 -*/
 231.884 -int ZEXPORT gzrewind (file)
 231.885 -    gzFile file;
 231.886 -{
 231.887 -    gz_stream *s = (gz_stream*)file;
 231.888 -
 231.889 -    if (s == NULL || s->mode != 'r') return -1;
 231.890 -
 231.891 -    s->z_err = Z_OK;
 231.892 -    s->z_eof = 0;
 231.893 -    s->back = EOF;
 231.894 -    s->stream.avail_in = 0;
 231.895 -    s->stream.next_in = s->inbuf;
 231.896 -    s->crc = crc32(0L, Z_NULL, 0);
 231.897 -    if (!s->transparent) (void)inflateReset(&s->stream);
 231.898 -    s->in = 0;
 231.899 -    s->out = 0;
 231.900 -    return fseek(s->file, s->start, SEEK_SET);
 231.901 -}
 231.902 -
 231.903 -/* ===========================================================================
 231.904 -     Returns the starting position for the next gzread or gzwrite on the
 231.905 -   given compressed file. This position represents a number of bytes in the
 231.906 -   uncompressed data stream.
 231.907 -*/
 231.908 -z_off_t ZEXPORT gztell (file)
 231.909 -    gzFile file;
 231.910 -{
 231.911 -    return gzseek(file, 0L, SEEK_CUR);
 231.912 -}
 231.913 -
 231.914 -/* ===========================================================================
 231.915 -     Returns 1 when EOF has previously been detected reading the given
 231.916 -   input stream, otherwise zero.
 231.917 -*/
 231.918 -int ZEXPORT gzeof (file)
 231.919 -    gzFile file;
 231.920 -{
 231.921 -    gz_stream *s = (gz_stream*)file;
 231.922 -
 231.923 -    /* With concatenated compressed files that can have embedded
 231.924 -     * crc trailers, z_eof is no longer the only/best indicator of EOF
 231.925 -     * on a gz_stream. Handle end-of-stream error explicitly here.
 231.926 -     */
 231.927 -    if (s == NULL || s->mode != 'r') return 0;
 231.928 -    if (s->z_eof) return 1;
 231.929 -    return s->z_err == Z_STREAM_END;
 231.930 -}
 231.931 -
 231.932 -/* ===========================================================================
 231.933 -     Returns 1 if reading and doing so transparently, otherwise zero.
 231.934 -*/
 231.935 -int ZEXPORT gzdirect (file)
 231.936 -    gzFile file;
 231.937 -{
 231.938 -    gz_stream *s = (gz_stream*)file;
 231.939 -
 231.940 -    if (s == NULL || s->mode != 'r') return 0;
 231.941 -    return s->transparent;
 231.942 -}
 231.943 -
 231.944 -/* ===========================================================================
 231.945 -   Outputs a long in LSB order to the given file
 231.946 -*/
 231.947 -local void putLong (file, x)
 231.948 -    FILE *file;
 231.949 -    uLong x;
 231.950 -{
 231.951 -    int n;
 231.952 -    for (n = 0; n < 4; n++) {
 231.953 -        fputc((int)(x & 0xff), file);
 231.954 -        x >>= 8;
 231.955 -    }
 231.956 -}
 231.957 -
 231.958 -/* ===========================================================================
 231.959 -   Reads a long in LSB order from the given gz_stream. Sets z_err in case
 231.960 -   of error.
 231.961 -*/
 231.962 -local uLong getLong (s)
 231.963 -    gz_stream *s;
 231.964 -{
 231.965 -    uLong x = (uLong)get_byte(s);
 231.966 -    int c;
 231.967 -
 231.968 -    x += ((uLong)get_byte(s))<<8;
 231.969 -    x += ((uLong)get_byte(s))<<16;
 231.970 -    c = get_byte(s);
 231.971 -    if (c == EOF) s->z_err = Z_DATA_ERROR;
 231.972 -    x += ((uLong)c)<<24;
 231.973 -    return x;
 231.974 -}
 231.975 -
 231.976 -/* ===========================================================================
 231.977 -     Flushes all pending output if necessary, closes the compressed file
 231.978 -   and deallocates all the (de)compression state.
 231.979 -*/
 231.980 -int ZEXPORT gzclose (file)
 231.981 -    gzFile file;
 231.982 -{
 231.983 -    gz_stream *s = (gz_stream*)file;
 231.984 -
 231.985 -    if (s == NULL) return Z_STREAM_ERROR;
 231.986 -
 231.987 -    if (s->mode == 'w') {
 231.988 -#ifdef NO_GZCOMPRESS
 231.989 -        return Z_STREAM_ERROR;
 231.990 -#else
 231.991 -        if (do_flush (file, Z_FINISH) != Z_OK)
 231.992 -            return destroy((gz_stream*)file);
 231.993 -
 231.994 -        putLong (s->file, s->crc);
 231.995 -        putLong (s->file, (uLong)(s->in & 0xffffffff));
 231.996 -#endif
 231.997 -    }
 231.998 -    return destroy((gz_stream*)file);
 231.999 -}
231.1000 -
231.1001 -#ifdef STDC
231.1002 -#  define zstrerror(errnum) strerror(errnum)
231.1003 -#else
231.1004 -#  define zstrerror(errnum) ""
231.1005 -#endif
231.1006 -
231.1007 -/* ===========================================================================
231.1008 -     Returns the error message for the last error which occurred on the
231.1009 -   given compressed file. errnum is set to zlib error number. If an
231.1010 -   error occurred in the file system and not in the compression library,
231.1011 -   errnum is set to Z_ERRNO and the application may consult errno
231.1012 -   to get the exact error code.
231.1013 -*/
231.1014 -const char * ZEXPORT gzerror (file, errnum)
231.1015 -    gzFile file;
231.1016 -    int *errnum;
231.1017 -{
231.1018 -    char *m;
231.1019 -    gz_stream *s = (gz_stream*)file;
231.1020 -
231.1021 -    if (s == NULL) {
231.1022 -        *errnum = Z_STREAM_ERROR;
231.1023 -        return (const char*)ERR_MSG(Z_STREAM_ERROR);
231.1024 -    }
231.1025 -    *errnum = s->z_err;
231.1026 -    if (*errnum == Z_OK) return (const char*)"";
231.1027 -
231.1028 -    m = (char*)(*errnum == Z_ERRNO ? zstrerror(errno) : s->stream.msg);
231.1029 -
231.1030 -    if (m == NULL || *m == '\0') m = (char*)ERR_MSG(s->z_err);
231.1031 -
231.1032 -    TRYFREE(s->msg);
231.1033 -    s->msg = (char*)ALLOC(strlen(s->path) + strlen(m) + 3);
231.1034 -    if (s->msg == Z_NULL) return (const char*)ERR_MSG(Z_MEM_ERROR);
231.1035 -    strcpy(s->msg, s->path);
231.1036 -    strcat(s->msg, ": ");
231.1037 -    strcat(s->msg, m);
231.1038 -    return (const char*)s->msg;
231.1039 -}
231.1040 -
231.1041 -/* ===========================================================================
231.1042 -     Clear the error and end-of-file flags, and do the same for the real file.
231.1043 -*/
231.1044 -void ZEXPORT gzclearerr (file)
231.1045 -    gzFile file;
231.1046 -{
231.1047 -    gz_stream *s = (gz_stream*)file;
231.1048 -
231.1049 -    if (s == NULL) return;
231.1050 -    if (s->z_err != Z_STREAM_END) s->z_err = Z_OK;
231.1051 -    s->z_eof = 0;
231.1052 -    clearerr(s->file);
231.1053 -}
   232.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/infback.c	Tue Dec 06 16:31:58 2011 -0800
   232.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   232.3 @@ -1,647 +0,0 @@
   232.4 -/*
   232.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   232.6 - *
   232.7 - * This code is free software; you can redistribute it and/or modify it
   232.8 - * under the terms of the GNU General Public License version 2 only, as
   232.9 - * published by the Free Software Foundation.  Oracle designates this
  232.10 - * particular file as subject to the "Classpath" exception as provided
  232.11 - * by Oracle in the LICENSE file that accompanied this code.
  232.12 - *
  232.13 - * This code is distributed in the hope that it will be useful, but WITHOUT
  232.14 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  232.15 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  232.16 - * version 2 for more details (a copy is included in the LICENSE file that
  232.17 - * accompanied this code).
  232.18 - *
  232.19 - * You should have received a copy of the GNU General Public License version
  232.20 - * 2 along with this work; if not, write to the Free Software Foundation,
  232.21 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  232.22 - *
  232.23 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  232.24 - * or visit www.oracle.com if you need additional information or have any
  232.25 - * questions.
  232.26 - */
  232.27 -
  232.28 -/* infback.c -- inflate using a call-back interface
  232.29 - * Copyright (C) 1995-2005 Mark Adler
  232.30 - * For conditions of distribution and use, see copyright notice in zlib.h
  232.31 - */
  232.32 -
  232.33 -/*
  232.34 -   This code is largely copied from inflate.c.  Normally either infback.o or
  232.35 -   inflate.o would be linked into an application--not both.  The interface
  232.36 -   with inffast.c is retained so that optimized assembler-coded versions of
  232.37 -   inflate_fast() can be used with either inflate.c or infback.c.
  232.38 - */
  232.39 -
  232.40 -#include "zutil.h"
  232.41 -#include "inftrees.h"
  232.42 -#include "inflate.h"
  232.43 -#include "inffast.h"
  232.44 -
  232.45 -/* function prototypes */
  232.46 -local void fixedtables OF((struct inflate_state FAR *state));
  232.47 -
  232.48 -/*
  232.49 -   strm provides memory allocation functions in zalloc and zfree, or
  232.50 -   Z_NULL to use the library memory allocation functions.
  232.51 -
  232.52 -   windowBits is in the range 8..15, and window is a user-supplied
  232.53 -   window and output buffer that is 2**windowBits bytes.
  232.54 - */
  232.55 -int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size)
  232.56 -z_streamp strm;
  232.57 -int windowBits;
  232.58 -unsigned char FAR *window;
  232.59 -const char *version;
  232.60 -int stream_size;
  232.61 -{
  232.62 -    struct inflate_state FAR *state;
  232.63 -
  232.64 -    if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
  232.65 -        stream_size != (int)(sizeof(z_stream)))
  232.66 -        return Z_VERSION_ERROR;
  232.67 -    if (strm == Z_NULL || window == Z_NULL ||
  232.68 -        windowBits < 8 || windowBits > 15)
  232.69 -        return Z_STREAM_ERROR;
  232.70 -    strm->msg = Z_NULL;                 /* in case we return an error */
  232.71 -    if (strm->zalloc == (alloc_func)0) {
  232.72 -        strm->zalloc = zcalloc;
  232.73 -        strm->opaque = (voidpf)0;
  232.74 -    }
  232.75 -    if (strm->zfree == (free_func)0) strm->zfree = zcfree;
  232.76 -    state = (struct inflate_state FAR *)ZALLOC(strm, 1,
  232.77 -                                               sizeof(struct inflate_state));
  232.78 -    if (state == Z_NULL) return Z_MEM_ERROR;
  232.79 -    Tracev((stderr, "inflate: allocated\n"));
  232.80 -    strm->state = (struct internal_state FAR *)state;
  232.81 -    state->dmax = 32768U;
  232.82 -    state->wbits = windowBits;
  232.83 -    state->wsize = 1U << windowBits;
  232.84 -    state->window = window;
  232.85 -    state->write = 0;
  232.86 -    state->whave = 0;
  232.87 -    return Z_OK;
  232.88 -}
  232.89 -
  232.90 -/*
  232.91 -   Return state with length and distance decoding tables and index sizes set to
  232.92 -   fixed code decoding.  Normally this returns fixed tables from inffixed.h.
  232.93 -   If BUILDFIXED is defined, then instead this routine builds the tables the
  232.94 -   first time it's called, and returns those tables the first time and
  232.95 -   thereafter.  This reduces the size of the code by about 2K bytes, in
  232.96 -   exchange for a little execution time.  However, BUILDFIXED should not be
  232.97 -   used for threaded applications, since the rewriting of the tables and virgin
  232.98 -   may not be thread-safe.
  232.99 - */
 232.100 -local void fixedtables(state)
 232.101 -struct inflate_state FAR *state;
 232.102 -{
 232.103 -#ifdef BUILDFIXED
 232.104 -    static int virgin = 1;
 232.105 -    static code *lenfix, *distfix;
 232.106 -    static code fixed[544];
 232.107 -
 232.108 -    /* build fixed huffman tables if first call (may not be thread safe) */
 232.109 -    if (virgin) {
 232.110 -        unsigned sym, bits;
 232.111 -        static code *next;
 232.112 -
 232.113 -        /* literal/length table */
 232.114 -        sym = 0;
 232.115 -        while (sym < 144) state->lens[sym++] = 8;
 232.116 -        while (sym < 256) state->lens[sym++] = 9;
 232.117 -        while (sym < 280) state->lens[sym++] = 7;
 232.118 -        while (sym < 288) state->lens[sym++] = 8;
 232.119 -        next = fixed;
 232.120 -        lenfix = next;
 232.121 -        bits = 9;
 232.122 -        inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
 232.123 -
 232.124 -        /* distance table */
 232.125 -        sym = 0;
 232.126 -        while (sym < 32) state->lens[sym++] = 5;
 232.127 -        distfix = next;
 232.128 -        bits = 5;
 232.129 -        inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
 232.130 -
 232.131 -        /* do this just once */
 232.132 -        virgin = 0;
 232.133 -    }
 232.134 -#else /* !BUILDFIXED */
 232.135 -#   include "inffixed.h"
 232.136 -#endif /* BUILDFIXED */
 232.137 -    state->lencode = lenfix;
 232.138 -    state->lenbits = 9;
 232.139 -    state->distcode = distfix;
 232.140 -    state->distbits = 5;
 232.141 -}
 232.142 -
 232.143 -/* Macros for inflateBack(): */
 232.144 -
 232.145 -/* Load returned state from inflate_fast() */
 232.146 -#define LOAD() \
 232.147 -    do { \
 232.148 -        put = strm->next_out; \
 232.149 -        left = strm->avail_out; \
 232.150 -        next = strm->next_in; \
 232.151 -        have = strm->avail_in; \
 232.152 -        hold = state->hold; \
 232.153 -        bits = state->bits; \
 232.154 -    } while (0)
 232.155 -
 232.156 -/* Set state from registers for inflate_fast() */
 232.157 -#define RESTORE() \
 232.158 -    do { \
 232.159 -        strm->next_out = put; \
 232.160 -        strm->avail_out = left; \
 232.161 -        strm->next_in = next; \
 232.162 -        strm->avail_in = have; \
 232.163 -        state->hold = hold; \
 232.164 -        state->bits = bits; \
 232.165 -    } while (0)
 232.166 -
 232.167 -/* Clear the input bit accumulator */
 232.168 -#define INITBITS() \
 232.169 -    do { \
 232.170 -        hold = 0; \
 232.171 -        bits = 0; \
 232.172 -    } while (0)
 232.173 -
 232.174 -/* Assure that some input is available.  If input is requested, but denied,
 232.175 -   then return a Z_BUF_ERROR from inflateBack(). */
 232.176 -#define PULL() \
 232.177 -    do { \
 232.178 -        if (have == 0) { \
 232.179 -            have = in(in_desc, &next); \
 232.180 -            if (have == 0) { \
 232.181 -                next = Z_NULL; \
 232.182 -                ret = Z_BUF_ERROR; \
 232.183 -                goto inf_leave; \
 232.184 -            } \
 232.185 -        } \
 232.186 -    } while (0)
 232.187 -
 232.188 -/* Get a byte of input into the bit accumulator, or return from inflateBack()
 232.189 -   with an error if there is no input available. */
 232.190 -#define PULLBYTE() \
 232.191 -    do { \
 232.192 -        PULL(); \
 232.193 -        have--; \
 232.194 -        hold += (unsigned long)(*next++) << bits; \
 232.195 -        bits += 8; \
 232.196 -    } while (0)
 232.197 -
 232.198 -/* Assure that there are at least n bits in the bit accumulator.  If there is
 232.199 -   not enough available input to do that, then return from inflateBack() with
 232.200 -   an error. */
 232.201 -#define NEEDBITS(n) \
 232.202 -    do { \
 232.203 -        while (bits < (unsigned)(n)) \
 232.204 -            PULLBYTE(); \
 232.205 -    } while (0)
 232.206 -
 232.207 -/* Return the low n bits of the bit accumulator (n < 16) */
 232.208 -#define BITS(n) \
 232.209 -    ((unsigned)hold & ((1U << (n)) - 1))
 232.210 -
 232.211 -/* Remove n bits from the bit accumulator */
 232.212 -#define DROPBITS(n) \
 232.213 -    do { \
 232.214 -        hold >>= (n); \
 232.215 -        bits -= (unsigned)(n); \
 232.216 -    } while (0)
 232.217 -
 232.218 -/* Remove zero to seven bits as needed to go to a byte boundary */
 232.219 -#define BYTEBITS() \
 232.220 -    do { \
 232.221 -        hold >>= bits & 7; \
 232.222 -        bits -= bits & 7; \
 232.223 -    } while (0)
 232.224 -
 232.225 -/* Assure that some output space is available, by writing out the window
 232.226 -   if it's full.  If the write fails, return from inflateBack() with a
 232.227 -   Z_BUF_ERROR. */
 232.228 -#define ROOM() \
 232.229 -    do { \
 232.230 -        if (left == 0) { \
 232.231 -            put = state->window; \
 232.232 -            left = state->wsize; \
 232.233 -            state->whave = left; \
 232.234 -            if (out(out_desc, put, left)) { \
 232.235 -                ret = Z_BUF_ERROR; \
 232.236 -                goto inf_leave; \
 232.237 -            } \
 232.238 -        } \
 232.239 -    } while (0)
 232.240 -
 232.241 -/*
 232.242 -   strm provides the memory allocation functions and window buffer on input,
 232.243 -   and provides information on the unused input on return.  For Z_DATA_ERROR
 232.244 -   returns, strm will also provide an error message.
 232.245 -
 232.246 -   in() and out() are the call-back input and output functions.  When
 232.247 -   inflateBack() needs more input, it calls in().  When inflateBack() has
 232.248 -   filled the window with output, or when it completes with data in the
 232.249 -   window, it calls out() to write out the data.  The application must not
 232.250 -   change the provided input until in() is called again or inflateBack()
 232.251 -   returns.  The application must not change the window/output buffer until
 232.252 -   inflateBack() returns.
 232.253 -
 232.254 -   in() and out() are called with a descriptor parameter provided in the
 232.255 -   inflateBack() call.  This parameter can be a structure that provides the
 232.256 -   information required to do the read or write, as well as accumulated
 232.257 -   information on the input and output such as totals and check values.
 232.258 -
 232.259 -   in() should return zero on failure.  out() should return non-zero on
 232.260 -   failure.  If either in() or out() fails, than inflateBack() returns a
 232.261 -   Z_BUF_ERROR.  strm->next_in can be checked for Z_NULL to see whether it
 232.262 -   was in() or out() that caused in the error.  Otherwise,  inflateBack()
 232.263 -   returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format
 232.264 -   error, or Z_MEM_ERROR if it could not allocate memory for the state.
 232.265 -   inflateBack() can also return Z_STREAM_ERROR if the input parameters
 232.266 -   are not correct, i.e. strm is Z_NULL or the state was not initialized.
 232.267 - */
 232.268 -int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc)
 232.269 -z_streamp strm;
 232.270 -in_func in;
 232.271 -void FAR *in_desc;
 232.272 -out_func out;
 232.273 -void FAR *out_desc;
 232.274 -{
 232.275 -    struct inflate_state FAR *state;
 232.276 -    unsigned char FAR *next;    /* next input */
 232.277 -    unsigned char FAR *put;     /* next output */
 232.278 -    unsigned have, left;        /* available input and output */
 232.279 -    unsigned long hold;         /* bit buffer */
 232.280 -    unsigned bits;              /* bits in bit buffer */
 232.281 -    unsigned copy;              /* number of stored or match bytes to copy */
 232.282 -    unsigned char FAR *from;    /* where to copy match bytes from */
 232.283 -    code this;                  /* current decoding table entry */
 232.284 -    code last;                  /* parent table entry */
 232.285 -    unsigned len;               /* length to copy for repeats, bits to drop */
 232.286 -    int ret;                    /* return code */
 232.287 -    static const unsigned short order[19] = /* permutation of code lengths */
 232.288 -        {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
 232.289 -
 232.290 -    /* Check that the strm exists and that the state was initialized */
 232.291 -    if (strm == Z_NULL || strm->state == Z_NULL)
 232.292 -        return Z_STREAM_ERROR;
 232.293 -    state = (struct inflate_state FAR *)strm->state;
 232.294 -
 232.295 -    /* Reset the state */
 232.296 -    strm->msg = Z_NULL;
 232.297 -    state->mode = TYPE;
 232.298 -    state->last = 0;
 232.299 -    state->whave = 0;
 232.300 -    next = strm->next_in;
 232.301 -    have = next != Z_NULL ? strm->avail_in : 0;
 232.302 -    hold = 0;
 232.303 -    bits = 0;
 232.304 -    put = state->window;
 232.305 -    left = state->wsize;
 232.306 -
 232.307 -    /* Inflate until end of block marked as last */
 232.308 -    for (;;)
 232.309 -        switch (state->mode) {
 232.310 -        case TYPE:
 232.311 -            /* determine and dispatch block type */
 232.312 -            if (state->last) {
 232.313 -                BYTEBITS();
 232.314 -                state->mode = DONE;
 232.315 -                break;
 232.316 -            }
 232.317 -            NEEDBITS(3);
 232.318 -            state->last = BITS(1);
 232.319 -            DROPBITS(1);
 232.320 -            switch (BITS(2)) {
 232.321 -            case 0:                             /* stored block */
 232.322 -                Tracev((stderr, "inflate:     stored block%s\n",
 232.323 -                        state->last ? " (last)" : ""));
 232.324 -                state->mode = STORED;
 232.325 -                break;
 232.326 -            case 1:                             /* fixed block */
 232.327 -                fixedtables(state);
 232.328 -                Tracev((stderr, "inflate:     fixed codes block%s\n",
 232.329 -                        state->last ? " (last)" : ""));
 232.330 -                state->mode = LEN;              /* decode codes */
 232.331 -                break;
 232.332 -            case 2:                             /* dynamic block */
 232.333 -                Tracev((stderr, "inflate:     dynamic codes block%s\n",
 232.334 -                        state->last ? " (last)" : ""));
 232.335 -                state->mode = TABLE;
 232.336 -                break;
 232.337 -            case 3:
 232.338 -                strm->msg = (char *)"invalid block type";
 232.339 -                state->mode = BAD;
 232.340 -            }
 232.341 -            DROPBITS(2);
 232.342 -            break;
 232.343 -
 232.344 -        case STORED:
 232.345 -            /* get and verify stored block length */
 232.346 -            BYTEBITS();                         /* go to byte boundary */
 232.347 -            NEEDBITS(32);
 232.348 -            if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
 232.349 -                strm->msg = (char *)"invalid stored block lengths";
 232.350 -                state->mode = BAD;
 232.351 -                break;
 232.352 -            }
 232.353 -            state->length = (unsigned)hold & 0xffff;
 232.354 -            Tracev((stderr, "inflate:       stored length %u\n",
 232.355 -                    state->length));
 232.356 -            INITBITS();
 232.357 -
 232.358 -            /* copy stored block from input to output */
 232.359 -            while (state->length != 0) {
 232.360 -                copy = state->length;
 232.361 -                PULL();
 232.362 -                ROOM();
 232.363 -                if (copy > have) copy = have;
 232.364 -                if (copy > left) copy = left;
 232.365 -                zmemcpy(put, next, copy);
 232.366 -                have -= copy;
 232.367 -                next += copy;
 232.368 -                left -= copy;
 232.369 -                put += copy;
 232.370 -                state->length -= copy;
 232.371 -            }
 232.372 -            Tracev((stderr, "inflate:       stored end\n"));
 232.373 -            state->mode = TYPE;
 232.374 -            break;
 232.375 -
 232.376 -        case TABLE:
 232.377 -            /* get dynamic table entries descriptor */
 232.378 -            NEEDBITS(14);
 232.379 -            state->nlen = BITS(5) + 257;
 232.380 -            DROPBITS(5);
 232.381 -            state->ndist = BITS(5) + 1;
 232.382 -            DROPBITS(5);
 232.383 -            state->ncode = BITS(4) + 4;
 232.384 -            DROPBITS(4);
 232.385 -#ifndef PKZIP_BUG_WORKAROUND
 232.386 -            if (state->nlen > 286 || state->ndist > 30) {
 232.387 -                strm->msg = (char *)"too many length or distance symbols";
 232.388 -                state->mode = BAD;
 232.389 -                break;
 232.390 -            }
 232.391 -#endif
 232.392 -            Tracev((stderr, "inflate:       table sizes ok\n"));
 232.393 -
 232.394 -            /* get code length code lengths (not a typo) */
 232.395 -            state->have = 0;
 232.396 -            while (state->have < state->ncode) {
 232.397 -                NEEDBITS(3);
 232.398 -                state->lens[order[state->have++]] = (unsigned short)BITS(3);
 232.399 -                DROPBITS(3);
 232.400 -            }
 232.401 -            while (state->have < 19)
 232.402 -                state->lens[order[state->have++]] = 0;
 232.403 -            state->next = state->codes;
 232.404 -            state->lencode = (code const FAR *)(state->next);
 232.405 -            state->lenbits = 7;
 232.406 -            ret = inflate_table(CODES, state->lens, 19, &(state->next),
 232.407 -                                &(state->lenbits), state->work);
 232.408 -            if (ret) {
 232.409 -                strm->msg = (char *)"invalid code lengths set";
 232.410 -                state->mode = BAD;
 232.411 -                break;
 232.412 -            }
 232.413 -            Tracev((stderr, "inflate:       code lengths ok\n"));
 232.414 -
 232.415 -            /* get length and distance code code lengths */
 232.416 -            state->have = 0;
 232.417 -            while (state->have < state->nlen + state->ndist) {
 232.418 -                for (;;) {
 232.419 -                    this = state->lencode[BITS(state->lenbits)];
 232.420 -                    if ((unsigned)(this.bits) <= bits) break;
 232.421 -                    PULLBYTE();
 232.422 -                }
 232.423 -                if (this.val < 16) {
 232.424 -                    NEEDBITS(this.bits);
 232.425 -                    DROPBITS(this.bits);
 232.426 -                    state->lens[state->have++] = this.val;
 232.427 -                }
 232.428 -                else {
 232.429 -                    if (this.val == 16) {
 232.430 -                        NEEDBITS(this.bits + 2);
 232.431 -                        DROPBITS(this.bits);
 232.432 -                        if (state->have == 0) {
 232.433 -                            strm->msg = (char *)"invalid bit length repeat";
 232.434 -                            state->mode = BAD;
 232.435 -                            break;
 232.436 -                        }
 232.437 -                        len = (unsigned)(state->lens[state->have - 1]);
 232.438 -                        copy = 3 + BITS(2);
 232.439 -                        DROPBITS(2);
 232.440 -                    }
 232.441 -                    else if (this.val == 17) {
 232.442 -                        NEEDBITS(this.bits + 3);
 232.443 -                        DROPBITS(this.bits);
 232.444 -                        len = 0;
 232.445 -                        copy = 3 + BITS(3);
 232.446 -                        DROPBITS(3);
 232.447 -                    }
 232.448 -                    else {
 232.449 -                        NEEDBITS(this.bits + 7);
 232.450 -                        DROPBITS(this.bits);
 232.451 -                        len = 0;
 232.452 -                        copy = 11 + BITS(7);
 232.453 -                        DROPBITS(7);
 232.454 -                    }
 232.455 -                    if (state->have + copy > state->nlen + state->ndist) {
 232.456 -                        strm->msg = (char *)"invalid bit length repeat";
 232.457 -                        state->mode = BAD;
 232.458 -                        break;
 232.459 -                    }
 232.460 -                    while (copy--)
 232.461 -                        state->lens[state->have++] = (unsigned short)len;
 232.462 -                }
 232.463 -            }
 232.464 -
 232.465 -            /* handle error breaks in while */
 232.466 -            if (state->mode == BAD) break;
 232.467 -
 232.468 -            /* build code tables */
 232.469 -            state->next = state->codes;
 232.470 -            state->lencode = (code const FAR *)(state->next);
 232.471 -            state->lenbits = 9;
 232.472 -            ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
 232.473 -                                &(state->lenbits), state->work);
 232.474 -            if (ret) {
 232.475 -                strm->msg = (char *)"invalid literal/lengths set";
 232.476 -                state->mode = BAD;
 232.477 -                break;
 232.478 -            }
 232.479 -            state->distcode = (code const FAR *)(state->next);
 232.480 -            state->distbits = 6;
 232.481 -            ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
 232.482 -                            &(state->next), &(state->distbits), state->work);
 232.483 -            if (ret) {
 232.484 -                strm->msg = (char *)"invalid distances set";
 232.485 -                state->mode = BAD;
 232.486 -                break;
 232.487 -            }
 232.488 -            Tracev((stderr, "inflate:       codes ok\n"));
 232.489 -            state->mode = LEN;
 232.490 -
 232.491 -        case LEN:
 232.492 -            /* use inflate_fast() if we have enough input and output */
 232.493 -            if (have >= 6 && left >= 258) {
 232.494 -                RESTORE();
 232.495 -                if (state->whave < state->wsize)
 232.496 -                    state->whave = state->wsize - left;
 232.497 -                inflate_fast(strm, state->wsize);
 232.498 -                LOAD();
 232.499 -                break;
 232.500 -            }
 232.501 -
 232.502 -            /* get a literal, length, or end-of-block code */
 232.503 -            for (;;) {
 232.504 -                this = state->lencode[BITS(state->lenbits)];
 232.505 -                if ((unsigned)(this.bits) <= bits) break;
 232.506 -                PULLBYTE();
 232.507 -            }
 232.508 -            if (this.op && (this.op & 0xf0) == 0) {
 232.509 -                last = this;
 232.510 -                for (;;) {
 232.511 -                    this = state->lencode[last.val +
 232.512 -                            (BITS(last.bits + last.op) >> last.bits)];
 232.513 -                    if ((unsigned)(last.bits + this.bits) <= bits) break;
 232.514 -                    PULLBYTE();
 232.515 -                }
 232.516 -                DROPBITS(last.bits);
 232.517 -            }
 232.518 -            DROPBITS(this.bits);
 232.519 -            state->length = (unsigned)this.val;
 232.520 -
 232.521 -            /* process literal */
 232.522 -            if (this.op == 0) {
 232.523 -                Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
 232.524 -                        "inflate:         literal '%c'\n" :
 232.525 -                        "inflate:         literal 0x%02x\n", this.val));
 232.526 -                ROOM();
 232.527 -                *put++ = (unsigned char)(state->length);
 232.528 -                left--;
 232.529 -                state->mode = LEN;
 232.530 -                break;
 232.531 -            }
 232.532 -
 232.533 -            /* process end of block */
 232.534 -            if (this.op & 32) {
 232.535 -                Tracevv((stderr, "inflate:         end of block\n"));
 232.536 -                state->mode = TYPE;
 232.537 -                break;
 232.538 -            }
 232.539 -
 232.540 -            /* invalid code */
 232.541 -            if (this.op & 64) {
 232.542 -                strm->msg = (char *)"invalid literal/length code";
 232.543 -                state->mode = BAD;
 232.544 -                break;
 232.545 -            }
 232.546 -
 232.547 -            /* length code -- get extra bits, if any */
 232.548 -            state->extra = (unsigned)(this.op) & 15;
 232.549 -            if (state->extra != 0) {
 232.550 -                NEEDBITS(state->extra);
 232.551 -                state->length += BITS(state->extra);
 232.552 -                DROPBITS(state->extra);
 232.553 -            }
 232.554 -            Tracevv((stderr, "inflate:         length %u\n", state->length));
 232.555 -
 232.556 -            /* get distance code */
 232.557 -            for (;;) {
 232.558 -                this = state->distcode[BITS(state->distbits)];
 232.559 -                if ((unsigned)(this.bits) <= bits) break;
 232.560 -                PULLBYTE();
 232.561 -            }
 232.562 -            if ((this.op & 0xf0) == 0) {
 232.563 -                last = this;
 232.564 -                for (;;) {
 232.565 -                    this = state->distcode[last.val +
 232.566 -                            (BITS(last.bits + last.op) >> last.bits)];
 232.567 -                    if ((unsigned)(last.bits + this.bits) <= bits) break;
 232.568 -                    PULLBYTE();
 232.569 -                }
 232.570 -                DROPBITS(last.bits);
 232.571 -            }
 232.572 -            DROPBITS(this.bits);
 232.573 -            if (this.op & 64) {
 232.574 -                strm->msg = (char *)"invalid distance code";
 232.575 -                state->mode = BAD;
 232.576 -                break;
 232.577 -            }
 232.578 -            state->offset = (unsigned)this.val;
 232.579 -
 232.580 -            /* get distance extra bits, if any */
 232.581 -            state->extra = (unsigned)(this.op) & 15;
 232.582 -            if (state->extra != 0) {
 232.583 -                NEEDBITS(state->extra);
 232.584 -                state->offset += BITS(state->extra);
 232.585 -                DROPBITS(state->extra);
 232.586 -            }
 232.587 -            if (state->offset > state->wsize - (state->whave < state->wsize ?
 232.588 -                                                left : 0)) {
 232.589 -                strm->msg = (char *)"invalid distance too far back";
 232.590 -                state->mode = BAD;
 232.591 -                break;
 232.592 -            }
 232.593 -            Tracevv((stderr, "inflate:         distance %u\n", state->offset));
 232.594 -
 232.595 -            /* copy match from window to output */
 232.596 -            do {
 232.597 -                ROOM();
 232.598 -                copy = state->wsize - state->offset;
 232.599 -                if (copy < left) {
 232.600 -                    from = put + copy;
 232.601 -                    copy = left - copy;
 232.602 -                }
 232.603 -                else {
 232.604 -                    from = put - state->offset;
 232.605 -                    copy = left;
 232.606 -                }
 232.607 -                if (copy > state->length) copy = state->length;
 232.608 -                state->length -= copy;
 232.609 -                left -= copy;
 232.610 -                do {
 232.611 -                    *put++ = *from++;
 232.612 -                } while (--copy);
 232.613 -            } while (state->length != 0);
 232.614 -            break;
 232.615 -
 232.616 -        case DONE:
 232.617 -            /* inflate stream terminated properly -- write leftover output */
 232.618 -            ret = Z_STREAM_END;
 232.619 -            if (left < state->wsize) {
 232.620 -                if (out(out_desc, state->window, state->wsize - left))
 232.621 -                    ret = Z_BUF_ERROR;
 232.622 -            }
 232.623 -            goto inf_leave;
 232.624 -
 232.625 -        case BAD:
 232.626 -            ret = Z_DATA_ERROR;
 232.627 -            goto inf_leave;
 232.628 -
 232.629 -        default:                /* can't happen, but makes compilers happy */
 232.630 -            ret = Z_STREAM_ERROR;
 232.631 -            goto inf_leave;
 232.632 -        }
 232.633 -
 232.634 -    /* Return unused input */
 232.635 -  inf_leave:
 232.636 -    strm->next_in = next;
 232.637 -    strm->avail_in = have;
 232.638 -    return ret;
 232.639 -}
 232.640 -
 232.641 -int ZEXPORT inflateBackEnd(strm)
 232.642 -z_streamp strm;
 232.643 -{
 232.644 -    if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
 232.645 -        return Z_STREAM_ERROR;
 232.646 -    ZFREE(strm, strm->state);
 232.647 -    strm->state = Z_NULL;
 232.648 -    Tracev((stderr, "inflate: end\n"));
 232.649 -    return Z_OK;
 232.650 -}
   233.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/inffast.c	Tue Dec 06 16:31:58 2011 -0800
   233.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   233.3 @@ -1,342 +0,0 @@
   233.4 -/*
   233.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   233.6 - *
   233.7 - * This code is free software; you can redistribute it and/or modify it
   233.8 - * under the terms of the GNU General Public License version 2 only, as
   233.9 - * published by the Free Software Foundation.  Oracle designates this
  233.10 - * particular file as subject to the "Classpath" exception as provided
  233.11 - * by Oracle in the LICENSE file that accompanied this code.
  233.12 - *
  233.13 - * This code is distributed in the hope that it will be useful, but WITHOUT
  233.14 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  233.15 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  233.16 - * version 2 for more details (a copy is included in the LICENSE file that
  233.17 - * accompanied this code).
  233.18 - *
  233.19 - * You should have received a copy of the GNU General Public License version
  233.20 - * 2 along with this work; if not, write to the Free Software Foundation,
  233.21 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  233.22 - *
  233.23 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  233.24 - * or visit www.oracle.com if you need additional information or have any
  233.25 - * questions.
  233.26 - */
  233.27 -
  233.28 -/* inffast.c -- fast decoding
  233.29 - * Copyright (C) 1995-2004 Mark Adler
  233.30 - * For conditions of distribution and use, see copyright notice in zlib.h
  233.31 - */
  233.32 -
  233.33 -#include "zutil.h"
  233.34 -#include "inftrees.h"
  233.35 -#include "inflate.h"
  233.36 -#include "inffast.h"
  233.37 -
  233.38 -#ifndef ASMINF
  233.39 -
  233.40 -/* Allow machine dependent optimization for post-increment or pre-increment.
  233.41 -   Based on testing to date,
  233.42 -   Pre-increment preferred for:
  233.43 -   - PowerPC G3 (Adler)
  233.44 -   - MIPS R5000 (Randers-Pehrson)
  233.45 -   Post-increment preferred for:
  233.46 -   - none
  233.47 -   No measurable difference:
  233.48 -   - Pentium III (Anderson)
  233.49 -   - M68060 (Nikl)
  233.50 - */
  233.51 -#ifdef POSTINC
  233.52 -#  define OFF 0
  233.53 -#  define PUP(a) *(a)++
  233.54 -#else
  233.55 -#  define OFF 1
  233.56 -#  define PUP(a) *++(a)
  233.57 -#endif
  233.58 -
  233.59 -/*
  233.60 -   Decode literal, length, and distance codes and write out the resulting
  233.61 -   literal and match bytes until either not enough input or output is
  233.62 -   available, an end-of-block is encountered, or a data error is encountered.
  233.63 -   When large enough input and output buffers are supplied to inflate(), for
  233.64 -   example, a 16K input buffer and a 64K output buffer, more than 95% of the
  233.65 -   inflate execution time is spent in this routine.
  233.66 -
  233.67 -   Entry assumptions:
  233.68 -
  233.69 -        state->mode == LEN
  233.70 -        strm->avail_in >= 6
  233.71 -        strm->avail_out >= 258
  233.72 -        start >= strm->avail_out
  233.73 -        state->bits < 8
  233.74 -
  233.75 -   On return, state->mode is one of:
  233.76 -
  233.77 -        LEN -- ran out of enough output space or enough available input
  233.78 -        TYPE -- reached end of block code, inflate() to interpret next block
  233.79 -        BAD -- error in block data
  233.80 -
  233.81 -   Notes:
  233.82 -
  233.83 -    - The maximum input bits used by a length/distance pair is 15 bits for the
  233.84 -      length code, 5 bits for the length extra, 15 bits for the distance code,
  233.85 -      and 13 bits for the distance extra.  This totals 48 bits, or six bytes.
  233.86 -      Therefore if strm->avail_in >= 6, then there is enough input to avoid
  233.87 -      checking for available input while decoding.
  233.88 -
  233.89 -    - The maximum bytes that a single length/distance pair can output is 258
  233.90 -      bytes, which is the maximum length that can be coded.  inflate_fast()
  233.91 -      requires strm->avail_out >= 258 for each loop to avoid checking for
  233.92 -      output space.
  233.93 - */
  233.94 -void inflate_fast(strm, start)
  233.95 -z_streamp strm;
  233.96 -unsigned start;         /* inflate()'s starting value for strm->avail_out */
  233.97 -{
  233.98 -    struct inflate_state FAR *state;
  233.99 -    unsigned char FAR *in;      /* local strm->next_in */
 233.100 -    unsigned char FAR *last;    /* while in < last, enough input available */
 233.101 -    unsigned char FAR *out;     /* local strm->next_out */
 233.102 -    unsigned char FAR *beg;     /* inflate()'s initial strm->next_out */
 233.103 -    unsigned char FAR *end;     /* while out < end, enough space available */
 233.104 -#ifdef INFLATE_STRICT
 233.105 -    unsigned dmax;              /* maximum distance from zlib header */
 233.106 -#endif
 233.107 -    unsigned wsize;             /* window size or zero if not using window */
 233.108 -    unsigned whave;             /* valid bytes in the window */
 233.109 -    unsigned write;             /* window write index */
 233.110 -    unsigned char FAR *window;  /* allocated sliding window, if wsize != 0 */
 233.111 -    unsigned long hold;         /* local strm->hold */
 233.112 -    unsigned bits;              /* local strm->bits */
 233.113 -    code const FAR *lcode;      /* local strm->lencode */
 233.114 -    code const FAR *dcode;      /* local strm->distcode */
 233.115 -    unsigned lmask;             /* mask for first level of length codes */
 233.116 -    unsigned dmask;             /* mask for first level of distance codes */
 233.117 -    code this;                  /* retrieved table entry */
 233.118 -    unsigned op;                /* code bits, operation, extra bits, or */
 233.119 -                                /*  window position, window bytes to copy */
 233.120 -    unsigned len;               /* match length, unused bytes */
 233.121 -    unsigned dist;              /* match distance */
 233.122 -    unsigned char FAR *from;    /* where to copy match from */
 233.123 -
 233.124 -    /* copy state to local variables */
 233.125 -    state = (struct inflate_state FAR *)strm->state;
 233.126 -    in = strm->next_in - OFF;
 233.127 -    last = in + (strm->avail_in - 5);
 233.128 -    out = strm->next_out - OFF;
 233.129 -    beg = out - (start - strm->avail_out);
 233.130 -    end = out + (strm->avail_out - 257);
 233.131 -#ifdef INFLATE_STRICT
 233.132 -    dmax = state->dmax;
 233.133 -#endif
 233.134 -    wsize = state->wsize;
 233.135 -    whave = state->whave;
 233.136 -    write = state->write;
 233.137 -    window = state->window;
 233.138 -    hold = state->hold;
 233.139 -    bits = state->bits;
 233.140 -    lcode = state->lencode;
 233.141 -    dcode = state->distcode;
 233.142 -    lmask = (1U << state->lenbits) - 1;
 233.143 -    dmask = (1U << state->distbits) - 1;
 233.144 -
 233.145 -    /* decode literals and length/distances until end-of-block or not enough
 233.146 -       input data or output space */
 233.147 -    do {
 233.148 -        if (bits < 15) {
 233.149 -            hold += (unsigned long)(PUP(in)) << bits;
 233.150 -            bits += 8;
 233.151 -            hold += (unsigned long)(PUP(in)) << bits;
 233.152 -            bits += 8;
 233.153 -        }
 233.154 -        this = lcode[hold & lmask];
 233.155 -      dolen:
 233.156 -        op = (unsigned)(this.bits);
 233.157 -        hold >>= op;
 233.158 -        bits -= op;
 233.159 -        op = (unsigned)(this.op);
 233.160 -        if (op == 0) {                          /* literal */
 233.161 -            Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
 233.162 -                    "inflate:         literal '%c'\n" :
 233.163 -                    "inflate:         literal 0x%02x\n", this.val));
 233.164 -            PUP(out) = (unsigned char)(this.val);
 233.165 -        }
 233.166 -        else if (op & 16) {                     /* length base */
 233.167 -            len = (unsigned)(this.val);
 233.168 -            op &= 15;                           /* number of extra bits */
 233.169 -            if (op) {
 233.170 -                if (bits < op) {
 233.171 -                    hold += (unsigned long)(PUP(in)) << bits;
 233.172 -                    bits += 8;
 233.173 -                }
 233.174 -                len += (unsigned)hold & ((1U << op) - 1);
 233.175 -                hold >>= op;
 233.176 -                bits -= op;
 233.177 -            }
 233.178 -            Tracevv((stderr, "inflate:         length %u\n", len));
 233.179 -            if (bits < 15) {
 233.180 -                hold += (unsigned long)(PUP(in)) << bits;
 233.181 -                bits += 8;
 233.182 -                hold += (unsigned long)(PUP(in)) << bits;
 233.183 -                bits += 8;
 233.184 -            }
 233.185 -            this = dcode[hold & dmask];
 233.186 -          dodist:
 233.187 -            op = (unsigned)(this.bits);
 233.188 -            hold >>= op;
 233.189 -            bits -= op;
 233.190 -            op = (unsigned)(this.op);
 233.191 -            if (op & 16) {                      /* distance base */
 233.192 -                dist = (unsigned)(this.val);
 233.193 -                op &= 15;                       /* number of extra bits */
 233.194 -                if (bits < op) {
 233.195 -                    hold += (unsigned long)(PUP(in)) << bits;
 233.196 -                    bits += 8;
 233.197 -                    if (bits < op) {
 233.198 -                        hold += (unsigned long)(PUP(in)) << bits;
 233.199 -                        bits += 8;
 233.200 -                    }
 233.201 -                }
 233.202 -                dist += (unsigned)hold & ((1U << op) - 1);
 233.203 -#ifdef INFLATE_STRICT
 233.204 -                if (dist > dmax) {
 233.205 -                    strm->msg = (char *)"invalid distance too far back";
 233.206 -                    state->mode = BAD;
 233.207 -                    break;
 233.208 -                }
 233.209 -#endif
 233.210 -                hold >>= op;
 233.211 -                bits -= op;
 233.212 -                Tracevv((stderr, "inflate:         distance %u\n", dist));
 233.213 -                op = (unsigned)(out - beg);     /* max distance in output */
 233.214 -                if (dist > op) {                /* see if copy from window */
 233.215 -                    op = dist - op;             /* distance back in window */
 233.216 -                    if (op > whave) {
 233.217 -                        strm->msg = (char *)"invalid distance too far back";
 233.218 -                        state->mode = BAD;
 233.219 -                        break;
 233.220 -                    }
 233.221 -                    from = window - OFF;
 233.222 -                    if (write == 0) {           /* very common case */
 233.223 -                        from += wsize - op;
 233.224 -                        if (op < len) {         /* some from window */
 233.225 -                            len -= op;
 233.226 -                            do {
 233.227 -                                PUP(out) = PUP(from);
 233.228 -                            } while (--op);
 233.229 -                            from = out - dist;  /* rest from output */
 233.230 -                        }
 233.231 -                    }
 233.232 -                    else if (write < op) {      /* wrap around window */
 233.233 -                        from += wsize + write - op;
 233.234 -                        op -= write;
 233.235 -                        if (op < len) {         /* some from end of window */
 233.236 -                            len -= op;
 233.237 -                            do {
 233.238 -                                PUP(out) = PUP(from);
 233.239 -                            } while (--op);
 233.240 -                            from = window - OFF;
 233.241 -                            if (write < len) {  /* some from start of window */
 233.242 -                                op = write;
 233.243 -                                len -= op;
 233.244 -                                do {
 233.245 -                                    PUP(out) = PUP(from);
 233.246 -                                } while (--op);
 233.247 -                                from = out - dist;      /* rest from output */
 233.248 -                            }
 233.249 -                        }
 233.250 -                    }
 233.251 -                    else {                      /* contiguous in window */
 233.252 -                        from += write - op;
 233.253 -                        if (op < len) {         /* some from window */
 233.254 -                            len -= op;
 233.255 -                            do {
 233.256 -                                PUP(out) = PUP(from);
 233.257 -                            } while (--op);
 233.258 -                            from = out - dist;  /* rest from output */
 233.259 -                        }
 233.260 -                    }
 233.261 -                    while (len > 2) {
 233.262 -                        PUP(out) = PUP(from);
 233.263 -                        PUP(out) = PUP(from);
 233.264 -                        PUP(out) = PUP(from);
 233.265 -                        len -= 3;
 233.266 -                    }
 233.267 -                    if (len) {
 233.268 -                        PUP(out) = PUP(from);
 233.269 -                        if (len > 1)
 233.270 -                            PUP(out) = PUP(from);
 233.271 -                    }
 233.272 -                }
 233.273 -                else {
 233.274 -                    from = out - dist;          /* copy direct from output */
 233.275 -                    do {                        /* minimum length is three */
 233.276 -                        PUP(out) = PUP(from);
 233.277 -                        PUP(out) = PUP(from);
 233.278 -                        PUP(out) = PUP(from);
 233.279 -                        len -= 3;
 233.280 -                    } while (len > 2);
 233.281 -                    if (len) {
 233.282 -                        PUP(out) = PUP(from);
 233.283 -                        if (len > 1)
 233.284 -                            PUP(out) = PUP(from);
 233.285 -                    }
 233.286 -                }
 233.287 -            }
 233.288 -            else if ((op & 64) == 0) {          /* 2nd level distance code */
 233.289 -                this = dcode[this.val + (hold & ((1U << op) - 1))];
 233.290 -                goto dodist;
 233.291 -            }
 233.292 -            else {
 233.293 -                strm->msg = (char *)"invalid distance code";
 233.294 -                state->mode = BAD;
 233.295 -                break;
 233.296 -            }
 233.297 -        }
 233.298 -        else if ((op & 64) == 0) {              /* 2nd level length code */
 233.299 -            this = lcode[this.val + (hold & ((1U << op) - 1))];
 233.300 -            goto dolen;
 233.301 -        }
 233.302 -        else if (op & 32) {                     /* end-of-block */
 233.303 -            Tracevv((stderr, "inflate:         end of block\n"));
 233.304 -            state->mode = TYPE;
 233.305 -            break;
 233.306 -        }
 233.307 -        else {
 233.308 -            strm->msg = (char *)"invalid literal/length code";
 233.309 -            state->mode = BAD;
 233.310 -            break;
 233.311 -        }
 233.312 -    } while (in < last && out < end);
 233.313 -
 233.314 -    /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
 233.315 -    len = bits >> 3;
 233.316 -    in -= len;
 233.317 -    bits -= len << 3;
 233.318 -    hold &= (1U << bits) - 1;
 233.319 -
 233.320 -    /* update state and return */
 233.321 -    strm->next_in = in + OFF;
 233.322 -    strm->next_out = out + OFF;
 233.323 -    strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
 233.324 -    strm->avail_out = (unsigned)(out < end ?
 233.325 -                                 257 + (end - out) : 257 - (out - end));
 233.326 -    state->hold = hold;
 233.327 -    state->bits = bits;
 233.328 -    return;
 233.329 -}
 233.330 -
 233.331 -/*
 233.332 -   inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe):
 233.333 -   - Using bit fields for code structure
 233.334 -   - Different op definition to avoid & for extra bits (do & for table bits)
 233.335 -   - Three separate decoding do-loops for direct, window, and write == 0
 233.336 -   - Special case for distance > 1 copies to do overlapped load and store copy
 233.337 -   - Explicit branch predictions (based on measured branch probabilities)
 233.338 -   - Deferring match copy and interspersed it with decoding subsequent codes
 233.339 -   - Swapping literal/length else
 233.340 -   - Swapping window/direct else
 233.341 -   - Larger unrolled copy loops (three is about right)
 233.342 -   - Moving len -= 3 statement into middle of loop
 233.343 - */
 233.344 -
 233.345 -#endif /* !ASMINF */
   234.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/inffast.h	Tue Dec 06 16:31:58 2011 -0800
   234.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   234.3 @@ -1,35 +0,0 @@
   234.4 -/*
   234.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   234.6 - *
   234.7 - * This code is free software; you can redistribute it and/or modify it
   234.8 - * under the terms of the GNU General Public License version 2 only, as
   234.9 - * published by the Free Software Foundation.  Oracle designates this
  234.10 - * particular file as subject to the "Classpath" exception as provided
  234.11 - * by Oracle in the LICENSE file that accompanied this code.
  234.12 - *
  234.13 - * This code is distributed in the hope that it will be useful, but WITHOUT
  234.14 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  234.15 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  234.16 - * version 2 for more details (a copy is included in the LICENSE file that
  234.17 - * accompanied this code).
  234.18 - *
  234.19 - * You should have received a copy of the GNU General Public License version
  234.20 - * 2 along with this work; if not, write to the Free Software Foundation,
  234.21 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  234.22 - *
  234.23 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  234.24 - * or visit www.oracle.com if you need additional information or have any
  234.25 - * questions.
  234.26 - */
  234.27 -
  234.28 -/* inffast.h -- header to use inffast.c
  234.29 - * Copyright (C) 1995-2003 Mark Adler
  234.30 - * For conditions of distribution and use, see copyright notice in zlib.h
  234.31 - */
  234.32 -
  234.33 -/* WARNING: this file should *not* be used by applications. It is
  234.34 -   part of the implementation of the compression library and is
  234.35 -   subject to change. Applications should only use zlib.h.
  234.36 - */
  234.37 -
  234.38 -void inflate_fast OF((z_streamp strm, unsigned start));
   235.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/inffixed.h	Tue Dec 06 16:31:58 2011 -0800
   235.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   235.3 @@ -1,118 +0,0 @@
   235.4 -/*
   235.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   235.6 - *
   235.7 - * This code is free software; you can redistribute it and/or modify it
   235.8 - * under the terms of the GNU General Public License version 2 only, as
   235.9 - * published by the Free Software Foundation.  Oracle designates this
  235.10 - * particular file as subject to the "Classpath" exception as provided
  235.11 - * by Oracle in the LICENSE file that accompanied this code.
  235.12 - *
  235.13 - * This code is distributed in the hope that it will be useful, but WITHOUT
  235.14 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  235.15 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  235.16 - * version 2 for more details (a copy is included in the LICENSE file that
  235.17 - * accompanied this code).
  235.18 - *
  235.19 - * You should have received a copy of the GNU General Public License version
  235.20 - * 2 along with this work; if not, write to the Free Software Foundation,
  235.21 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  235.22 - *
  235.23 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  235.24 - * or visit www.oracle.com if you need additional information or have any
  235.25 - * questions.
  235.26 - */
  235.27 -
  235.28 -    /* inffixed.h -- table for decoding fixed codes
  235.29 -     * Generated automatically by makefixed().
  235.30 -     */
  235.31 -
  235.32 -    /* WARNING: this file should *not* be used by applications. It
  235.33 -       is part of the implementation of the compression library and
  235.34 -       is subject to change. Applications should only use zlib.h.
  235.35 -     */
  235.36 -
  235.37 -    static const code lenfix[512] = {
  235.38 -        {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48},
  235.39 -        {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128},
  235.40 -        {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59},
  235.41 -        {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176},
  235.42 -        {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20},
  235.43 -        {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100},
  235.44 -        {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8},
  235.45 -        {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216},
  235.46 -        {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76},
  235.47 -        {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114},
  235.48 -        {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},
  235.49 -        {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148},
  235.50 -        {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42},
  235.51 -        {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86},
  235.52 -        {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15},
  235.53 -        {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236},
  235.54 -        {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62},
  235.55 -        {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},
  235.56 -        {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31},
  235.57 -        {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162},
  235.58 -        {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25},
  235.59 -        {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105},
  235.60 -        {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4},
  235.61 -        {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202},
  235.62 -        {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69},
  235.63 -        {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125},
  235.64 -        {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13},
  235.65 -        {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195},
  235.66 -        {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35},
  235.67 -        {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91},
  235.68 -        {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19},
  235.69 -        {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246},
  235.70 -        {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55},
  235.71 -        {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135},
  235.72 -        {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99},
  235.73 -        {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190},
  235.74 -        {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16},
  235.75 -        {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96},
  235.76 -        {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6},
  235.77 -        {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209},
  235.78 -        {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},
  235.79 -        {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116},
  235.80 -        {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4},
  235.81 -        {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153},
  235.82 -        {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44},
  235.83 -        {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82},
  235.84 -        {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11},
  235.85 -        {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},
  235.86 -        {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58},
  235.87 -        {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138},
  235.88 -        {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51},
  235.89 -        {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173},
  235.90 -        {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30},
  235.91 -        {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110},
  235.92 -        {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0},
  235.93 -        {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195},
  235.94 -        {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65},
  235.95 -        {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121},
  235.96 -        {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},
  235.97 -        {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258},
  235.98 -        {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37},
  235.99 -        {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93},
 235.100 -        {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23},
 235.101 -        {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251},
 235.102 -        {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51},
 235.103 -        {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},
 235.104 -        {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67},
 235.105 -        {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183},
 235.106 -        {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23},
 235.107 -        {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103},
 235.108 -        {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9},
 235.109 -        {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223},
 235.110 -        {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79},
 235.111 -        {0,9,255}
 235.112 -    };
 235.113 -
 235.114 -    static const code distfix[32] = {
 235.115 -        {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025},
 235.116 -        {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193},
 235.117 -        {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385},
 235.118 -        {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577},
 235.119 -        {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073},
 235.120 -        {22,5,193},{64,5,0}
 235.121 -    };
   236.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/inflate.c	Tue Dec 06 16:31:58 2011 -0800
   236.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   236.3 @@ -1,1392 +0,0 @@
   236.4 -/*
   236.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   236.6 - *
   236.7 - * This code is free software; you can redistribute it and/or modify it
   236.8 - * under the terms of the GNU General Public License version 2 only, as
   236.9 - * published by the Free Software Foundation.  Oracle designates this
  236.10 - * particular file as subject to the "Classpath" exception as provided
  236.11 - * by Oracle in the LICENSE file that accompanied this code.
  236.12 - *
  236.13 - * This code is distributed in the hope that it will be useful, but WITHOUT
  236.14 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  236.15 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  236.16 - * version 2 for more details (a copy is included in the LICENSE file that
  236.17 - * accompanied this code).
  236.18 - *
  236.19 - * You should have received a copy of the GNU General Public License version
  236.20 - * 2 along with this work; if not, write to the Free Software Foundation,
  236.21 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  236.22 - *
  236.23 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  236.24 - * or visit www.oracle.com if you need additional information or have any
  236.25 - * questions.
  236.26 - */
  236.27 -
  236.28 -/* inflate.c -- zlib decompression
  236.29 - * Copyright (C) 1995-2005 Mark Adler
  236.30 - * For conditions of distribution and use, see copyright notice in zlib.h
  236.31 - */
  236.32 -
  236.33 -/*
  236.34 - * Change history:
  236.35 - *
  236.36 - * 1.2.beta0    24 Nov 2002
  236.37 - * - First version -- complete rewrite of inflate to simplify code, avoid
  236.38 - *   creation of window when not needed, minimize use of window when it is
  236.39 - *   needed, make inffast.c even faster, implement gzip decoding, and to
  236.40 - *   improve code readability and style over the previous zlib inflate code
  236.41 - *
  236.42 - * 1.2.beta1    25 Nov 2002
  236.43 - * - Use pointers for available input and output checking in inffast.c
  236.44 - * - Remove input and output counters in inffast.c
  236.45 - * - Change inffast.c entry and loop from avail_in >= 7 to >= 6
  236.46 - * - Remove unnecessary second byte pull from length extra in inffast.c
  236.47 - * - Unroll direct copy to three copies per loop in inffast.c
  236.48 - *
  236.49 - * 1.2.beta2    4 Dec 2002
  236.50 - * - Change external routine names to reduce potential conflicts
  236.51 - * - Correct filename to inffixed.h for fixed tables in inflate.c
  236.52 - * - Make hbuf[] unsigned char to match parameter type in inflate.c
  236.53 - * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset)
  236.54 - *   to avoid negation problem on Alphas (64 bit) in inflate.c
  236.55 - *
  236.56 - * 1.2.beta3    22 Dec 2002
  236.57 - * - Add comments on state->bits assertion in inffast.c
  236.58 - * - Add comments on op field in inftrees.h
  236.59 - * - Fix bug in reuse of allocated window after inflateReset()
  236.60 - * - Remove bit fields--back to byte structure for speed
  236.61 - * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths
  236.62 - * - Change post-increments to pre-increments in inflate_fast(), PPC biased?
  236.63 - * - Add compile time option, POSTINC, to use post-increments instead (Intel?)
  236.64 - * - Make MATCH copy in inflate() much faster for when inflate_fast() not used
  236.65 - * - Use local copies of stream next and avail values, as well as local bit
  236.66 - *   buffer and bit count in inflate()--for speed when inflate_fast() not used
  236.67 - *
  236.68 - * 1.2.beta4    1 Jan 2003
  236.69 - * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings
  236.70 - * - Move a comment on output buffer sizes from inffast.c to inflate.c
  236.71 - * - Add comments in inffast.c to introduce the inflate_fast() routine
  236.72 - * - Rearrange window copies in inflate_fast() for speed and simplification
  236.73 - * - Unroll last copy for window match in inflate_fast()
  236.74 - * - Use local copies of window variables in inflate_fast() for speed
  236.75 - * - Pull out common write == 0 case for speed in inflate_fast()
  236.76 - * - Make op and len in inflate_fast() unsigned for consistency
  236.77 - * - Add FAR to lcode and dcode declarations in inflate_fast()
  236.78 - * - Simplified bad distance check in inflate_fast()
  236.79 - * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new
  236.80 - *   source file infback.c to provide a call-back interface to inflate for
  236.81 - *   programs like gzip and unzip -- uses window as output buffer to avoid
  236.82 - *   window copying
  236.83 - *
  236.84 - * 1.2.beta5    1 Jan 2003
  236.85 - * - Improved inflateBack() interface to allow the caller to provide initial
  236.86 - *   input in strm.
  236.87 - * - Fixed stored blocks bug in inflateBack()
  236.88 - *
  236.89 - * 1.2.beta6    4 Jan 2003
  236.90 - * - Added comments in inffast.c on effectiveness of POSTINC
  236.91 - * - Typecasting all around to reduce compiler warnings
  236.92 - * - Changed loops from while (1) or do {} while (1) to for (;;), again to
  236.93 - *   make compilers happy
  236.94 - * - Changed type of window in inflateBackInit() to unsigned char *
  236.95 - *
  236.96 - * 1.2.beta7    27 Jan 2003
  236.97 - * - Changed many types to unsigned or unsigned short to avoid warnings
  236.98 - * - Added inflateCopy() function
  236.99 - *
 236.100 - * 1.2.0        9 Mar 2003
 236.101 - * - Changed inflateBack() interface to provide separate opaque descriptors
 236.102 - *   for the in() and out() functions
 236.103 - * - Changed inflateBack() argument and in_func typedef to swap the length
 236.104 - *   and buffer address return values for the input function
 236.105 - * - Check next_in and next_out for Z_NULL on entry to inflate()
 236.106 - *
 236.107 - * The history for versions after 1.2.0 are in ChangeLog in zlib distribution.
 236.108 - */
 236.109 -
 236.110 -#include "zutil.h"
 236.111 -#include "inftrees.h"
 236.112 -#include "inflate.h"
 236.113 -#include "inffast.h"
 236.114 -
 236.115 -#ifdef MAKEFIXED
 236.116 -#  ifndef BUILDFIXED
 236.117 -#    define BUILDFIXED
 236.118 -#  endif
 236.119 -#endif
 236.120 -
 236.121 -/* function prototypes */
 236.122 -local void fixedtables OF((struct inflate_state FAR *state));
 236.123 -local int updatewindow OF((z_streamp strm, unsigned out));
 236.124 -#ifdef BUILDFIXED
 236.125 -   void makefixed OF((void));
 236.126 -#endif
 236.127 -local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf,
 236.128 -                              unsigned len));
 236.129 -
 236.130 -int ZEXPORT inflateReset(strm)
 236.131 -z_streamp strm;
 236.132 -{
 236.133 -    struct inflate_state FAR *state;
 236.134 -
 236.135 -    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
 236.136 -    state = (struct inflate_state FAR *)strm->state;
 236.137 -    strm->total_in = strm->total_out = state->total = 0;
 236.138 -    strm->msg = Z_NULL;
 236.139 -    strm->adler = 1;        /* to support ill-conceived Java test suite */
 236.140 -    state->mode = HEAD;
 236.141 -    state->last = 0;
 236.142 -    state->havedict = 0;
 236.143 -    state->dmax = 32768U;
 236.144 -    state->head = Z_NULL;
 236.145 -    state->wsize = 0;
 236.146 -    state->whave = 0;
 236.147 -    state->write = 0;
 236.148 -    state->hold = 0;
 236.149 -    state->bits = 0;
 236.150 -    state->lencode = state->distcode = state->next = state->codes;
 236.151 -    Tracev((stderr, "inflate: reset\n"));
 236.152 -    return Z_OK;
 236.153 -}
 236.154 -
 236.155 -int ZEXPORT inflatePrime(strm, bits, value)
 236.156 -z_streamp strm;
 236.157 -int bits;
 236.158 -int value;
 236.159 -{
 236.160 -    struct inflate_state FAR *state;
 236.161 -
 236.162 -    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
 236.163 -    state = (struct inflate_state FAR *)strm->state;
 236.164 -    if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR;
 236.165 -    value &= (1L << bits) - 1;
 236.166 -    state->hold += value << state->bits;
 236.167 -    state->bits += bits;
 236.168 -    return Z_OK;
 236.169 -}
 236.170 -
 236.171 -int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size)
 236.172 -z_streamp strm;
 236.173 -int windowBits;
 236.174 -const char *version;
 236.175 -int stream_size;
 236.176 -{
 236.177 -    struct inflate_state FAR *state;
 236.178 -
 236.179 -    if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
 236.180 -        stream_size != (int)(sizeof(z_stream)))
 236.181 -        return Z_VERSION_ERROR;
 236.182 -    if (strm == Z_NULL) return Z_STREAM_ERROR;
 236.183 -    strm->msg = Z_NULL;                 /* in case we return an error */
 236.184 -    if (strm->zalloc == (alloc_func)0) {
 236.185 -        strm->zalloc = zcalloc;
 236.186 -        strm->opaque = (voidpf)0;
 236.187 -    }
 236.188 -    if (strm->zfree == (free_func)0) strm->zfree = zcfree;
 236.189 -    state = (struct inflate_state FAR *)
 236.190 -            ZALLOC(strm, 1, sizeof(struct inflate_state));
 236.191 -    if (state == Z_NULL) return Z_MEM_ERROR;
 236.192 -    Tracev((stderr, "inflate: allocated\n"));
 236.193 -    strm->state = (struct internal_state FAR *)state;
 236.194 -    if (windowBits < 0) {
 236.195 -        state->wrap = 0;
 236.196 -        windowBits = -windowBits;
 236.197 -    }
 236.198 -    else {
 236.199 -        state->wrap = (windowBits >> 4) + 1;
 236.200 -#ifdef GUNZIP
 236.201 -        if (windowBits < 48) windowBits &= 15;
 236.202 -#endif
 236.203 -    }
 236.204 -    if (windowBits < 8 || windowBits > 15) {
 236.205 -        ZFREE(strm, state);
 236.206 -        strm->state = Z_NULL;
 236.207 -        return Z_STREAM_ERROR;
 236.208 -    }
 236.209 -    state->wbits = (unsigned)windowBits;
 236.210 -    state->window = Z_NULL;
 236.211 -    return inflateReset(strm);
 236.212 -}
 236.213 -
 236.214 -int ZEXPORT inflateInit_(strm, version, stream_size)
 236.215 -z_streamp strm;
 236.216 -const char *version;
 236.217 -int stream_size;
 236.218 -{
 236.219 -    return inflateInit2_(strm, DEF_WBITS, version, stream_size);
 236.220 -}
 236.221 -
 236.222 -/*
 236.223 -   Return state with length and distance decoding tables and index sizes set to
 236.224 -   fixed code decoding.  Normally this returns fixed tables from inffixed.h.
 236.225 -   If BUILDFIXED is defined, then instead this routine builds the tables the
 236.226 -   first time it's called, and returns those tables the first time and
 236.227 -   thereafter.  This reduces the size of the code by about 2K bytes, in
 236.228 -   exchange for a little execution time.  However, BUILDFIXED should not be
 236.229 -   used for threaded applications, since the rewriting of the tables and virgin
 236.230 -   may not be thread-safe.
 236.231 - */
 236.232 -local void fixedtables(state)
 236.233 -struct inflate_state FAR *state;
 236.234 -{
 236.235 -#ifdef BUILDFIXED
 236.236 -    static int virgin = 1;
 236.237 -    static code *lenfix, *distfix;
 236.238 -    static code fixed[544];
 236.239 -
 236.240 -    /* build fixed huffman tables if first call (may not be thread safe) */
 236.241 -    if (virgin) {
 236.242 -        unsigned sym, bits;
 236.243 -        static code *next;
 236.244 -
 236.245 -        /* literal/length table */
 236.246 -        sym = 0;
 236.247 -        while (sym < 144) state->lens[sym++] = 8;
 236.248 -        while (sym < 256) state->lens[sym++] = 9;
 236.249 -        while (sym < 280) state->lens[sym++] = 7;
 236.250 -        while (sym < 288) state->lens[sym++] = 8;
 236.251 -        next = fixed;
 236.252 -        lenfix = next;
 236.253 -        bits = 9;
 236.254 -        inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
 236.255 -
 236.256 -        /* distance table */
 236.257 -        sym = 0;
 236.258 -        while (sym < 32) state->lens[sym++] = 5;
 236.259 -        distfix = next;
 236.260 -        bits = 5;
 236.261 -        inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
 236.262 -
 236.263 -        /* do this just once */
 236.264 -        virgin = 0;
 236.265 -    }
 236.266 -#else /* !BUILDFIXED */
 236.267 -#   include "inffixed.h"
 236.268 -#endif /* BUILDFIXED */
 236.269 -    state->lencode = lenfix;
 236.270 -    state->lenbits = 9;
 236.271 -    state->distcode = distfix;
 236.272 -    state->distbits = 5;
 236.273 -}
 236.274 -
 236.275 -#ifdef MAKEFIXED
 236.276 -#include <stdio.h>
 236.277 -
 236.278 -/*
 236.279 -   Write out the inffixed.h that is #include'd above.  Defining MAKEFIXED also
 236.280 -   defines BUILDFIXED, so the tables are built on the fly.  makefixed() writes
 236.281 -   those tables to stdout, which would be piped to inffixed.h.  A small program
 236.282 -   can simply call makefixed to do this:
 236.283 -
 236.284 -    void makefixed(void);
 236.285 -
 236.286 -    int main(void)
 236.287 -    {
 236.288 -        makefixed();
 236.289 -        return 0;
 236.290 -    }
 236.291 -
 236.292 -   Then that can be linked with zlib built with MAKEFIXED defined and run:
 236.293 -
 236.294 -    a.out > inffixed.h
 236.295 - */
 236.296 -void makefixed()
 236.297 -{
 236.298 -    unsigned low, size;
 236.299 -    struct inflate_state state;
 236.300 -
 236.301 -    fixedtables(&state);
 236.302 -    puts("    /* inffixed.h -- table for decoding fixed codes");
 236.303 -    puts("     * Generated automatically by makefixed().");
 236.304 -    puts("     */");
 236.305 -    puts("");
 236.306 -    puts("    /* WARNING: this file should *not* be used by applications.");
 236.307 -    puts("       It is part of the implementation of this library and is");
 236.308 -    puts("       subject to change. Applications should only use zlib.h.");
 236.309 -    puts("     */");
 236.310 -    puts("");
 236.311 -    size = 1U << 9;
 236.312 -    printf("    static const code lenfix[%u] = {", size);
 236.313 -    low = 0;
 236.314 -    for (;;) {
 236.315 -        if ((low % 7) == 0) printf("\n        ");
 236.316 -        printf("{%u,%u,%d}", state.lencode[low].op, state.lencode[low].bits,
 236.317 -               state.lencode[low].val);
 236.318 -        if (++low == size) break;
 236.319 -        putchar(',');
 236.320 -    }
 236.321 -    puts("\n    };");
 236.322 -    size = 1U << 5;
 236.323 -    printf("\n    static const code distfix[%u] = {", size);
 236.324 -    low = 0;
 236.325 -    for (;;) {
 236.326 -        if ((low % 6) == 0) printf("\n        ");
 236.327 -        printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits,
 236.328 -               state.distcode[low].val);
 236.329 -        if (++low == size) break;
 236.330 -        putchar(',');
 236.331 -    }
 236.332 -    puts("\n    };");
 236.333 -}
 236.334 -#endif /* MAKEFIXED */
 236.335 -
 236.336 -/*
 236.337 -   Update the window with the last wsize (normally 32K) bytes written before
 236.338 -   returning.  If window does not exist yet, create it.  This is only called
 236.339 -   when a window is already in use, or when output has been written during this
 236.340 -   inflate call, but the end of the deflate stream has not been reached yet.
 236.341 -   It is also called to create a window for dictionary data when a dictionary
 236.342 -   is loaded.
 236.343 -
 236.344 -   Providing output buffers larger than 32K to inflate() should provide a speed
 236.345 -   advantage, since only the last 32K of output is copied to the sliding window
 236.346 -   upon return from inflate(), and since all distances after the first 32K of
 236.347 -   output will fall in the output data, making match copies simpler and faster.
 236.348 -   The advantage may be dependent on the size of the processor's data caches.
 236.349 - */
 236.350 -local int updatewindow(strm, out)
 236.351 -z_streamp strm;
 236.352 -unsigned out;
 236.353 -{
 236.354 -    struct inflate_state FAR *state;
 236.355 -    unsigned copy, dist;
 236.356 -
 236.357 -    state = (struct inflate_state FAR *)strm->state;
 236.358 -
 236.359 -    /* if it hasn't been done already, allocate space for the window */
 236.360 -    if (state->window == Z_NULL) {
 236.361 -        state->window = (unsigned char FAR *)
 236.362 -                        ZALLOC(strm, 1U << state->wbits,
 236.363 -                               sizeof(unsigned char));
 236.364 -        if (state->window == Z_NULL) return 1;
 236.365 -    }
 236.366 -
 236.367 -    /* if window not in use yet, initialize */
 236.368 -    if (state->wsize == 0) {
 236.369 -        state->wsize = 1U << state->wbits;
 236.370 -        state->write = 0;
 236.371 -        state->whave = 0;
 236.372 -    }
 236.373 -
 236.374 -    /* copy state->wsize or less output bytes into the circular window */
 236.375 -    copy = out - strm->avail_out;
 236.376 -    if (copy >= state->wsize) {
 236.377 -        zmemcpy(state->window, strm->next_out - state->wsize, state->wsize);
 236.378 -        state->write = 0;
 236.379 -        state->whave = state->wsize;
 236.380 -    }
 236.381 -    else {
 236.382 -        dist = state->wsize - state->write;
 236.383 -        if (dist > copy) dist = copy;
 236.384 -        zmemcpy(state->window + state->write, strm->next_out - copy, dist);
 236.385 -        copy -= dist;
 236.386 -        if (copy) {
 236.387 -            zmemcpy(state->window, strm->next_out - copy, copy);
 236.388 -            state->write = copy;
 236.389 -            state->whave = state->wsize;
 236.390 -        }
 236.391 -        else {
 236.392 -            state->write += dist;
 236.393 -            if (state->write == state->wsize) state->write = 0;
 236.394 -            if (state->whave < state->wsize) state->whave += dist;
 236.395 -        }
 236.396 -    }
 236.397 -    return 0;
 236.398 -}
 236.399 -
 236.400 -/* Macros for inflate(): */
 236.401 -
 236.402 -/* check function to use adler32() for zlib or crc32() for gzip */
 236.403 -#ifdef GUNZIP
 236.404 -#  define UPDATE(check, buf, len) \
 236.405 -    (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
 236.406 -#else
 236.407 -#  define UPDATE(check, buf, len) adler32(check, buf, len)
 236.408 -#endif
 236.409 -
 236.410 -/* check macros for header crc */
 236.411 -#ifdef GUNZIP
 236.412 -#  define CRC2(check, word) \
 236.413 -    do { \
 236.414 -        hbuf[0] = (unsigned char)(word); \
 236.415 -        hbuf[1] = (unsigned char)((word) >> 8); \
 236.416 -        check = crc32(check, hbuf, 2); \
 236.417 -    } while (0)
 236.418 -
 236.419 -#  define CRC4(check, word) \
 236.420 -    do { \
 236.421 -        hbuf[0] = (unsigned char)(word); \
 236.422 -        hbuf[1] = (unsigned char)((word) >> 8); \
 236.423 -        hbuf[2] = (unsigned char)((word) >> 16); \
 236.424 -        hbuf[3] = (unsigned char)((word) >> 24); \
 236.425 -        check = crc32(check, hbuf, 4); \
 236.426 -    } while (0)
 236.427 -#endif
 236.428 -
 236.429 -/* Load registers with state in inflate() for speed */
 236.430 -#define LOAD() \
 236.431 -    do { \
 236.432 -        put = strm->next_out; \
 236.433 -        left = strm->avail_out; \
 236.434 -        next = strm->next_in; \
 236.435 -        have = strm->avail_in; \
 236.436 -        hold = state->hold; \
 236.437 -        bits = state->bits; \
 236.438 -    } while (0)
 236.439 -
 236.440 -/* Restore state from registers in inflate() */
 236.441 -#define RESTORE() \
 236.442 -    do { \
 236.443 -        strm->next_out = put; \
 236.444 -        strm->avail_out = left; \
 236.445 -        strm->next_in = next; \
 236.446 -        strm->avail_in = have; \
 236.447 -        state->hold = hold; \
 236.448 -        state->bits = bits; \
 236.449 -    } while (0)
 236.450 -
 236.451 -/* Clear the input bit accumulator */
 236.452 -#define INITBITS() \
 236.453 -    do { \
 236.454 -        hold = 0; \
 236.455 -        bits = 0; \
 236.456 -    } while (0)
 236.457 -
 236.458 -/* Get a byte of input into the bit accumulator, or return from inflate()
 236.459 -   if there is no input available. */
 236.460 -#define PULLBYTE() \
 236.461 -    do { \
 236.462 -        if (have == 0) goto inf_leave; \
 236.463 -        have--; \
 236.464 -        hold += (unsigned long)(*next++) << bits; \
 236.465 -        bits += 8; \
 236.466 -    } while (0)
 236.467 -
 236.468 -/* Assure that there are at least n bits in the bit accumulator.  If there is
 236.469 -   not enough available input to do that, then return from inflate(). */
 236.470 -#define NEEDBITS(n) \
 236.471 -    do { \
 236.472 -        while (bits < (unsigned)(n)) \
 236.473 -            PULLBYTE(); \
 236.474 -    } while (0)
 236.475 -
 236.476 -/* Return the low n bits of the bit accumulator (n < 16) */
 236.477 -#define BITS(n) \
 236.478 -    ((unsigned)hold & ((1U << (n)) - 1))
 236.479 -
 236.480 -/* Remove n bits from the bit accumulator */
 236.481 -#define DROPBITS(n) \
 236.482 -    do { \
 236.483 -        hold >>= (n); \
 236.484 -        bits -= (unsigned)(n); \
 236.485 -    } while (0)
 236.486 -
 236.487 -/* Remove zero to seven bits as needed to go to a byte boundary */
 236.488 -#define BYTEBITS() \
 236.489 -    do { \
 236.490 -        hold >>= bits & 7; \
 236.491 -        bits -= bits & 7; \
 236.492 -    } while (0)
 236.493 -
 236.494 -/* Reverse the bytes in a 32-bit value */
 236.495 -#define REVERSE(q) \
 236.496 -    ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
 236.497 -     (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
 236.498 -
 236.499 -/*
 236.500 -   inflate() uses a state machine to process as much input data and generate as
 236.501 -   much output data as possible before returning.  The state machine is
 236.502 -   structured roughly as follows:
 236.503 -
 236.504 -    for (;;) switch (state) {
 236.505 -    ...
 236.506 -    case STATEn:
 236.507 -        if (not enough input data or output space to make progress)
 236.508 -            return;
 236.509 -        ... make progress ...
 236.510 -        state = STATEm;
 236.511 -        break;
 236.512 -    ...
 236.513 -    }
 236.514 -
 236.515 -   so when inflate() is called again, the same case is attempted again, and
 236.516 -   if the appropriate resources are provided, the machine proceeds to the
 236.517 -   next state.  The NEEDBITS() macro is usually the way the state evaluates
 236.518 -   whether it can proceed or should return.  NEEDBITS() does the return if
 236.519 -   the requested bits are not available.  The typical use of the BITS macros
 236.520 -   is:
 236.521 -
 236.522 -        NEEDBITS(n);
 236.523 -        ... do something with BITS(n) ...
 236.524 -        DROPBITS(n);
 236.525 -
 236.526 -   where NEEDBITS(n) either returns from inflate() if there isn't enough
 236.527 -   input left to load n bits into the accumulator, or it continues.  BITS(n)
 236.528 -   gives the low n bits in the accumulator.  When done, DROPBITS(n) drops
 236.529 -   the low n bits off the accumulator.  INITBITS() clears the accumulator
 236.530 -   and sets the number of available bits to zero.  BYTEBITS() discards just
 236.531 -   enough bits to put the accumulator on a byte boundary.  After BYTEBITS()
 236.532 -   and a NEEDBITS(8), then BITS(8) would return the next byte in the stream.
 236.533 -
 236.534 -   NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return
 236.535 -   if there is no input available.  The decoding of variable length codes uses
 236.536 -   PULLBYTE() directly in order to pull just enough bytes to decode the next
 236.537 -   code, and no more.
 236.538 -
 236.539 -   Some states loop until they get enough input, making sure that enough
 236.540 -   state information is maintained to continue the loop where it left off
 236.541 -   if NEEDBITS() returns in the loop.  For example, want, need, and keep
 236.542 -   would all have to actually be part of the saved state in case NEEDBITS()
 236.543 -   returns:
 236.544 -
 236.545 -    case STATEw:
 236.546 -        while (want < need) {
 236.547 -            NEEDBITS(n);
 236.548 -            keep[want++] = BITS(n);
 236.549 -            DROPBITS(n);
 236.550 -        }
 236.551 -        state = STATEx;
 236.552 -    case STATEx:
 236.553 -
 236.554 -   As shown above, if the next state is also the next case, then the break
 236.555 -   is omitted.
 236.556 -
 236.557 -   A state may also return if there is not enough output space available to
 236.558 -   complete that state.  Those states are copying stored data, writing a
 236.559 -   literal byte, and copying a matching string.
 236.560 -
 236.561 -   When returning, a "goto inf_leave" is used to update the total counters,
 236.562 -   update the check value, and determine whether any progress has been made
 236.563 -   during that inflate() call in order to return the proper return code.
 236.564 -   Progress is defined as a change in either strm->avail_in or strm->avail_out.
 236.565 -   When there is a window, goto inf_leave will update the window with the last
 236.566 -   output written.  If a goto inf_leave occurs in the middle of decompression
 236.567 -   and there is no window currently, goto inf_leave will create one and copy
 236.568 -   output to the window for the next call of inflate().
 236.569 -
 236.570 -   In this implementation, the flush parameter of inflate() only affects the
 236.571 -   return code (per zlib.h).  inflate() always writes as much as possible to
 236.572 -   strm->next_out, given the space available and the provided input--the effect
 236.573 -   documented in zlib.h of Z_SYNC_FLUSH.  Furthermore, inflate() always defers
 236.574 -   the allocation of and copying into a sliding window until necessary, which
 236.575 -   provides the effect documented in zlib.h for Z_FINISH when the entire input
 236.576 -   stream available.  So the only thing the flush parameter actually does is:
 236.577 -   when flush is set to Z_FINISH, inflate() cannot return Z_OK.  Instead it
 236.578 -   will return Z_BUF_ERROR if it has not reached the end of the stream.
 236.579 - */
 236.580 -
 236.581 -int ZEXPORT inflate(strm, flush)
 236.582 -z_streamp strm;
 236.583 -int flush;
 236.584 -{
 236.585 -    struct inflate_state FAR *state;
 236.586 -    unsigned char FAR *next;    /* next input */
 236.587 -    unsigned char FAR *put;     /* next output */
 236.588 -    unsigned have, left;        /* available input and output */
 236.589 -    unsigned long hold;         /* bit buffer */
 236.590 -    unsigned bits;              /* bits in bit buffer */
 236.591 -    unsigned in, out;           /* save starting available input and output */
 236.592 -    unsigned copy;              /* number of stored or match bytes to copy */
 236.593 -    unsigned char FAR *from;    /* where to copy match bytes from */
 236.594 -    code this;                  /* current decoding table entry */
 236.595 -    code last;                  /* parent table entry */
 236.596 -    unsigned len;               /* length to copy for repeats, bits to drop */
 236.597 -    int ret;                    /* return code */
 236.598 -#ifdef GUNZIP
 236.599 -    unsigned char hbuf[4];      /* buffer for gzip header crc calculation */
 236.600 -#endif
 236.601 -    static const unsigned short order[19] = /* permutation of code lengths */
 236.602 -        {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
 236.603 -
 236.604 -    if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL ||
 236.605 -        (strm->next_in == Z_NULL && strm->avail_in != 0))
 236.606 -        return Z_STREAM_ERROR;
 236.607 -
 236.608 -    state = (struct inflate_state FAR *)strm->state;
 236.609 -    if (state->mode == TYPE) state->mode = TYPEDO;      /* skip check */
 236.610 -    LOAD();
 236.611 -    in = have;
 236.612 -    out = left;
 236.613 -    ret = Z_OK;
 236.614 -    for (;;)
 236.615 -        switch (state->mode) {
 236.616 -        case HEAD:
 236.617 -            if (state->wrap == 0) {
 236.618 -                state->mode = TYPEDO;
 236.619 -                break;
 236.620 -            }
 236.621 -            NEEDBITS(16);
 236.622 -#ifdef GUNZIP
 236.623 -            if ((state->wrap & 2) && hold == 0x8b1f) {  /* gzip header */
 236.624 -                state->check = crc32(0L, Z_NULL, 0);
 236.625 -                CRC2(state->check, hold);
 236.626 -                INITBITS();
 236.627 -                state->mode = FLAGS;
 236.628 -                break;
 236.629 -            }
 236.630 -            state->flags = 0;           /* expect zlib header */
 236.631 -            if (state->head != Z_NULL)
 236.632 -                state->head->done = -1;
 236.633 -            if (!(state->wrap & 1) ||   /* check if zlib header allowed */
 236.634 -#else
 236.635 -            if (
 236.636 -#endif
 236.637 -                ((BITS(8) << 8) + (hold >> 8)) % 31) {
 236.638 -                strm->msg = (char *)"incorrect header check";
 236.639 -                state->mode = BAD;
 236.640 -                break;
 236.641 -            }
 236.642 -            if (BITS(4) != Z_DEFLATED) {
 236.643 -                strm->msg = (char *)"unknown compression method";
 236.644 -                state->mode = BAD;
 236.645 -                break;
 236.646 -            }
 236.647 -            DROPBITS(4);
 236.648 -            len = BITS(4) + 8;
 236.649 -            if (len > state->wbits) {
 236.650 -                strm->msg = (char *)"invalid window size";
 236.651 -                state->mode = BAD;
 236.652 -                break;
 236.653 -            }
 236.654 -            state->dmax = 1U << len;
 236.655 -            Tracev((stderr, "inflate:   zlib header ok\n"));
 236.656 -            strm->adler = state->check = adler32(0L, Z_NULL, 0);
 236.657 -            state->mode = hold & 0x200 ? DICTID : TYPE;
 236.658 -            INITBITS();
 236.659 -            break;
 236.660 -#ifdef GUNZIP
 236.661 -        case FLAGS:
 236.662 -            NEEDBITS(16);
 236.663 -            state->flags = (int)(hold);
 236.664 -            if ((state->flags & 0xff) != Z_DEFLATED) {
 236.665 -                strm->msg = (char *)"unknown compression method";
 236.666 -                state->mode = BAD;
 236.667 -                break;
 236.668 -            }
 236.669 -            if (state->flags & 0xe000) {
 236.670 -                strm->msg = (char *)"unknown header flags set";
 236.671 -                state->mode = BAD;
 236.672 -                break;
 236.673 -            }
 236.674 -            if (state->head != Z_NULL)
 236.675 -                state->head->text = (int)((hold >> 8) & 1);
 236.676 -            if (state->flags & 0x0200) CRC2(state->check, hold);
 236.677 -            INITBITS();
 236.678 -            state->mode = TIME;
 236.679 -        case TIME:
 236.680 -            NEEDBITS(32);
 236.681 -            if (state->head != Z_NULL)
 236.682 -                state->head->time = hold;
 236.683 -            if (state->flags & 0x0200) CRC4(state->check, hold);
 236.684 -            INITBITS();
 236.685 -            state->mode = OS;
 236.686 -        case OS:
 236.687 -            NEEDBITS(16);
 236.688 -            if (state->head != Z_NULL) {
 236.689 -                state->head->xflags = (int)(hold & 0xff);
 236.690 -                state->head->os = (int)(hold >> 8);
 236.691 -            }
 236.692 -            if (state->flags & 0x0200) CRC2(state->check, hold);
 236.693 -            INITBITS();
 236.694 -            state->mode = EXLEN;
 236.695 -        case EXLEN:
 236.696 -            if (state->flags & 0x0400) {
 236.697 -                NEEDBITS(16);
 236.698 -                state->length = (unsigned)(hold);
 236.699 -                if (state->head != Z_NULL)
 236.700 -                    state->head->extra_len = (unsigned)hold;
 236.701 -                if (state->flags & 0x0200) CRC2(state->check, hold);
 236.702 -                INITBITS();
 236.703 -            }
 236.704 -            else if (state->head != Z_NULL)
 236.705 -                state->head->extra = Z_NULL;
 236.706 -            state->mode = EXTRA;
 236.707 -        case EXTRA:
 236.708 -            if (state->flags & 0x0400) {
 236.709 -                copy = state->length;
 236.710 -                if (copy > have) copy = have;
 236.711 -                if (copy) {
 236.712 -                    if (state->head != Z_NULL &&
 236.713 -                        state->head->extra != Z_NULL) {
 236.714 -                        len = state->head->extra_len - state->length;
 236.715 -                        zmemcpy(state->head->extra + len, next,
 236.716 -                                len + copy > state->head->extra_max ?
 236.717 -                                state->head->extra_max - len : copy);
 236.718 -                    }
 236.719 -                    if (state->flags & 0x0200)
 236.720 -                        state->check = crc32(state->check, next, copy);
 236.721 -                    have -= copy;
 236.722 -                    next += copy;
 236.723 -                    state->length -= copy;
 236.724 -                }
 236.725 -                if (state->length) goto inf_leave;
 236.726 -            }
 236.727 -            state->length = 0;
 236.728 -            state->mode = NAME;
 236.729 -        case NAME:
 236.730 -            if (state->flags & 0x0800) {
 236.731 -                if (have == 0) goto inf_leave;
 236.732 -                copy = 0;
 236.733 -                do {
 236.734 -                    len = (unsigned)(next[copy++]);
 236.735 -                    if (state->head != Z_NULL &&
 236.736 -                            state->head->name != Z_NULL &&
 236.737 -                            state->length < state->head->name_max)
 236.738 -                        state->head->name[state->length++] = len;
 236.739 -                } while (len && copy < have);
 236.740 -                if (state->flags & 0x0200)
 236.741 -                    state->check = crc32(state->check, next, copy);
 236.742 -                have -= copy;
 236.743 -                next += copy;
 236.744 -                if (len) goto inf_leave;
 236.745 -            }
 236.746 -            else if (state->head != Z_NULL)
 236.747 -                state->head->name = Z_NULL;
 236.748 -            state->length = 0;
 236.749 -            state->mode = COMMENT;
 236.750 -        case COMMENT:
 236.751 -            if (state->flags & 0x1000) {
 236.752 -                if (have == 0) goto inf_leave;
 236.753 -                copy = 0;
 236.754 -                do {
 236.755 -                    len = (unsigned)(next[copy++]);
 236.756 -                    if (state->head != Z_NULL &&
 236.757 -                            state->head->comment != Z_NULL &&
 236.758 -                            state->length < state->head->comm_max)
 236.759 -                        state->head->comment[state->length++] = len;
 236.760 -                } while (len && copy < have);
 236.761 -                if (state->flags & 0x0200)
 236.762 -                    state->check = crc32(state->check, next, copy);
 236.763 -                have -= copy;
 236.764 -                next += copy;
 236.765 -                if (len) goto inf_leave;
 236.766 -            }
 236.767 -            else if (state->head != Z_NULL)
 236.768 -                state->head->comment = Z_NULL;
 236.769 -            state->mode = HCRC;
 236.770 -        case HCRC:
 236.771 -            if (state->flags & 0x0200) {
 236.772 -                NEEDBITS(16);
 236.773 -                if (hold != (state->check & 0xffff)) {
 236.774 -                    strm->msg = (char *)"header crc mismatch";
 236.775 -                    state->mode = BAD;
 236.776 -                    break;
 236.777 -                }
 236.778 -                INITBITS();
 236.779 -            }
 236.780 -            if (state->head != Z_NULL) {
 236.781 -                state->head->hcrc = (int)((state->flags >> 9) & 1);
 236.782 -                state->head->done = 1;
 236.783 -            }
 236.784 -            strm->adler = state->check = crc32(0L, Z_NULL, 0);
 236.785 -            state->mode = TYPE;
 236.786 -            break;
 236.787 -#endif
 236.788 -        case DICTID:
 236.789 -            NEEDBITS(32);
 236.790 -            strm->adler = state->check = REVERSE(hold);
 236.791 -            INITBITS();
 236.792 -            state->mode = DICT;
 236.793 -        case DICT:
 236.794 -            if (state->havedict == 0) {
 236.795 -                RESTORE();
 236.796 -                return Z_NEED_DICT;
 236.797 -            }
 236.798 -            strm->adler = state->check = adler32(0L, Z_NULL, 0);
 236.799 -            state->mode = TYPE;
 236.800 -        case TYPE:
 236.801 -            if (flush == Z_BLOCK) goto inf_leave;
 236.802 -        case TYPEDO:
 236.803 -            if (state->last) {
 236.804 -                BYTEBITS();
 236.805 -                state->mode = CHECK;
 236.806 -                break;
 236.807 -            }
 236.808 -            NEEDBITS(3);
 236.809 -            state->last = BITS(1);
 236.810 -            DROPBITS(1);
 236.811 -            switch (BITS(2)) {
 236.812 -            case 0:                             /* stored block */
 236.813 -                Tracev((stderr, "inflate:     stored block%s\n",
 236.814 -                        state->last ? " (last)" : ""));
 236.815 -                state->mode = STORED;
 236.816 -                break;
 236.817 -            case 1:                             /* fixed block */
 236.818 -                fixedtables(state);
 236.819 -                Tracev((stderr, "inflate:     fixed codes block%s\n",
 236.820 -                        state->last ? " (last)" : ""));
 236.821 -                state->mode = LEN;              /* decode codes */
 236.822 -                break;
 236.823 -            case 2:                             /* dynamic block */
 236.824 -                Tracev((stderr, "inflate:     dynamic codes block%s\n",
 236.825 -                        state->last ? " (last)" : ""));
 236.826 -                state->mode = TABLE;
 236.827 -                break;
 236.828 -            case 3:
 236.829 -                strm->msg = (char *)"invalid block type";
 236.830 -                state->mode = BAD;
 236.831 -            }
 236.832 -            DROPBITS(2);
 236.833 -            break;
 236.834 -        case STORED:
 236.835 -            BYTEBITS();                         /* go to byte boundary */
 236.836 -            NEEDBITS(32);
 236.837 -            if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
 236.838 -                strm->msg = (char *)"invalid stored block lengths";
 236.839 -                state->mode = BAD;
 236.840 -                break;
 236.841 -            }
 236.842 -            state->length = (unsigned)hold & 0xffff;
 236.843 -            Tracev((stderr, "inflate:       stored length %u\n",
 236.844 -                    state->length));
 236.845 -            INITBITS();
 236.846 -            state->mode = COPY;
 236.847 -        case COPY:
 236.848 -            copy = state->length;
 236.849 -            if (copy) {
 236.850 -                if (copy > have) copy = have;
 236.851 -                if (copy > left) copy = left;
 236.852 -                if (copy == 0) goto inf_leave;
 236.853 -                zmemcpy(put, next, copy);
 236.854 -                have -= copy;
 236.855 -                next += copy;
 236.856 -                left -= copy;
 236.857 -                put += copy;
 236.858 -                state->length -= copy;
 236.859 -                break;
 236.860 -            }
 236.861 -            Tracev((stderr, "inflate:       stored end\n"));
 236.862 -            state->mode = TYPE;
 236.863 -            break;
 236.864 -        case TABLE:
 236.865 -            NEEDBITS(14);
 236.866 -            state->nlen = BITS(5) + 257;
 236.867 -            DROPBITS(5);
 236.868 -            state->ndist = BITS(5) + 1;
 236.869 -            DROPBITS(5);
 236.870 -            state->ncode = BITS(4) + 4;
 236.871 -            DROPBITS(4);
 236.872 -#ifndef PKZIP_BUG_WORKAROUND
 236.873 -            if (state->nlen > 286 || state->ndist > 30) {
 236.874 -                strm->msg = (char *)"too many length or distance symbols";
 236.875 -                state->mode = BAD;
 236.876 -                break;
 236.877 -            }
 236.878 -#endif
 236.879 -            Tracev((stderr, "inflate:       table sizes ok\n"));
 236.880 -            state->have = 0;
 236.881 -            state->mode = LENLENS;
 236.882 -        case LENLENS:
 236.883 -            while (state->have < state->ncode) {
 236.884 -                NEEDBITS(3);
 236.885 -                state->lens[order[state->have++]] = (unsigned short)BITS(3);
 236.886 -                DROPBITS(3);
 236.887 -            }
 236.888 -            while (state->have < 19)
 236.889 -                state->lens[order[state->have++]] = 0;
 236.890 -            state->next = state->codes;
 236.891 -            state->lencode = (code const FAR *)(state->next);
 236.892 -            state->lenbits = 7;
 236.893 -            ret = inflate_table(CODES, state->lens, 19, &(state->next),
 236.894 -                                &(state->lenbits), state->work);
 236.895 -            if (ret) {
 236.896 -                strm->msg = (char *)"invalid code lengths set";
 236.897 -                state->mode = BAD;
 236.898 -                break;
 236.899 -            }
 236.900 -            Tracev((stderr, "inflate:       code lengths ok\n"));
 236.901 -            state->have = 0;
 236.902 -            state->mode = CODELENS;
 236.903 -        case CODELENS:
 236.904 -            while (state->have < state->nlen + state->ndist) {
 236.905 -                for (;;) {
 236.906 -                    this = state->lencode[BITS(state->lenbits)];
 236.907 -                    if ((unsigned)(this.bits) <= bits) break;
 236.908 -                    PULLBYTE();
 236.909 -                }
 236.910 -                if (this.val < 16) {
 236.911 -                    NEEDBITS(this.bits);
 236.912 -                    DROPBITS(this.bits);
 236.913 -                    state->lens[state->have++] = this.val;
 236.914 -                }
 236.915 -                else {
 236.916 -                    if (this.val == 16) {
 236.917 -                        NEEDBITS(this.bits + 2);
 236.918 -                        DROPBITS(this.bits);
 236.919 -                        if (state->have == 0) {
 236.920 -                            strm->msg = (char *)"invalid bit length repeat";
 236.921 -                            state->mode = BAD;
 236.922 -                            break;
 236.923 -                        }
 236.924 -                        len = state->lens[state->have - 1];
 236.925 -                        copy = 3 + BITS(2);
 236.926 -                        DROPBITS(2);
 236.927 -                    }
 236.928 -                    else if (this.val == 17) {
 236.929 -                        NEEDBITS(this.bits + 3);
 236.930 -                        DROPBITS(this.bits);
 236.931 -                        len = 0;
 236.932 -                        copy = 3 + BITS(3);
 236.933 -                        DROPBITS(3);
 236.934 -                    }
 236.935 -                    else {
 236.936 -                        NEEDBITS(this.bits + 7);
 236.937 -                        DROPBITS(this.bits);
 236.938 -                        len = 0;
 236.939 -                        copy = 11 + BITS(7);
 236.940 -                        DROPBITS(7);
 236.941 -                    }
 236.942 -                    if (state->have + copy > state->nlen + state->ndist) {
 236.943 -                        strm->msg = (char *)"invalid bit length repeat";
 236.944 -                        state->mode = BAD;
 236.945 -                        break;
 236.946 -                    }
 236.947 -                    while (copy--)
 236.948 -                        state->lens[state->have++] = (unsigned short)len;
 236.949 -                }
 236.950 -            }
 236.951 -
 236.952 -            /* handle error breaks in while */
 236.953 -            if (state->mode == BAD) break;
 236.954 -
 236.955 -            /* build code tables */
 236.956 -            state->next = state->codes;
 236.957 -            state->lencode = (code const FAR *)(state->next);
 236.958 -            state->lenbits = 9;
 236.959 -            ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
 236.960 -                                &(state->lenbits), state->work);
 236.961 -            if (ret) {
 236.962 -                strm->msg = (char *)"invalid literal/lengths set";
 236.963 -                state->mode = BAD;
 236.964 -                break;
 236.965 -            }
 236.966 -            state->distcode = (code const FAR *)(state->next);
 236.967 -            state->distbits = 6;
 236.968 -            ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
 236.969 -                            &(state->next), &(state->distbits), state->work);
 236.970 -            if (ret) {
 236.971 -                strm->msg = (char *)"invalid distances set";
 236.972 -                state->mode = BAD;
 236.973 -                break;
 236.974 -            }
 236.975 -            Tracev((stderr, "inflate:       codes ok\n"));
 236.976 -            state->mode = LEN;
 236.977 -        case LEN:
 236.978 -            if (have >= 6 && left >= 258) {
 236.979 -                RESTORE();
 236.980 -                inflate_fast(strm, out);
 236.981 -                LOAD();
 236.982 -                break;
 236.983 -            }
 236.984 -            for (;;) {
 236.985 -                this = state->lencode[BITS(state->lenbits)];
 236.986 -                if ((unsigned)(this.bits) <= bits) break;
 236.987 -                PULLBYTE();
 236.988 -            }
 236.989 -            if (this.op && (this.op & 0xf0) == 0) {
 236.990 -                last = this;
 236.991 -                for (;;) {
 236.992 -                    this = state->lencode[last.val +
 236.993 -                            (BITS(last.bits + last.op) >> last.bits)];
 236.994 -                    if ((unsigned)(last.bits + this.bits) <= bits) break;
 236.995 -                    PULLBYTE();
 236.996 -                }
 236.997 -                DROPBITS(last.bits);
 236.998 -            }
 236.999 -            DROPBITS(this.bits);
236.1000 -            state->length = (unsigned)this.val;
236.1001 -            if ((int)(this.op) == 0) {
236.1002 -                Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
236.1003 -                        "inflate:         literal '%c'\n" :
236.1004 -                        "inflate:         literal 0x%02x\n", this.val));
236.1005 -                state->mode = LIT;
236.1006 -                break;
236.1007 -            }
236.1008 -            if (this.op & 32) {
236.1009 -                Tracevv((stderr, "inflate:         end of block\n"));
236.1010 -                state->mode = TYPE;
236.1011 -                break;
236.1012 -            }
236.1013 -            if (this.op & 64) {
236.1014 -                strm->msg = (char *)"invalid literal/length code";
236.1015 -                state->mode = BAD;
236.1016 -                break;
236.1017 -            }
236.1018 -            state->extra = (unsigned)(this.op) & 15;
236.1019 -            state->mode = LENEXT;
236.1020 -        case LENEXT:
236.1021 -            if (state->extra) {
236.1022 -                NEEDBITS(state->extra);
236.1023 -                state->length += BITS(state->extra);
236.1024 -                DROPBITS(state->extra);
236.1025 -            }
236.1026 -            Tracevv((stderr, "inflate:         length %u\n", state->length));
236.1027 -            state->mode = DIST;
236.1028 -        case DIST:
236.1029 -            for (;;) {
236.1030 -                this = state->distcode[BITS(state->distbits)];
236.1031 -                if ((unsigned)(this.bits) <= bits) break;
236.1032 -                PULLBYTE();
236.1033 -            }
236.1034 -            if ((this.op & 0xf0) == 0) {
236.1035 -                last = this;
236.1036 -                for (;;) {
236.1037 -                    this = state->distcode[last.val +
236.1038 -                            (BITS(last.bits + last.op) >> last.bits)];
236.1039 -                    if ((unsigned)(last.bits + this.bits) <= bits) break;
236.1040 -                    PULLBYTE();
236.1041 -                }
236.1042 -                DROPBITS(last.bits);
236.1043 -            }
236.1044 -            DROPBITS(this.bits);
236.1045 -            if (this.op & 64) {
236.1046 -                strm->msg = (char *)"invalid distance code";
236.1047 -                state->mode = BAD;
236.1048 -                break;
236.1049 -            }
236.1050 -            state->offset = (unsigned)this.val;
236.1051 -            state->extra = (unsigned)(this.op) & 15;
236.1052 -            state->mode = DISTEXT;
236.1053 -        case DISTEXT:
236.1054 -            if (state->extra) {
236.1055 -                NEEDBITS(state->extra);
236.1056 -                state->offset += BITS(state->extra);
236.1057 -                DROPBITS(state->extra);
236.1058 -            }
236.1059 -#ifdef INFLATE_STRICT
236.1060 -            if (state->offset > state->dmax) {
236.1061 -                strm->msg = (char *)"invalid distance too far back";
236.1062 -                state->mode = BAD;
236.1063 -                break;
236.1064 -            }
236.1065 -#endif
236.1066 -            if (state->offset > state->whave + out - left) {
236.1067 -                strm->msg = (char *)"invalid distance too far back";
236.1068 -                state->mode = BAD;
236.1069 -                break;
236.1070 -            }
236.1071 -            Tracevv((stderr, "inflate:         distance %u\n", state->offset));
236.1072 -            state->mode = MATCH;
236.1073 -        case MATCH:
236.1074 -            if (left == 0) goto inf_leave;
236.1075 -            copy = out - left;
236.1076 -            if (state->offset > copy) {         /* copy from window */
236.1077 -                copy = state->offset - copy;
236.1078 -                if (copy > state->write) {
236.1079 -                    copy -= state->write;
236.1080 -                    from = state->window + (state->wsize - copy);
236.1081 -                }
236.1082 -                else
236.1083 -                    from = state->window + (state->write - copy);
236.1084 -                if (copy > state->length) copy = state->length;
236.1085 -            }
236.1086 -            else {                              /* copy from output */
236.1087 -                from = put - state->offset;
236.1088 -                copy = state->length;
236.1089 -            }
236.1090 -            if (copy > left) copy = left;
236.1091 -            left -= copy;
236.1092 -            state->length -= copy;
236.1093 -            do {
236.1094 -                *put++ = *from++;
236.1095 -            } while (--copy);
236.1096 -            if (state->length == 0) state->mode = LEN;
236.1097 -            break;
236.1098 -        case LIT:
236.1099 -            if (left == 0) goto inf_leave;
236.1100 -            *put++ = (unsigned char)(state->length);
236.1101 -            left--;
236.1102 -            state->mode = LEN;
236.1103 -            break;
236.1104 -        case CHECK:
236.1105 -            if (state->wrap) {
236.1106 -                NEEDBITS(32);
236.1107 -                out -= left;
236.1108 -                strm->total_out += out;
236.1109 -                state->total += out;
236.1110 -                if (out)
236.1111 -                    strm->adler = state->check =
236.1112 -                        UPDATE(state->check, put - out, out);
236.1113 -                out = left;
236.1114 -                if ((
236.1115 -#ifdef GUNZIP
236.1116 -                     state->flags ? hold :
236.1117 -#endif
236.1118 -                     REVERSE(hold)) != state->check) {
236.1119 -                    strm->msg = (char *)"incorrect data check";
236.1120 -                    state->mode = BAD;
236.1121 -                    break;
236.1122 -                }
236.1123 -                INITBITS();
236.1124 -                Tracev((stderr, "inflate:   check matches trailer\n"));
236.1125 -            }
236.1126 -#ifdef GUNZIP
236.1127 -            state->mode = LENGTH;
236.1128 -        case LENGTH:
236.1129 -            if (state->wrap && state->flags) {
236.1130 -                NEEDBITS(32);
236.1131 -                if (hold != (state->total & 0xffffffffUL)) {
236.1132 -                    strm->msg = (char *)"incorrect length check";
236.1133 -                    state->mode = BAD;
236.1134 -                    break;
236.1135 -                }
236.1136 -                INITBITS();
236.1137 -                Tracev((stderr, "inflate:   length matches trailer\n"));
236.1138 -            }
236.1139 -#endif
236.1140 -            state->mode = DONE;
236.1141 -        case DONE:
236.1142 -            ret = Z_STREAM_END;
236.1143 -            goto inf_leave;
236.1144 -        case BAD:
236.1145 -            ret = Z_DATA_ERROR;
236.1146 -            goto inf_leave;
236.1147 -        case MEM:
236.1148 -            return Z_MEM_ERROR;
236.1149 -        case SYNC:
236.1150 -        default:
236.1151 -            return Z_STREAM_ERROR;
236.1152 -        }
236.1153 -
236.1154 -    /*
236.1155 -       Return from inflate(), updating the total counts and the check value.
236.1156 -       If there was no progress during the inflate() call, return a buffer
236.1157 -       error.  Call updatewindow() to create and/or update the window state.
236.1158 -       Note: a memory error from inflate() is non-recoverable.
236.1159 -     */
236.1160 -  inf_leave:
236.1161 -    RESTORE();
236.1162 -    if (state->wsize || (state->mode < CHECK && out != strm->avail_out))
236.1163 -        if (updatewindow(strm, out)) {
236.1164 -            state->mode = MEM;
236.1165 -            return Z_MEM_ERROR;
236.1166 -        }
236.1167 -    in -= strm->avail_in;
236.1168 -    out -= strm->avail_out;
236.1169 -    strm->total_in += in;
236.1170 -    strm->total_out += out;
236.1171 -    state->total += out;
236.1172 -    if (state->wrap && out)
236.1173 -        strm->adler = state->check =
236.1174 -            UPDATE(state->check, strm->next_out - out, out);
236.1175 -    strm->data_type = state->bits + (state->last ? 64 : 0) +
236.1176 -                      (state->mode == TYPE ? 128 : 0);
236.1177 -    if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
236.1178 -        ret = Z_BUF_ERROR;
236.1179 -    return ret;
236.1180 -}
236.1181 -
236.1182 -int ZEXPORT inflateEnd(strm)
236.1183 -z_streamp strm;
236.1184 -{
236.1185 -    struct inflate_state FAR *state;
236.1186 -    if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
236.1187 -        return Z_STREAM_ERROR;
236.1188 -    state = (struct inflate_state FAR *)strm->state;
236.1189 -    if (state->window != Z_NULL) ZFREE(strm, state->window);
236.1190 -    ZFREE(strm, strm->state);
236.1191 -    strm->state = Z_NULL;
236.1192 -    Tracev((stderr, "inflate: end\n"));
236.1193 -    return Z_OK;
236.1194 -}
236.1195 -
236.1196 -int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength)
236.1197 -z_streamp strm;
236.1198 -const Bytef *dictionary;
236.1199 -uInt dictLength;
236.1200 -{
236.1201 -    struct inflate_state FAR *state;
236.1202 -    unsigned long id;
236.1203 -
236.1204 -    /* check state */
236.1205 -    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
236.1206 -    state = (struct inflate_state FAR *)strm->state;
236.1207 -    if (state->wrap != 0 && state->mode != DICT)
236.1208 -        return Z_STREAM_ERROR;
236.1209 -
236.1210 -    /* check for correct dictionary id */
236.1211 -    if (state->mode == DICT) {
236.1212 -        id = adler32(0L, Z_NULL, 0);
236.1213 -        id = adler32(id, dictionary, dictLength);
236.1214 -        if (id != state->check)
236.1215 -            return Z_DATA_ERROR;
236.1216 -    }
236.1217 -
236.1218 -    /* copy dictionary to window */
236.1219 -    if (updatewindow(strm, strm->avail_out)) {
236.1220 -        state->mode = MEM;
236.1221 -        return Z_MEM_ERROR;
236.1222 -    }
236.1223 -    if (dictLength > state->wsize) {
236.1224 -        zmemcpy(state->window, dictionary + dictLength - state->wsize,
236.1225 -                state->wsize);
236.1226 -        state->whave = state->wsize;
236.1227 -    }
236.1228 -    else {
236.1229 -        zmemcpy(state->window + state->wsize - dictLength, dictionary,
236.1230 -                dictLength);
236.1231 -        state->whave = dictLength;
236.1232 -    }
236.1233 -    state->havedict = 1;
236.1234 -    Tracev((stderr, "inflate:   dictionary set\n"));
236.1235 -    return Z_OK;
236.1236 -}
236.1237 -
236.1238 -int ZEXPORT inflateGetHeader(strm, head)
236.1239 -z_streamp strm;
236.1240 -gz_headerp head;
236.1241 -{
236.1242 -    struct inflate_state FAR *state;
236.1243 -
236.1244 -    /* check state */
236.1245 -    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
236.1246 -    state = (struct inflate_state FAR *)strm->state;
236.1247 -    if ((state->wrap & 2) == 0) return Z_STREAM_ERROR;
236.1248 -
236.1249 -    /* save header structure */
236.1250 -    state->head = head;
236.1251 -    head->done = 0;
236.1252 -    return Z_OK;
236.1253 -}
236.1254 -
236.1255 -/*
236.1256 -   Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff.  Return when found
236.1257 -   or when out of input.  When called, *have is the number of pattern bytes
236.1258 -   found in order so far, in 0..3.  On return *have is updated to the new
236.1259 -   state.  If on return *have equals four, then the pattern was found and the
236.1260 -   return value is how many bytes were read including the last byte of the
236.1261 -   pattern.  If *have is less than four, then the pattern has not been found
236.1262 -   yet and the return value is len.  In the latter case, syncsearch() can be
236.1263 -   called again with more data and the *have state.  *have is initialized to
236.1264 -   zero for the first call.
236.1265 - */
236.1266 -local unsigned syncsearch(have, buf, len)
236.1267 -unsigned FAR *have;
236.1268 -unsigned char FAR *buf;
236.1269 -unsigned len;
236.1270 -{
236.1271 -    unsigned got;
236.1272 -    unsigned next;
236.1273 -
236.1274 -    got = *have;
236.1275 -    next = 0;
236.1276 -    while (next < len && got < 4) {
236.1277 -        if ((int)(buf[next]) == (got < 2 ? 0 : 0xff))
236.1278 -            got++;
236.1279 -        else if (buf[next])
236.1280 -            got = 0;
236.1281 -        else
236.1282 -            got = 4 - got;
236.1283 -        next++;
236.1284 -    }
236.1285 -    *have = got;
236.1286 -    return next;
236.1287 -}
236.1288 -
236.1289 -int ZEXPORT inflateSync(strm)
236.1290 -z_streamp strm;
236.1291 -{
236.1292 -    unsigned len;               /* number of bytes to look at or looked at */
236.1293 -    long long in, out;          /* temporary to save total_in and total_out */
236.1294 -    unsigned char buf[4];       /* to restore bit buffer to byte string */
236.1295 -    struct inflate_state FAR *state;
236.1296 -
236.1297 -    /* check parameters */
236.1298 -    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
236.1299 -    state = (struct inflate_state FAR *)strm->state;
236.1300 -    if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR;
236.1301 -
236.1302 -    /* if first time, start search in bit buffer */
236.1303 -    if (state->mode != SYNC) {
236.1304 -        state->mode = SYNC;
236.1305 -        state->hold <<= state->bits & 7;
236.1306 -        state->bits -= state->bits & 7;
236.1307 -        len = 0;
236.1308 -        while (state->bits >= 8) {
236.1309 -            buf[len++] = (unsigned char)(state->hold);
236.1310 -            state->hold >>= 8;
236.1311 -            state->bits -= 8;
236.1312 -        }
236.1313 -        state->have = 0;
236.1314 -        syncsearch(&(state->have), buf, len);
236.1315 -    }
236.1316 -
236.1317 -    /* search available input */
236.1318 -    len = syncsearch(&(state->have), strm->next_in, strm->avail_in);
236.1319 -    strm->avail_in -= len;
236.1320 -    strm->next_in += len;
236.1321 -    strm->total_in += len;
236.1322 -
236.1323 -    /* return no joy or set up to restart inflate() on a new block */
236.1324 -    if (state->have != 4) return Z_DATA_ERROR;
236.1325 -    in = strm->total_in;  out = strm->total_out;
236.1326 -    inflateReset(strm);
236.1327 -    strm->total_in = in;  strm->total_out = out;
236.1328 -    state->mode = TYPE;
236.1329 -    return Z_OK;
236.1330 -}
236.1331 -
236.1332 -/*
236.1333 -   Returns true if inflate is currently at the end of a block generated by
236.1334 -   Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP
236.1335 -   implementation to provide an additional safety check. PPP uses
236.1336 -   Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored
236.1337 -   block. When decompressing, PPP checks that at the end of input packet,
236.1338 -   inflate is waiting for these length bytes.
236.1339 - */
236.1340 -int ZEXPORT inflateSyncPoint(strm)
236.1341 -z_streamp strm;
236.1342 -{
236.1343 -    struct inflate_state FAR *state;
236.1344 -
236.1345 -    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
236.1346 -    state = (struct inflate_state FAR *)strm->state;
236.1347 -    return state->mode == STORED && state->bits == 0;
236.1348 -}
236.1349 -
236.1350 -int ZEXPORT inflateCopy(dest, source)
236.1351 -z_streamp dest;
236.1352 -z_streamp source;
236.1353 -{
236.1354 -    struct inflate_state FAR *state;
236.1355 -    struct inflate_state FAR *copy;
236.1356 -    unsigned char FAR *window;
236.1357 -    unsigned wsize;
236.1358 -
236.1359 -    /* check input */
236.1360 -    if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL ||
236.1361 -        source->zalloc == (alloc_func)0 || source->zfree == (free_func)0)
236.1362 -        return Z_STREAM_ERROR;
236.1363 -    state = (struct inflate_state FAR *)source->state;
236.1364 -
236.1365 -    /* allocate space */
236.1366 -    copy = (struct inflate_state FAR *)
236.1367 -           ZALLOC(source, 1, sizeof(struct inflate_state));
236.1368 -    if (copy == Z_NULL) return Z_MEM_ERROR;
236.1369 -    window = Z_NULL;
236.1370 -    if (state->window != Z_NULL) {
236.1371 -        window = (unsigned char FAR *)
236.1372 -                 ZALLOC(source, 1U << state->wbits, sizeof(unsigned char));
236.1373 -        if (window == Z_NULL) {
236.1374 -            ZFREE(source, copy);
236.1375 -            return Z_MEM_ERROR;
236.1376 -        }
236.1377 -    }
236.1378 -
236.1379 -    /* copy state */
236.1380 -    zmemcpy(dest, source, sizeof(z_stream));
236.1381 -    zmemcpy(copy, state, sizeof(struct inflate_state));
236.1382 -    if (state->lencode >= state->codes &&
236.1383 -        state->lencode <= state->codes + ENOUGH - 1) {
236.1384 -        copy->lencode = copy->codes + (state->lencode - state->codes);
236.1385 -        copy->distcode = copy->codes + (state->distcode - state->codes);
236.1386 -    }
236.1387 -    copy->next = copy->codes + (state->next - state->codes);
236.1388 -    if (window != Z_NULL) {
236.1389 -        wsize = 1U << state->wbits;
236.1390 -        zmemcpy(window, state->window, wsize);
236.1391 -    }
236.1392 -    copy->window = window;
236.1393 -    dest->state = (struct internal_state FAR *)copy;
236.1394 -    return Z_OK;
236.1395 -}
   237.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/inflate.h	Tue Dec 06 16:31:58 2011 -0800
   237.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   237.3 @@ -1,139 +0,0 @@
   237.4 -/*
   237.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   237.6 - *
   237.7 - * This code is free software; you can redistribute it and/or modify it
   237.8 - * under the terms of the GNU General Public License version 2 only, as
   237.9 - * published by the Free Software Foundation.  Oracle designates this
  237.10 - * particular file as subject to the "Classpath" exception as provided
  237.11 - * by Oracle in the LICENSE file that accompanied this code.
  237.12 - *
  237.13 - * This code is distributed in the hope that it will be useful, but WITHOUT
  237.14 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  237.15 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  237.16 - * version 2 for more details (a copy is included in the LICENSE file that
  237.17 - * accompanied this code).
  237.18 - *
  237.19 - * You should have received a copy of the GNU General Public License version
  237.20 - * 2 along with this work; if not, write to the Free Software Foundation,
  237.21 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  237.22 - *
  237.23 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  237.24 - * or visit www.oracle.com if you need additional information or have any
  237.25 - * questions.
  237.26 - */
  237.27 -
  237.28 -/* inflate.h -- internal inflate state definition
  237.29 - * Copyright (C) 1995-2004 Mark Adler
  237.30 - * For conditions of distribution and use, see copyright notice in zlib.h
  237.31 - */
  237.32 -
  237.33 -/* WARNING: this file should *not* be used by applications. It is
  237.34 -   part of the implementation of the compression library and is
  237.35 -   subject to change. Applications should only use zlib.h.
  237.36 - */
  237.37 -
  237.38 -/* define NO_GZIP when compiling if you want to disable gzip header and
  237.39 -   trailer decoding by inflate().  NO_GZIP would be used to avoid linking in
  237.40 -   the crc code when it is not needed.  For shared libraries, gzip decoding
  237.41 -   should be left enabled. */
  237.42 -#ifndef NO_GZIP
  237.43 -#  define GUNZIP
  237.44 -#endif
  237.45 -
  237.46 -/* Possible inflate modes between inflate() calls */
  237.47 -typedef enum {
  237.48 -    HEAD,       /* i: waiting for magic header */
  237.49 -    FLAGS,      /* i: waiting for method and flags (gzip) */
  237.50 -    TIME,       /* i: waiting for modification time (gzip) */
  237.51 -    OS,         /* i: waiting for extra flags and operating system (gzip) */
  237.52 -    EXLEN,      /* i: waiting for extra length (gzip) */
  237.53 -    EXTRA,      /* i: waiting for extra bytes (gzip) */
  237.54 -    NAME,       /* i: waiting for end of file name (gzip) */
  237.55 -    COMMENT,    /* i: waiting for end of comment (gzip) */
  237.56 -    HCRC,       /* i: waiting for header crc (gzip) */
  237.57 -    DICTID,     /* i: waiting for dictionary check value */
  237.58 -    DICT,       /* waiting for inflateSetDictionary() call */
  237.59 -        TYPE,       /* i: waiting for type bits, including last-flag bit */
  237.60 -        TYPEDO,     /* i: same, but skip check to exit inflate on new block */
  237.61 -        STORED,     /* i: waiting for stored size (length and complement) */
  237.62 -        COPY,       /* i/o: waiting for input or output to copy stored block */
  237.63 -        TABLE,      /* i: waiting for dynamic block table lengths */
  237.64 -        LENLENS,    /* i: waiting for code length code lengths */
  237.65 -        CODELENS,   /* i: waiting for length/lit and distance code lengths */
  237.66 -            LEN,        /* i: waiting for length/lit code */
  237.67 -            LENEXT,     /* i: waiting for length extra bits */
  237.68 -            DIST,       /* i: waiting for distance code */
  237.69 -            DISTEXT,    /* i: waiting for distance extra bits */
  237.70 -            MATCH,      /* o: waiting for output space to copy string */
  237.71 -            LIT,        /* o: waiting for output space to write literal */
  237.72 -    CHECK,      /* i: waiting for 32-bit check value */
  237.73 -    LENGTH,     /* i: waiting for 32-bit length (gzip) */
  237.74 -    DONE,       /* finished check, done -- remain here until reset */
  237.75 -    BAD,        /* got a data error -- remain here until reset */
  237.76 -    MEM,        /* got an inflate() memory error -- remain here until reset */
  237.77 -    SYNC        /* looking for synchronization bytes to restart inflate() */
  237.78 -} inflate_mode;
  237.79 -
  237.80 -/*
  237.81 -    State transitions between above modes -
  237.82 -
  237.83 -    (most modes can go to the BAD or MEM mode -- not shown for clarity)
  237.84 -
  237.85 -    Process header:
  237.86 -        HEAD -> (gzip) or (zlib)
  237.87 -        (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME
  237.88 -        NAME -> COMMENT -> HCRC -> TYPE
  237.89 -        (zlib) -> DICTID or TYPE
  237.90 -        DICTID -> DICT -> TYPE
  237.91 -    Read deflate blocks:
  237.92 -            TYPE -> STORED or TABLE or LEN or CHECK
  237.93 -            STORED -> COPY -> TYPE
  237.94 -            TABLE -> LENLENS -> CODELENS -> LEN
  237.95 -    Read deflate codes:
  237.96 -                LEN -> LENEXT or LIT or TYPE
  237.97 -                LENEXT -> DIST -> DISTEXT -> MATCH -> LEN
  237.98 -                LIT -> LEN
  237.99 -    Process trailer:
 237.100 -        CHECK -> LENGTH -> DONE
 237.101 - */
 237.102 -
 237.103 -/* state maintained between inflate() calls.  Approximately 7K bytes. */
 237.104 -struct inflate_state {
 237.105 -    inflate_mode mode;          /* current inflate mode */
 237.106 -    int last;                   /* true if processing last block */
 237.107 -    int wrap;                   /* bit 0 true for zlib, bit 1 true for gzip */
 237.108 -    int havedict;               /* true if dictionary provided */
 237.109 -    int flags;                  /* gzip header method and flags (0 if zlib) */
 237.110 -    unsigned dmax;              /* zlib header max distance (INFLATE_STRICT) */
 237.111 -    unsigned long check;        /* protected copy of check value */
 237.112 -    unsigned long total;        /* protected copy of output count */
 237.113 -    gz_headerp head;            /* where to save gzip header information */
 237.114 -        /* sliding window */
 237.115 -    unsigned wbits;             /* log base 2 of requested window size */
 237.116 -    unsigned wsize;             /* window size or zero if not using window */
 237.117 -    unsigned whave;             /* valid bytes in the window */
 237.118 -    unsigned write;             /* window write index */
 237.119 -    unsigned char FAR *window;  /* allocated sliding window, if needed */
 237.120 -        /* bit accumulator */
 237.121 -    unsigned long hold;         /* input bit accumulator */
 237.122 -    unsigned bits;              /* number of bits in "in" */
 237.123 -        /* for string and stored block copying */
 237.124 -    unsigned length;            /* literal or length of data to copy */
 237.125 -    unsigned offset;            /* distance back to copy string from */
 237.126 -        /* for table and code decoding */
 237.127 -    unsigned extra;             /* extra bits needed */
 237.128 -        /* fixed and dynamic code tables */
 237.129 -    code const FAR *lencode;    /* starting table for length/literal codes */
 237.130 -    code const FAR *distcode;   /* starting table for distance codes */
 237.131 -    unsigned lenbits;           /* index bits for lencode */
 237.132 -    unsigned distbits;          /* index bits for distcode */
 237.133 -        /* dynamic table building */
 237.134 -    unsigned ncode;             /* number of code length code lengths */
 237.135 -    unsigned nlen;              /* number of length code lengths */
 237.136 -    unsigned ndist;             /* number of distance code lengths */
 237.137 -    unsigned have;              /* number of code lengths in lens[] */
 237.138 -    code FAR *next;             /* next available space in codes[] */
 237.139 -    unsigned short lens[320];   /* temporary storage for code lengths */
 237.140 -    unsigned short work[288];   /* work area for code table building */
 237.141 -    code codes[ENOUGH];         /* space for code tables */
 237.142 -};
   238.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/inftrees.c	Tue Dec 06 16:31:58 2011 -0800
   238.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   238.3 @@ -1,353 +0,0 @@
   238.4 -/*
   238.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   238.6 - *
   238.7 - * This code is free software; you can redistribute it and/or modify it
   238.8 - * under the terms of the GNU General Public License version 2 only, as
   238.9 - * published by the Free Software Foundation.  Oracle designates this
  238.10 - * particular file as subject to the "Classpath" exception as provided
  238.11 - * by Oracle in the LICENSE file that accompanied this code.
  238.12 - *
  238.13 - * This code is distributed in the hope that it will be useful, but WITHOUT
  238.14 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  238.15 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  238.16 - * version 2 for more details (a copy is included in the LICENSE file that
  238.17 - * accompanied this code).
  238.18 - *
  238.19 - * You should have received a copy of the GNU General Public License version
  238.20 - * 2 along with this work; if not, write to the Free Software Foundation,
  238.21 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  238.22 - *
  238.23 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  238.24 - * or visit www.oracle.com if you need additional information or have any
  238.25 - * questions.
  238.26 - */
  238.27 -
  238.28 -/* inftrees.c -- generate Huffman trees for efficient decoding
  238.29 - * Copyright (C) 1995-2005 Mark Adler
  238.30 - * For conditions of distribution and use, see copyright notice in zlib.h
  238.31 - */
  238.32 -
  238.33 -#include "zutil.h"
  238.34 -#include "inftrees.h"
  238.35 -
  238.36 -#define MAXBITS 15
  238.37 -
  238.38 -const char inflate_copyright[] =
  238.39 -   " inflate 1.2.3 Copyright 1995-2005 Mark Adler ";
  238.40 -/*
  238.41 -  If you use the zlib library in a product, an acknowledgment is welcome
  238.42 -  in the documentation of your product. If for some reason you cannot
  238.43 -  include such an acknowledgment, I would appreciate that you keep this
  238.44 -  copyright string in the executable of your product.
  238.45 - */
  238.46 -
  238.47 -/*
  238.48 -   Build a set of tables to decode the provided canonical Huffman code.
  238.49 -   The code lengths are lens[0..codes-1].  The result starts at *table,
  238.50 -   whose indices are 0..2^bits-1.  work is a writable array of at least
  238.51 -   lens shorts, which is used as a work area.  type is the type of code
  238.52 -   to be generated, CODES, LENS, or DISTS.  On return, zero is success,
  238.53 -   -1 is an invalid code, and +1 means that ENOUGH isn't enough.  table
  238.54 -   on return points to the next available entry's address.  bits is the
  238.55 -   requested root table index bits, and on return it is the actual root
  238.56 -   table index bits.  It will differ if the request is greater than the
  238.57 -   longest code or if it is less than the shortest code.
  238.58 - */
  238.59 -int inflate_table(type, lens, codes, table, bits, work)
  238.60 -codetype type;
  238.61 -unsigned short FAR *lens;
  238.62 -unsigned codes;
  238.63 -code FAR * FAR *table;
  238.64 -unsigned FAR *bits;
  238.65 -unsigned short FAR *work;
  238.66 -{
  238.67 -    unsigned len;               /* a code's length in bits */
  238.68 -    unsigned sym;               /* index of code symbols */
  238.69 -    unsigned min, max;          /* minimum and maximum code lengths */
  238.70 -    unsigned root;              /* number of index bits for root table */
  238.71 -    unsigned curr;              /* number of index bits for current table */
  238.72 -    unsigned drop;              /* code bits to drop for sub-table */
  238.73 -    int left;                   /* number of prefix codes available */
  238.74 -    unsigned used;              /* code entries in table used */
  238.75 -    unsigned huff;              /* Huffman code */
  238.76 -    unsigned incr;              /* for incrementing code, index */
  238.77 -    unsigned fill;              /* index for replicating entries */
  238.78 -    unsigned low;               /* low bits for current root entry */
  238.79 -    unsigned mask;              /* mask for low root bits */
  238.80 -    code this;                  /* table entry for duplication */
  238.81 -    code FAR *next;             /* next available space in table */
  238.82 -    const unsigned short FAR *base;     /* base value table to use */
  238.83 -    const unsigned short FAR *extra;    /* extra bits table to use */
  238.84 -    int end;                    /* use base and extra for symbol > end */
  238.85 -    unsigned short count[MAXBITS+1];    /* number of codes of each length */
  238.86 -    unsigned short offs[MAXBITS+1];     /* offsets in table for each length */
  238.87 -    static const unsigned short lbase[31] = { /* Length codes 257..285 base */
  238.88 -        3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
  238.89 -        35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
  238.90 -    static const unsigned short lext[31] = { /* Length codes 257..285 extra */
  238.91 -        16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
  238.92 -        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 201, 196};
  238.93 -    static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
  238.94 -        1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
  238.95 -        257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
  238.96 -        8193, 12289, 16385, 24577, 0, 0};
  238.97 -    static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
  238.98 -        16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
  238.99 -        23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
 238.100 -        28, 28, 29, 29, 64, 64};
 238.101 -
 238.102 -    /*
 238.103 -       Process a set of code lengths to create a canonical Huffman code.  The
 238.104 -       code lengths are lens[0..codes-1].  Each length corresponds to the
 238.105 -       symbols 0..codes-1.  The Huffman code is generated by first sorting the
 238.106 -       symbols by length from short to long, and retaining the symbol order
 238.107 -       for codes with equal lengths.  Then the code starts with all zero bits
 238.108 -       for the first code of the shortest length, and the codes are integer
 238.109 -       increments for the same length, and zeros are appended as the length
 238.110 -       increases.  For the deflate format, these bits are stored backwards
 238.111 -       from their more natural integer increment ordering, and so when the
 238.112 -       decoding tables are built in the large loop below, the integer codes
 238.113 -       are incremented backwards.
 238.114 -
 238.115 -       This routine assumes, but does not check, that all of the entries in
 238.116 -       lens[] are in the range 0..MAXBITS.  The caller must assure this.
 238.117 -       1..MAXBITS is interpreted as that code length.  zero means that that
 238.118 -       symbol does not occur in this code.
 238.119 -
 238.120 -       The codes are sorted by computing a count of codes for each length,
 238.121 -       creating from that a table of starting indices for each length in the
 238.122 -       sorted table, and then entering the symbols in order in the sorted
 238.123 -       table.  The sorted table is work[], with that space being provided by
 238.124 -       the caller.
 238.125 -
 238.126 -       The length counts are used for other purposes as well, i.e. finding
 238.127 -       the minimum and maximum length codes, determining if there are any
 238.128 -       codes at all, checking for a valid set of lengths, and looking ahead
 238.129 -       at length counts to determine sub-table sizes when building the
 238.130 -       decoding tables.
 238.131 -     */
 238.132 -
 238.133 -    /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
 238.134 -    for (len = 0; len <= MAXBITS; len++)
 238.135 -        count[len] = 0;
 238.136 -    for (sym = 0; sym < codes; sym++)
 238.137 -        count[lens[sym]]++;
 238.138 -
 238.139 -    /* bound code lengths, force root to be within code lengths */
 238.140 -    root = *bits;
 238.141 -    for (max = MAXBITS; max >= 1; max--)
 238.142 -        if (count[max] != 0) break;
 238.143 -    if (root > max) root = max;
 238.144 -    if (max == 0) {                     /* no symbols to code at all */
 238.145 -        this.op = (unsigned char)64;    /* invalid code marker */
 238.146 -        this.bits = (unsigned char)1;
 238.147 -        this.val = (unsigned short)0;
 238.148 -        *(*table)++ = this;             /* make a table to force an error */
 238.149 -        *(*table)++ = this;
 238.150 -        *bits = 1;
 238.151 -        return 0;     /* no symbols, but wait for decoding to report error */
 238.152 -    }
 238.153 -    for (min = 1; min <= MAXBITS; min++)
 238.154 -        if (count[min] != 0) break;
 238.155 -    if (root < min) root = min;
 238.156 -
 238.157 -    /* check for an over-subscribed or incomplete set of lengths */
 238.158 -    left = 1;
 238.159 -    for (len = 1; len <= MAXBITS; len++) {
 238.160 -        left <<= 1;
 238.161 -        left -= count[len];
 238.162 -        if (left < 0) return -1;        /* over-subscribed */
 238.163 -    }
 238.164 -    if (left > 0 && (type == CODES || max != 1))
 238.165 -        return -1;                      /* incomplete set */
 238.166 -
 238.167 -    /* generate offsets into symbol table for each length for sorting */
 238.168 -    offs[1] = 0;
 238.169 -    for (len = 1; len < MAXBITS; len++)
 238.170 -        offs[len + 1] = offs[len] + count[len];
 238.171 -
 238.172 -    /* sort symbols by length, by symbol order within each length */
 238.173 -    for (sym = 0; sym < codes; sym++)
 238.174 -        if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;
 238.175 -
 238.176 -    /*
 238.177 -       Create and fill in decoding tables.  In this loop, the table being
 238.178 -       filled is at next and has curr index bits.  The code being used is huff
 238.179 -       with length len.  That code is converted to an index by dropping drop
 238.180 -       bits off of the bottom.  For codes where len is less than drop + curr,
 238.181 -       those top drop + curr - len bits are incremented through all values to
 238.182 -       fill the table with replicated entries.
 238.183 -
 238.184 -       root is the number of index bits for the root table.  When len exceeds
 238.185 -       root, sub-tables are created pointed to by the root entry with an index
 238.186 -       of the low root bits of huff.  This is saved in low to check for when a
 238.187 -       new sub-table should be started.  drop is zero when the root table is
 238.188 -       being filled, and drop is root when sub-tables are being filled.
 238.189 -
 238.190 -       When a new sub-table is needed, it is necessary to look ahead in the
 238.191 -       code lengths to determine what size sub-table is needed.  The length
 238.192 -       counts are used for this, and so count[] is decremented as codes are
 238.193 -       entered in the tables.
 238.194 -
 238.195 -       used keeps track of how many table entries have been allocated from the
 238.196 -       provided *table space.  It is checked when a LENS table is being made
 238.197 -       against the space in *table, ENOUGH, minus the maximum space needed by
 238.198 -       the worst case distance code, MAXD.  This should never happen, but the
 238.199 -       sufficiency of ENOUGH has not been proven exhaustively, hence the check.
 238.200 -       This assumes that when type == LENS, bits == 9.
 238.201 -
 238.202 -       sym increments through all symbols, and the loop terminates when
 238.203 -       all codes of length max, i.e. all codes, have been processed.  This
 238.204 -       routine permits incomplete codes, so another loop after this one fills
 238.205 -       in the rest of the decoding tables with invalid code markers.
 238.206 -     */
 238.207 -
 238.208 -    /* set up for code type */
 238.209 -    switch (type) {
 238.210 -    case CODES:
 238.211 -        base = extra = work;    /* dummy value--not used */
 238.212 -        end = 19;
 238.213 -        break;
 238.214 -    case LENS:
 238.215 -        base = lbase;
 238.216 -        base -= 257;
 238.217 -        extra = lext;
 238.218 -        extra -= 257;
 238.219 -        end = 256;
 238.220 -        break;
 238.221 -    default:            /* DISTS */
 238.222 -        base = dbase;
 238.223 -        extra = dext;
 238.224 -        end = -1;
 238.225 -    }
 238.226 -
 238.227 -    /* initialize state for loop */
 238.228 -    huff = 0;                   /* starting code */
 238.229 -    sym = 0;                    /* starting code symbol */
 238.230 -    len = min;                  /* starting code length */
 238.231 -    next = *table;              /* current table to fill in */
 238.232 -    curr = root;                /* current table index bits */
 238.233 -    drop = 0;                   /* current bits to drop from code for index */
 238.234 -    low = (unsigned)(-1);       /* trigger new sub-table when len > root */
 238.235 -    used = 1U << root;          /* use root table entries */
 238.236 -    mask = used - 1;            /* mask for comparing low */
 238.237 -
 238.238 -    /* check available table space */
 238.239 -    if (type == LENS && used >= ENOUGH - MAXD)
 238.240 -        return 1;
 238.241 -
 238.242 -    /* process all codes and make table entries */
 238.243 -    for (;;) {
 238.244 -        /* create table entry */
 238.245 -        this.bits = (unsigned char)(len - drop);
 238.246 -        if ((int)(work[sym]) < end) {
 238.247 -            this.op = (unsigned char)0;
 238.248 -            this.val = work[sym];
 238.249 -        }
 238.250 -        else if ((int)(work[sym]) > end) {
 238.251 -            this.op = (unsigned char)(extra[work[sym]]);
 238.252 -            this.val = base[work[sym]];
 238.253 -        }
 238.254 -        else {
 238.255 -            this.op = (unsigned char)(32 + 64);         /* end of block */
 238.256 -            this.val = 0;
 238.257 -        }
 238.258 -
 238.259 -        /* replicate for those indices with low len bits equal to huff */
 238.260 -        incr = 1U << (len - drop);
 238.261 -        fill = 1U << curr;
 238.262 -        min = fill;                 /* save offset to next table */
 238.263 -        do {
 238.264 -            fill -= incr;
 238.265 -            next[(huff >> drop) + fill] = this;
 238.266 -        } while (fill != 0);
 238.267 -
 238.268 -        /* backwards increment the len-bit code huff */
 238.269 -        incr = 1U << (len - 1);
 238.270 -        while (huff & incr)
 238.271 -            incr >>= 1;
 238.272 -        if (incr != 0) {
 238.273 -            huff &= incr - 1;
 238.274 -            huff += incr;
 238.275 -        }
 238.276 -        else
 238.277 -            huff = 0;
 238.278 -
 238.279 -        /* go to next symbol, update count, len */
 238.280 -        sym++;
 238.281 -        if (--(count[len]) == 0) {
 238.282 -            if (len == max) break;
 238.283 -            len = lens[work[sym]];
 238.284 -        }
 238.285 -
 238.286 -        /* create new sub-table if needed */
 238.287 -        if (len > root && (huff & mask) != low) {
 238.288 -            /* if first time, transition to sub-tables */
 238.289 -            if (drop == 0)
 238.290 -                drop = root;
 238.291 -
 238.292 -            /* increment past last table */
 238.293 -            next += min;            /* here min is 1 << curr */
 238.294 -
 238.295 -            /* determine length of next table */
 238.296 -            curr = len - drop;
 238.297 -            left = (int)(1 << curr);
 238.298 -            while (curr + drop < max) {
 238.299 -                left -= count[curr + drop];
 238.300 -                if (left <= 0) break;
 238.301 -                curr++;
 238.302 -                left <<= 1;
 238.303 -            }
 238.304 -
 238.305 -            /* check for enough space */
 238.306 -            used += 1U << curr;
 238.307 -            if (type == LENS && used >= ENOUGH - MAXD)
 238.308 -                return 1;
 238.309 -
 238.310 -            /* point entry in root table to sub-table */
 238.311 -            low = huff & mask;
 238.312 -            (*table)[low].op = (unsigned char)curr;
 238.313 -            (*table)[low].bits = (unsigned char)root;
 238.314 -            (*table)[low].val = (unsigned short)(next - *table);
 238.315 -        }
 238.316 -    }
 238.317 -
 238.318 -    /*
 238.319 -       Fill in rest of table for incomplete codes.  This loop is similar to the
 238.320 -       loop above in incrementing huff for table indices.  It is assumed that
 238.321 -       len is equal to curr + drop, so there is no loop needed to increment
 238.322 -       through high index bits.  When the current sub-table is filled, the loop
 238.323 -       drops back to the root table to fill in any remaining entries there.
 238.324 -     */
 238.325 -    this.op = (unsigned char)64;                /* invalid code marker */
 238.326 -    this.bits = (unsigned char)(len - drop);
 238.327 -    this.val = (unsigned short)0;
 238.328 -    while (huff != 0) {
 238.329 -        /* when done with sub-table, drop back to root table */
 238.330 -        if (drop != 0 && (huff & mask) != low) {
 238.331 -            drop = 0;
 238.332 -            len = root;
 238.333 -            next = *table;
 238.334 -            this.bits = (unsigned char)len;
 238.335 -        }
 238.336 -
 238.337 -        /* put invalid code marker in table */
 238.338 -        next[huff >> drop] = this;
 238.339 -
 238.340 -        /* backwards increment the len-bit code huff */
 238.341 -        incr = 1U << (len - 1);
 238.342 -        while (huff & incr)
 238.343 -            incr >>= 1;
 238.344 -        if (incr != 0) {
 238.345 -            huff &= incr - 1;
 238.346 -            huff += incr;
 238.347 -        }
 238.348 -        else
 238.349 -            huff = 0;
 238.350 -    }
 238.351 -
 238.352 -    /* set return parameters */
 238.353 -    *table += used;
 238.354 -    *bits = root;
 238.355 -    return 0;
 238.356 -}
   239.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/inftrees.h	Tue Dec 06 16:31:58 2011 -0800
   239.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   239.3 @@ -1,79 +0,0 @@
   239.4 -/*
   239.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   239.6 - *
   239.7 - * This code is free software; you can redistribute it and/or modify it
   239.8 - * under the terms of the GNU General Public License version 2 only, as
   239.9 - * published by the Free Software Foundation.  Oracle designates this
  239.10 - * particular file as subject to the "Classpath" exception as provided
  239.11 - * by Oracle in the LICENSE file that accompanied this code.
  239.12 - *
  239.13 - * This code is distributed in the hope that it will be useful, but WITHOUT
  239.14 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  239.15 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  239.16 - * version 2 for more details (a copy is included in the LICENSE file that
  239.17 - * accompanied this code).
  239.18 - *
  239.19 - * You should have received a copy of the GNU General Public License version
  239.20 - * 2 along with this work; if not, write to the Free Software Foundation,
  239.21 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  239.22 - *
  239.23 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  239.24 - * or visit www.oracle.com if you need additional information or have any
  239.25 - * questions.
  239.26 - */
  239.27 -
  239.28 -/* inftrees.h -- header to use inftrees.c
  239.29 - * Copyright (C) 1995-2005 Mark Adler
  239.30 - * For conditions of distribution and use, see copyright notice in zlib.h
  239.31 - */
  239.32 -
  239.33 -/* WARNING: this file should *not* be used by applications. It is
  239.34 -   part of the implementation of the compression library and is
  239.35 -   subject to change. Applications should only use zlib.h.
  239.36 - */
  239.37 -
  239.38 -/* Structure for decoding tables.  Each entry provides either the
  239.39 -   information needed to do the operation requested by the code that
  239.40 -   indexed that table entry, or it provides a pointer to another
  239.41 -   table that indexes more bits of the code.  op indicates whether
  239.42 -   the entry is a pointer to another table, a literal, a length or
  239.43 -   distance, an end-of-block, or an invalid code.  For a table
  239.44 -   pointer, the low four bits of op is the number of index bits of
  239.45 -   that table.  For a length or distance, the low four bits of op
  239.46 -   is the number of extra bits to get after the code.  bits is
  239.47 -   the number of bits in this code or part of the code to drop off
  239.48 -   of the bit buffer.  val is the actual byte to output in the case
  239.49 -   of a literal, the base length or distance, or the offset from
  239.50 -   the current table to the next table.  Each entry is four bytes. */
  239.51 -typedef struct {
  239.52 -    unsigned char op;           /* operation, extra bits, table bits */
  239.53 -    unsigned char bits;         /* bits in this part of the code */
  239.54 -    unsigned short val;         /* offset in table or code value */
  239.55 -} code;
  239.56 -
  239.57 -/* op values as set by inflate_table():
  239.58 -    00000000 - literal
  239.59 -    0000tttt - table link, tttt != 0 is the number of table index bits
  239.60 -    0001eeee - length or distance, eeee is the number of extra bits
  239.61 -    01100000 - end of block
  239.62 -    01000000 - invalid code
  239.63 - */
  239.64 -
  239.65 -/* Maximum size of dynamic tree.  The maximum found in a long but non-
  239.66 -   exhaustive search was 1444 code structures (852 for length/literals
  239.67 -   and 592 for distances, the latter actually the result of an
  239.68 -   exhaustive search).  The true maximum is not known, but the value
  239.69 -   below is more than safe. */
  239.70 -#define ENOUGH 2048
  239.71 -#define MAXD 592
  239.72 -
  239.73 -/* Type of code to build for inftable() */
  239.74 -typedef enum {
  239.75 -    CODES,
  239.76 -    LENS,
  239.77 -    DISTS
  239.78 -} codetype;
  239.79 -
  239.80 -extern int inflate_table OF((codetype type, unsigned short FAR *lens,
  239.81 -                             unsigned codes, code FAR * FAR *table,
  239.82 -                             unsigned FAR *bits, unsigned short FAR *work));
   240.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/patches/ChangeLog_java	Tue Dec 06 16:31:58 2011 -0800
   240.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   240.3 @@ -1,16 +0,0 @@
   240.4 -(1)renamed
   240.5 -   adler32.c -> zadler32.c
   240.6 -   zcrc32c -> zcrc32.c
   240.7 -
   240.8 -(2)added _LP64 to make uLong a 32-bit int on 64-bit platform
   240.9 -   zconf.h:
  240.10 -   uLong -> 32-bit int
  240.11 -
  240.12 -(3)updated crc32.c/crc32()
  240.13 -   unsigned long      -> uLong
  240.14 -
  240.15 -(4)updated zlib.h (to support > 4G zipfile):
  240.16 -   total_in/out: uLong -> long long
  240.17 -
  240.18 -(5)updated upinflate.c/inflateSync()
  240.19 -   unsigned long in, out; -->  long long in, out;
   241.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/patches/crc32.c.diff	Tue Dec 06 16:31:58 2011 -0800
   241.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   241.3 @@ -1,25 +0,0 @@
   241.4 ---- /home/sherman/TL/zlib-1.2.3_ORG/crc32.c	Sun Jun 12 16:56:07 2005
   241.5 -+++ zcrc32.c	Tue Aug 25 14:22:41 2009
   241.6 -@@ -216,8 +216,8 @@
   241.7 - #define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1
   241.8 - 
   241.9 - /* ========================================================================= */
  241.10 --unsigned long ZEXPORT crc32(crc, buf, len)
  241.11 --    unsigned long crc;
  241.12 -+uLong ZEXPORT crc32(crc, buf, len)
  241.13 -+    uLong crc;
  241.14 -     const unsigned char FAR *buf;
  241.15 -     unsigned len;
  241.16 - {
  241.17 -@@ -234,9 +234,9 @@
  241.18 - 
  241.19 -         endian = 1;
  241.20 -         if (*((unsigned char *)(&endian)))
  241.21 --            return crc32_little(crc, buf, len);
  241.22 -+            return (uLong)crc32_little(crc, buf, len);
  241.23 -         else
  241.24 --            return crc32_big(crc, buf, len);
  241.25 -+            return (uLong)crc32_big(crc, buf, len);
  241.26 -     }
  241.27 - #endif /* BYFOUR */
  241.28 -     crc = crc ^ 0xffffffffUL;
   242.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/patches/inflate.c.diff	Tue Dec 06 16:31:58 2011 -0800
   242.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   242.3 @@ -1,11 +0,0 @@
   242.4 ---- /home/sherman/TL/zlib-1.2.3_ORG/inflate.c	Tue Jun 14 14:50:12 2005
   242.5 -+++ inflate.c	Tue Aug 25 14:22:09 2009
   242.6 -@@ -1263,7 +1263,7 @@
   242.7 - z_streamp strm;
   242.8 - {
   242.9 -     unsigned len;               /* number of bytes to look at or looked at */
  242.10 --    unsigned long in, out;      /* temporary to save total_in and total_out */
  242.11 -+    long long in, out;          /* temporary to save total_in and total_out */
  242.12 -     unsigned char buf[4];       /* to restore bit buffer to byte string */
  242.13 -     struct inflate_state FAR *state;
  242.14 - 
   243.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/patches/zconf.h.diff	Tue Dec 06 16:31:58 2011 -0800
   243.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   243.3 @@ -1,24 +0,0 @@
   243.4 ---- /home/sherman/TL/zlib-1.2.3_ORG/zconf.h	Fri May 27 23:40:35 2005
   243.5 -+++ zconf.h	Tue Aug 25 14:22:28 2009
   243.6 -@@ -8,6 +8,9 @@
   243.7 - #ifndef ZCONF_H
   243.8 - #define ZCONF_H
   243.9 - 
  243.10 -+/* for _LP64 */
  243.11 -+#include <sys/types.h>
  243.12 -+
  243.13 - /*
  243.14 -  * If you *really* need a unique prefix for all types and library functions,
  243.15 -  * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
  243.16 -@@ -261,7 +264,11 @@
  243.17 - typedef unsigned char  Byte;  /* 8 bits */
  243.18 - #endif
  243.19 - typedef unsigned int   uInt;  /* 16 bits or more */
  243.20 -+#ifdef _LP64
  243.21 -+typedef unsigned int  uLong;  /* 32 bits or more */
  243.22 -+#else
  243.23 - typedef unsigned long  uLong; /* 32 bits or more */
  243.24 -+#endif
  243.25 - 
  243.26 - #ifdef SMALL_MEDIUM
  243.27 -    /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
   244.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/patches/zlib.h.diff	Tue Dec 06 16:31:58 2011 -0800
   244.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   244.3 @@ -1,25 +0,0 @@
   244.4 ---- /home/sherman/TL/zlib-1.2.3_ORG/zlib.h	Sun Jul 17 19:26:49 2005
   244.5 -+++ zlib.h	Tue Aug 25 14:22:50 2009
   244.6 -@@ -82,11 +82,11 @@
   244.7 - typedef struct z_stream_s {
   244.8 -     Bytef    *next_in;  /* next input byte */
   244.9 -     uInt     avail_in;  /* number of bytes available at next_in */
  244.10 --    uLong    total_in;  /* total nb of input bytes read so far */
  244.11 -+    long long total_in; /* total nb of input bytes read so far */
  244.12 - 
  244.13 -     Bytef    *next_out; /* next output byte should be put there */
  244.14 -     uInt     avail_out; /* remaining free space at next_out */
  244.15 --    uLong    total_out; /* total nb of bytes output so far */
  244.16 -+    long long total_out;/* total nb of bytes output so far */
  244.17 - 
  244.18 -     char     *msg;      /* last error message, NULL if no error */
  244.19 -     struct internal_state FAR *state; /* not visible by applications */
  244.20 -@@ -1348,7 +1348,7 @@
  244.21 - 
  244.22 - ZEXTERN const char   * ZEXPORT zError           OF((int));
  244.23 - ZEXTERN int            ZEXPORT inflateSyncPoint OF((z_streamp z));
  244.24 --ZEXTERN const uLongf * ZEXPORT get_crc_table    OF((void));
  244.25 -+ZEXTERN const unsigned long FAR * ZEXPORT get_crc_table    OF((void));
  244.26 - 
  244.27 - #ifdef __cplusplus
  244.28 - }
   245.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/trees.c	Tue Dec 06 16:31:58 2011 -0800
   245.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   245.3 @@ -1,1243 +0,0 @@
   245.4 -/*
   245.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   245.6 - *
   245.7 - * This code is free software; you can redistribute it and/or modify it
   245.8 - * under the terms of the GNU General Public License version 2 only, as
   245.9 - * published by the Free Software Foundation.  Oracle designates this
  245.10 - * particular file as subject to the "Classpath" exception as provided
  245.11 - * by Oracle in the LICENSE file that accompanied this code.
  245.12 - *
  245.13 - * This code is distributed in the hope that it will be useful, but WITHOUT
  245.14 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  245.15 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  245.16 - * version 2 for more details (a copy is included in the LICENSE file that
  245.17 - * accompanied this code).
  245.18 - *
  245.19 - * You should have received a copy of the GNU General Public License version
  245.20 - * 2 along with this work; if not, write to the Free Software Foundation,
  245.21 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  245.22 - *
  245.23 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  245.24 - * or visit www.oracle.com if you need additional information or have any
  245.25 - * questions.
  245.26 - */
  245.27 -
  245.28 -/* trees.c -- output deflated data using Huffman coding
  245.29 - * Copyright (C) 1995-2005 Jean-loup Gailly
  245.30 - * For conditions of distribution and use, see copyright notice in zlib.h
  245.31 - */
  245.32 -
  245.33 -/*
  245.34 - *  ALGORITHM
  245.35 - *
  245.36 - *      The "deflation" process uses several Huffman trees. The more
  245.37 - *      common source values are represented by shorter bit sequences.
  245.38 - *
  245.39 - *      Each code tree is stored in a compressed form which is itself
  245.40 - * a Huffman encoding of the lengths of all the code strings (in
  245.41 - * ascending order by source values).  The actual code strings are
  245.42 - * reconstructed from the lengths in the inflate process, as described
  245.43 - * in the deflate specification.
  245.44 - *
  245.45 - *  REFERENCES
  245.46 - *
  245.47 - *      Deutsch, L.P.,"'Deflate' Compressed Data Format Specification".
  245.48 - *      Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc
  245.49 - *
  245.50 - *      Storer, James A.
  245.51 - *          Data Compression:  Methods and Theory, pp. 49-50.
  245.52 - *          Computer Science Press, 1988.  ISBN 0-7167-8156-5.
  245.53 - *
  245.54 - *      Sedgewick, R.
  245.55 - *          Algorithms, p290.
  245.56 - *          Addison-Wesley, 1983. ISBN 0-201-06672-6.
  245.57 - */
  245.58 -
  245.59 -/* @(#) $Id$ */
  245.60 -
  245.61 -/* #define GEN_TREES_H */
  245.62 -
  245.63 -#include "deflate.h"
  245.64 -
  245.65 -#ifdef DEBUG
  245.66 -#  include <ctype.h>
  245.67 -#endif
  245.68 -
  245.69 -/* ===========================================================================
  245.70 - * Constants
  245.71 - */
  245.72 -
  245.73 -#define MAX_BL_BITS 7
  245.74 -/* Bit length codes must not exceed MAX_BL_BITS bits */
  245.75 -
  245.76 -#define END_BLOCK 256
  245.77 -/* end of block literal code */
  245.78 -
  245.79 -#define REP_3_6      16
  245.80 -/* repeat previous bit length 3-6 times (2 bits of repeat count) */
  245.81 -
  245.82 -#define REPZ_3_10    17
  245.83 -/* repeat a zero length 3-10 times  (3 bits of repeat count) */
  245.84 -
  245.85 -#define REPZ_11_138  18
  245.86 -/* repeat a zero length 11-138 times  (7 bits of repeat count) */
  245.87 -
  245.88 -local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */
  245.89 -   = {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};
  245.90 -
  245.91 -local const int extra_dbits[D_CODES] /* extra bits for each distance code */
  245.92 -   = {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};
  245.93 -
  245.94 -local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */
  245.95 -   = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7};
  245.96 -
  245.97 -local const uch bl_order[BL_CODES]
  245.98 -   = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15};
  245.99 -/* The lengths of the bit length codes are sent in order of decreasing
 245.100 - * probability, to avoid transmitting the lengths for unused bit length codes.
 245.101 - */
 245.102 -
 245.103 -#define Buf_size (8 * 2*sizeof(char))
 245.104 -/* Number of bits used within bi_buf. (bi_buf might be implemented on
 245.105 - * more than 16 bits on some systems.)
 245.106 - */
 245.107 -
 245.108 -/* ===========================================================================
 245.109 - * Local data. These are initialized only once.
 245.110 - */
 245.111 -
 245.112 -#define DIST_CODE_LEN  512 /* see definition of array dist_code below */
 245.113 -
 245.114 -#if defined(GEN_TREES_H) || !defined(STDC)
 245.115 -/* non ANSI compilers may not accept trees.h */
 245.116 -
 245.117 -local ct_data static_ltree[L_CODES+2];
 245.118 -/* The static literal tree. Since the bit lengths are imposed, there is no
 245.119 - * need for the L_CODES extra codes used during heap construction. However
 245.120 - * The codes 286 and 287 are needed to build a canonical tree (see _tr_init
 245.121 - * below).
 245.122 - */
 245.123 -
 245.124 -local ct_data static_dtree[D_CODES];
 245.125 -/* The static distance tree. (Actually a trivial tree since all codes use
 245.126 - * 5 bits.)
 245.127 - */
 245.128 -
 245.129 -uch _dist_code[DIST_CODE_LEN];
 245.130 -/* Distance codes. The first 256 values correspond to the distances
 245.131 - * 3 .. 258, the last 256 values correspond to the top 8 bits of
 245.132 - * the 15 bit distances.
 245.133 - */
 245.134 -
 245.135 -uch _length_code[MAX_MATCH-MIN_MATCH+1];
 245.136 -/* length code for each normalized match length (0 == MIN_MATCH) */
 245.137 -
 245.138 -local int base_length[LENGTH_CODES];
 245.139 -/* First normalized length for each code (0 = MIN_MATCH) */
 245.140 -
 245.141 -local int base_dist[D_CODES];
 245.142 -/* First normalized distance for each code (0 = distance of 1) */
 245.143 -
 245.144 -#else
 245.145 -#  include "trees.h"
 245.146 -#endif /* GEN_TREES_H */
 245.147 -
 245.148 -struct static_tree_desc_s {
 245.149 -    const ct_data *static_tree;  /* static tree or NULL */
 245.150 -    const intf *extra_bits;      /* extra bits for each code or NULL */
 245.151 -    int     extra_base;          /* base index for extra_bits */
 245.152 -    int     elems;               /* max number of elements in the tree */
 245.153 -    int     max_length;          /* max bit length for the codes */
 245.154 -};
 245.155 -
 245.156 -local static_tree_desc  static_l_desc =
 245.157 -{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS};
 245.158 -
 245.159 -local static_tree_desc  static_d_desc =
 245.160 -{static_dtree, extra_dbits, 0,          D_CODES, MAX_BITS};
 245.161 -
 245.162 -local static_tree_desc  static_bl_desc =
 245.163 -{(const ct_data *)0, extra_blbits, 0,   BL_CODES, MAX_BL_BITS};
 245.164 -
 245.165 -/* ===========================================================================
 245.166 - * Local (static) routines in this file.
 245.167 - */
 245.168 -
 245.169 -local void tr_static_init OF((void));
 245.170 -local void init_block     OF((deflate_state *s));
 245.171 -local void pqdownheap     OF((deflate_state *s, ct_data *tree, int k));
 245.172 -local void gen_bitlen     OF((deflate_state *s, tree_desc *desc));
 245.173 -local void gen_codes      OF((ct_data *tree, int max_code, ushf *bl_count));
 245.174 -local void build_tree     OF((deflate_state *s, tree_desc *desc));
 245.175 -local void scan_tree      OF((deflate_state *s, ct_data *tree, int max_code));
 245.176 -local void send_tree      OF((deflate_state *s, ct_data *tree, int max_code));
 245.177 -local int  build_bl_tree  OF((deflate_state *s));
 245.178 -local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
 245.179 -                              int blcodes));
 245.180 -local void compress_block OF((deflate_state *s, ct_data *ltree,
 245.181 -                              ct_data *dtree));
 245.182 -local void set_data_type  OF((deflate_state *s));
 245.183 -local unsigned bi_reverse OF((unsigned value, int length));
 245.184 -local void bi_windup      OF((deflate_state *s));
 245.185 -local void bi_flush       OF((deflate_state *s));
 245.186 -local void copy_block     OF((deflate_state *s, charf *buf, unsigned len,
 245.187 -                              int header));
 245.188 -
 245.189 -#ifdef GEN_TREES_H
 245.190 -local void gen_trees_header OF((void));
 245.191 -#endif
 245.192 -
 245.193 -#ifndef DEBUG
 245.194 -#  define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
 245.195 -   /* Send a code of the given tree. c and tree must not have side effects */
 245.196 -
 245.197 -#else /* DEBUG */
 245.198 -#  define send_code(s, c, tree) \
 245.199 -     { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \
 245.200 -       send_bits(s, tree[c].Code, tree[c].Len); }
 245.201 -#endif
 245.202 -
 245.203 -/* ===========================================================================
 245.204 - * Output a short LSB first on the stream.
 245.205 - * IN assertion: there is enough room in pendingBuf.
 245.206 - */
 245.207 -#define put_short(s, w) { \
 245.208 -    put_byte(s, (uch)((w) & 0xff)); \
 245.209 -    put_byte(s, (uch)((ush)(w) >> 8)); \
 245.210 -}
 245.211 -
 245.212 -/* ===========================================================================
 245.213 - * Send a value on a given number of bits.
 245.214 - * IN assertion: length <= 16 and value fits in length bits.
 245.215 - */
 245.216 -#ifdef DEBUG
 245.217 -local void send_bits      OF((deflate_state *s, int value, int length));
 245.218 -
 245.219 -local void send_bits(s, value, length)
 245.220 -    deflate_state *s;
 245.221 -    int value;  /* value to send */
 245.222 -    int length; /* number of bits */
 245.223 -{
 245.224 -    Tracevv((stderr," l %2d v %4x ", length, value));
 245.225 -    Assert(length > 0 && length <= 15, "invalid length");
 245.226 -    s->bits_sent += (ulg)length;
 245.227 -
 245.228 -    /* If not enough room in bi_buf, use (valid) bits from bi_buf and
 245.229 -     * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))
 245.230 -     * unused bits in value.
 245.231 -     */
 245.232 -    if (s->bi_valid > (int)Buf_size - length) {
 245.233 -        s->bi_buf |= (value << s->bi_valid);
 245.234 -        put_short(s, s->bi_buf);
 245.235 -        s->bi_buf = (ush)value >> (Buf_size - s->bi_valid);
 245.236 -        s->bi_valid += length - Buf_size;
 245.237 -    } else {
 245.238 -        s->bi_buf |= value << s->bi_valid;
 245.239 -        s->bi_valid += length;
 245.240 -    }
 245.241 -}
 245.242 -#else /* !DEBUG */
 245.243 -
 245.244 -#define send_bits(s, value, length) \
 245.245 -{ int len = length;\
 245.246 -  if (s->bi_valid > (int)Buf_size - len) {\
 245.247 -    int val = value;\
 245.248 -    s->bi_buf |= (val << s->bi_valid);\
 245.249 -    put_short(s, s->bi_buf);\
 245.250 -    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
 245.251 -    s->bi_valid += len - Buf_size;\
 245.252 -  } else {\
 245.253 -    s->bi_buf |= (value) << s->bi_valid;\
 245.254 -    s->bi_valid += len;\
 245.255 -  }\
 245.256 -}
 245.257 -#endif /* DEBUG */
 245.258 -
 245.259 -
 245.260 -/* the arguments must not have side effects */
 245.261 -
 245.262 -/* ===========================================================================
 245.263 - * Initialize the various 'constant' tables.
 245.264 - */
 245.265 -local void tr_static_init()
 245.266 -{
 245.267 -#if defined(GEN_TREES_H) || !defined(STDC)
 245.268 -    static int static_init_done = 0;
 245.269 -    int n;        /* iterates over tree elements */
 245.270 -    int bits;     /* bit counter */
 245.271 -    int length;   /* length value */
 245.272 -    int code;     /* code value */
 245.273 -    int dist;     /* distance index */
 245.274 -    ush bl_count[MAX_BITS+1];
 245.275 -    /* number of codes at each bit length for an optimal tree */
 245.276 -
 245.277 -    if (static_init_done) return;
 245.278 -
 245.279 -    /* For some embedded targets, global variables are not initialized: */
 245.280 -    static_l_desc.static_tree = static_ltree;
 245.281 -    static_l_desc.extra_bits = extra_lbits;
 245.282 -    static_d_desc.static_tree = static_dtree;
 245.283 -    static_d_desc.extra_bits = extra_dbits;
 245.284 -    static_bl_desc.extra_bits = extra_blbits;
 245.285 -
 245.286 -    /* Initialize the mapping length (0..255) -> length code (0..28) */
 245.287 -    length = 0;
 245.288 -    for (code = 0; code < LENGTH_CODES-1; code++) {
 245.289 -        base_length[code] = length;
 245.290 -        for (n = 0; n < (1<<extra_lbits[code]); n++) {
 245.291 -            _length_code[length++] = (uch)code;
 245.292 -        }
 245.293 -    }
 245.294 -    Assert (length == 256, "tr_static_init: length != 256");
 245.295 -    /* Note that the length 255 (match length 258) can be represented
 245.296 -     * in two different ways: code 284 + 5 bits or code 285, so we
 245.297 -     * overwrite length_code[255] to use the best encoding:
 245.298 -     */
 245.299 -    _length_code[length-1] = (uch)code;
 245.300 -
 245.301 -    /* Initialize the mapping dist (0..32K) -> dist code (0..29) */
 245.302 -    dist = 0;
 245.303 -    for (code = 0 ; code < 16; code++) {
 245.304 -        base_dist[code] = dist;
 245.305 -        for (n = 0; n < (1<<extra_dbits[code]); n++) {
 245.306 -            _dist_code[dist++] = (uch)code;
 245.307 -        }
 245.308 -    }
 245.309 -    Assert (dist == 256, "tr_static_init: dist != 256");
 245.310 -    dist >>= 7; /* from now on, all distances are divided by 128 */
 245.311 -    for ( ; code < D_CODES; code++) {
 245.312 -        base_dist[code] = dist << 7;
 245.313 -        for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
 245.314 -            _dist_code[256 + dist++] = (uch)code;
 245.315 -        }
 245.316 -    }
 245.317 -    Assert (dist == 256, "tr_static_init: 256+dist != 512");
 245.318 -
 245.319 -    /* Construct the codes of the static literal tree */
 245.320 -    for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
 245.321 -    n = 0;
 245.322 -    while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++;
 245.323 -    while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++;
 245.324 -    while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++;
 245.325 -    while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++;
 245.326 -    /* Codes 286 and 287 do not exist, but we must include them in the
 245.327 -     * tree construction to get a canonical Huffman tree (longest code
 245.328 -     * all ones)
 245.329 -     */
 245.330 -    gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count);
 245.331 -
 245.332 -    /* The static distance tree is trivial: */
 245.333 -    for (n = 0; n < D_CODES; n++) {
 245.334 -        static_dtree[n].Len = 5;
 245.335 -        static_dtree[n].Code = bi_reverse((unsigned)n, 5);
 245.336 -    }
 245.337 -    static_init_done = 1;
 245.338 -
 245.339 -#  ifdef GEN_TREES_H
 245.340 -    gen_trees_header();
 245.341 -#  endif
 245.342 -#endif /* defined(GEN_TREES_H) || !defined(STDC) */
 245.343 -}
 245.344 -
 245.345 -/* ===========================================================================
 245.346 - * Genererate the file trees.h describing the static trees.
 245.347 - */
 245.348 -#ifdef GEN_TREES_H
 245.349 -#  ifndef DEBUG
 245.350 -#    include <stdio.h>
 245.351 -#  endif
 245.352 -
 245.353 -#  define SEPARATOR(i, last, width) \
 245.354 -      ((i) == (last)? "\n};\n\n" :    \
 245.355 -       ((i) % (width) == (width)-1 ? ",\n" : ", "))
 245.356 -
 245.357 -void gen_trees_header()
 245.358 -{
 245.359 -    FILE *header = fopen("trees.h", "w");
 245.360 -    int i;
 245.361 -
 245.362 -    Assert (header != NULL, "Can't open trees.h");
 245.363 -    fprintf(header,
 245.364 -            "/* header created automatically with -DGEN_TREES_H */\n\n");
 245.365 -
 245.366 -    fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n");
 245.367 -    for (i = 0; i < L_CODES+2; i++) {
 245.368 -        fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code,
 245.369 -                static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5));
 245.370 -    }
 245.371 -
 245.372 -    fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n");
 245.373 -    for (i = 0; i < D_CODES; i++) {
 245.374 -        fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code,
 245.375 -                static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5));
 245.376 -    }
 245.377 -
 245.378 -    fprintf(header, "const uch _dist_code[DIST_CODE_LEN] = {\n");
 245.379 -    for (i = 0; i < DIST_CODE_LEN; i++) {
 245.380 -        fprintf(header, "%2u%s", _dist_code[i],
 245.381 -                SEPARATOR(i, DIST_CODE_LEN-1, 20));
 245.382 -    }
 245.383 -
 245.384 -    fprintf(header, "const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {\n");
 245.385 -    for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) {
 245.386 -        fprintf(header, "%2u%s", _length_code[i],
 245.387 -                SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20));
 245.388 -    }
 245.389 -
 245.390 -    fprintf(header, "local const int base_length[LENGTH_CODES] = {\n");
 245.391 -    for (i = 0; i < LENGTH_CODES; i++) {
 245.392 -        fprintf(header, "%1u%s", base_length[i],
 245.393 -                SEPARATOR(i, LENGTH_CODES-1, 20));
 245.394 -    }
 245.395 -
 245.396 -    fprintf(header, "local const int base_dist[D_CODES] = {\n");
 245.397 -    for (i = 0; i < D_CODES; i++) {
 245.398 -        fprintf(header, "%5u%s", base_dist[i],
 245.399 -                SEPARATOR(i, D_CODES-1, 10));
 245.400 -    }
 245.401 -
 245.402 -    fclose(header);
 245.403 -}
 245.404 -#endif /* GEN_TREES_H */
 245.405 -
 245.406 -/* ===========================================================================
 245.407 - * Initialize the tree data structures for a new zlib stream.
 245.408 - */
 245.409 -void _tr_init(s)
 245.410 -    deflate_state *s;
 245.411 -{
 245.412 -    tr_static_init();
 245.413 -
 245.414 -    s->l_desc.dyn_tree = s->dyn_ltree;
 245.415 -    s->l_desc.stat_desc = &static_l_desc;
 245.416 -
 245.417 -    s->d_desc.dyn_tree = s->dyn_dtree;
 245.418 -    s->d_desc.stat_desc = &static_d_desc;
 245.419 -
 245.420 -    s->bl_desc.dyn_tree = s->bl_tree;
 245.421 -    s->bl_desc.stat_desc = &static_bl_desc;
 245.422 -
 245.423 -    s->bi_buf = 0;
 245.424 -    s->bi_valid = 0;
 245.425 -    s->last_eob_len = 8; /* enough lookahead for inflate */
 245.426 -#ifdef DEBUG
 245.427 -    s->compressed_len = 0L;
 245.428 -    s->bits_sent = 0L;
 245.429 -#endif
 245.430 -
 245.431 -    /* Initialize the first block of the first file: */
 245.432 -    init_block(s);
 245.433 -}
 245.434 -
 245.435 -/* ===========================================================================
 245.436 - * Initialize a new block.
 245.437 - */
 245.438 -local void init_block(s)
 245.439 -    deflate_state *s;
 245.440 -{
 245.441 -    int n; /* iterates over tree elements */
 245.442 -
 245.443 -    /* Initialize the trees. */
 245.444 -    for (n = 0; n < L_CODES;  n++) s->dyn_ltree[n].Freq = 0;
 245.445 -    for (n = 0; n < D_CODES;  n++) s->dyn_dtree[n].Freq = 0;
 245.446 -    for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
 245.447 -
 245.448 -    s->dyn_ltree[END_BLOCK].Freq = 1;
 245.449 -    s->opt_len = s->static_len = 0L;
 245.450 -    s->last_lit = s->matches = 0;
 245.451 -}
 245.452 -
 245.453 -#define SMALLEST 1
 245.454 -/* Index within the heap array of least frequent node in the Huffman tree */
 245.455 -
 245.456 -
 245.457 -/* ===========================================================================
 245.458 - * Remove the smallest element from the heap and recreate the heap with
 245.459 - * one less element. Updates heap and heap_len.
 245.460 - */
 245.461 -#define pqremove(s, tree, top) \
 245.462 -{\
 245.463 -    top = s->heap[SMALLEST]; \
 245.464 -    s->heap[SMALLEST] = s->heap[s->heap_len--]; \
 245.465 -    pqdownheap(s, tree, SMALLEST); \
 245.466 -}
 245.467 -
 245.468 -/* ===========================================================================
 245.469 - * Compares to subtrees, using the tree depth as tie breaker when
 245.470 - * the subtrees have equal frequency. This minimizes the worst case length.
 245.471 - */
 245.472 -#define smaller(tree, n, m, depth) \
 245.473 -   (tree[n].Freq < tree[m].Freq || \
 245.474 -   (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
 245.475 -
 245.476 -/* ===========================================================================
 245.477 - * Restore the heap property by moving down the tree starting at node k,
 245.478 - * exchanging a node with the smallest of its two sons if necessary, stopping
 245.479 - * when the heap property is re-established (each father smaller than its
 245.480 - * two sons).
 245.481 - */
 245.482 -local void pqdownheap(s, tree, k)
 245.483 -    deflate_state *s;
 245.484 -    ct_data *tree;  /* the tree to restore */
 245.485 -    int k;               /* node to move down */
 245.486 -{
 245.487 -    int v = s->heap[k];
 245.488 -    int j = k << 1;  /* left son of k */
 245.489 -    while (j <= s->heap_len) {
 245.490 -        /* Set j to the smallest of the two sons: */
 245.491 -        if (j < s->heap_len &&
 245.492 -            smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
 245.493 -            j++;
 245.494 -        }
 245.495 -        /* Exit if v is smaller than both sons */
 245.496 -        if (smaller(tree, v, s->heap[j], s->depth)) break;
 245.497 -
 245.498 -        /* Exchange v with the smallest son */
 245.499 -        s->heap[k] = s->heap[j];  k = j;
 245.500 -
 245.501 -        /* And continue down the tree, setting j to the left son of k */
 245.502 -        j <<= 1;
 245.503 -    }
 245.504 -    s->heap[k] = v;
 245.505 -}
 245.506 -
 245.507 -/* ===========================================================================
 245.508 - * Compute the optimal bit lengths for a tree and update the total bit length
 245.509 - * for the current block.
 245.510 - * IN assertion: the fields freq and dad are set, heap[heap_max] and
 245.511 - *    above are the tree nodes sorted by increasing frequency.
 245.512 - * OUT assertions: the field len is set to the optimal bit length, the
 245.513 - *     array bl_count contains the frequencies for each bit length.
 245.514 - *     The length opt_len is updated; static_len is also updated if stree is
 245.515 - *     not null.
 245.516 - */
 245.517 -local void gen_bitlen(s, desc)
 245.518 -    deflate_state *s;
 245.519 -    tree_desc *desc;    /* the tree descriptor */
 245.520 -{
 245.521 -    ct_data *tree        = desc->dyn_tree;
 245.522 -    int max_code         = desc->max_code;
 245.523 -    const ct_data *stree = desc->stat_desc->static_tree;
 245.524 -    const intf *extra    = desc->stat_desc->extra_bits;
 245.525 -    int base             = desc->stat_desc->extra_base;
 245.526 -    int max_length       = desc->stat_desc->max_length;
 245.527 -    int h;              /* heap index */
 245.528 -    int n, m;           /* iterate over the tree elements */
 245.529 -    int bits;           /* bit length */
 245.530 -    int xbits;          /* extra bits */
 245.531 -    ush f;              /* frequency */
 245.532 -    int overflow = 0;   /* number of elements with bit length too large */
 245.533 -
 245.534 -    for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0;
 245.535 -
 245.536 -    /* In a first pass, compute the optimal bit lengths (which may
 245.537 -     * overflow in the case of the bit length tree).
 245.538 -     */
 245.539 -    tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */
 245.540 -
 245.541 -    for (h = s->heap_max+1; h < HEAP_SIZE; h++) {
 245.542 -        n = s->heap[h];
 245.543 -        bits = tree[tree[n].Dad].Len + 1;
 245.544 -        if (bits > max_length) bits = max_length, overflow++;
 245.545 -        tree[n].Len = (ush)bits;
 245.546 -        /* We overwrite tree[n].Dad which is no longer needed */
 245.547 -
 245.548 -        if (n > max_code) continue; /* not a leaf node */
 245.549 -
 245.550 -        s->bl_count[bits]++;
 245.551 -        xbits = 0;
 245.552 -        if (n >= base) xbits = extra[n-base];
 245.553 -        f = tree[n].Freq;
 245.554 -        s->opt_len += (ulg)f * (bits + xbits);
 245.555 -        if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits);
 245.556 -    }
 245.557 -    if (overflow == 0) return;
 245.558 -
 245.559 -    Trace((stderr,"\nbit length overflow\n"));
 245.560 -    /* This happens for example on obj2 and pic of the Calgary corpus */
 245.561 -
 245.562 -    /* Find the first bit length which could increase: */
 245.563 -    do {
 245.564 -        bits = max_length-1;
 245.565 -        while (s->bl_count[bits] == 0) bits--;
 245.566 -        s->bl_count[bits]--;      /* move one leaf down the tree */
 245.567 -        s->bl_count[bits+1] += 2; /* move one overflow item as its brother */
 245.568 -        s->bl_count[max_length]--;
 245.569 -        /* The brother of the overflow item also moves one step up,
 245.570 -         * but this does not affect bl_count[max_length]
 245.571 -         */
 245.572 -        overflow -= 2;
 245.573 -    } while (overflow > 0);
 245.574 -
 245.575 -    /* Now recompute all bit lengths, scanning in increasing frequency.
 245.576 -     * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
 245.577 -     * lengths instead of fixing only the wrong ones. This idea is taken
 245.578 -     * from 'ar' written by Haruhiko Okumura.)
 245.579 -     */
 245.580 -    for (bits = max_length; bits != 0; bits--) {
 245.581 -        n = s->bl_count[bits];
 245.582 -        while (n != 0) {
 245.583 -            m = s->heap[--h];
 245.584 -            if (m > max_code) continue;
 245.585 -            if ((unsigned) tree[m].Len != (unsigned) bits) {
 245.586 -                Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
 245.587 -                s->opt_len += ((long)bits - (long)tree[m].Len)
 245.588 -                              *(long)tree[m].Freq;
 245.589 -                tree[m].Len = (ush)bits;
 245.590 -            }
 245.591 -            n--;
 245.592 -        }
 245.593 -    }
 245.594 -}
 245.595 -
 245.596 -/* ===========================================================================
 245.597 - * Generate the codes for a given tree and bit counts (which need not be
 245.598 - * optimal).
 245.599 - * IN assertion: the array bl_count contains the bit length statistics for
 245.600 - * the given tree and the field len is set for all tree elements.
 245.601 - * OUT assertion: the field code is set for all tree elements of non
 245.602 - *     zero code length.
 245.603 - */
 245.604 -local void gen_codes (tree, max_code, bl_count)
 245.605 -    ct_data *tree;             /* the tree to decorate */
 245.606 -    int max_code;              /* largest code with non zero frequency */
 245.607 -    ushf *bl_count;            /* number of codes at each bit length */
 245.608 -{
 245.609 -    ush next_code[MAX_BITS+1]; /* next code value for each bit length */
 245.610 -    ush code = 0;              /* running code value */
 245.611 -    int bits;                  /* bit index */
 245.612 -    int n;                     /* code index */
 245.613 -
 245.614 -    /* The distribution counts are first used to generate the code values
 245.615 -     * without bit reversal.
 245.616 -     */
 245.617 -    for (bits = 1; bits <= MAX_BITS; bits++) {
 245.618 -        next_code[bits] = code = (code + bl_count[bits-1]) << 1;
 245.619 -    }
 245.620 -    /* Check that the bit counts in bl_count are consistent. The last code
 245.621 -     * must be all ones.
 245.622 -     */
 245.623 -    Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
 245.624 -            "inconsistent bit counts");
 245.625 -    Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
 245.626 -
 245.627 -    for (n = 0;  n <= max_code; n++) {
 245.628 -        int len = tree[n].Len;
 245.629 -        if (len == 0) continue;
 245.630 -        /* Now reverse the bits */
 245.631 -        tree[n].Code = bi_reverse(next_code[len]++, len);
 245.632 -
 245.633 -        Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
 245.634 -             n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
 245.635 -    }
 245.636 -}
 245.637 -
 245.638 -/* ===========================================================================
 245.639 - * Construct one Huffman tree and assigns the code bit strings and lengths.
 245.640 - * Update the total bit length for the current block.
 245.641 - * IN assertion: the field freq is set for all tree elements.
 245.642 - * OUT assertions: the fields len and code are set to the optimal bit length
 245.643 - *     and corresponding code. The length opt_len is updated; static_len is
 245.644 - *     also updated if stree is not null. The field max_code is set.
 245.645 - */
 245.646 -local void build_tree(s, desc)
 245.647 -    deflate_state *s;
 245.648 -    tree_desc *desc; /* the tree descriptor */
 245.649 -{
 245.650 -    ct_data *tree         = desc->dyn_tree;
 245.651 -    const ct_data *stree  = desc->stat_desc->static_tree;
 245.652 -    int elems             = desc->stat_desc->elems;
 245.653 -    int n, m;          /* iterate over heap elements */
 245.654 -    int max_code = -1; /* largest code with non zero frequency */
 245.655 -    int node;          /* new node being created */
 245.656 -
 245.657 -    /* Construct the initial heap, with least frequent element in
 245.658 -     * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
 245.659 -     * heap[0] is not used.
 245.660 -     */
 245.661 -    s->heap_len = 0, s->heap_max = HEAP_SIZE;
 245.662 -
 245.663 -    for (n = 0; n < elems; n++) {
 245.664 -        if (tree[n].Freq != 0) {
 245.665 -            s->heap[++(s->heap_len)] = max_code = n;
 245.666 -            s->depth[n] = 0;
 245.667 -        } else {
 245.668 -            tree[n].Len = 0;
 245.669 -        }
 245.670 -    }
 245.671 -
 245.672 -    /* The pkzip format requires that at least one distance code exists,
 245.673 -     * and that at least one bit should be sent even if there is only one
 245.674 -     * possible code. So to avoid special checks later on we force at least
 245.675 -     * two codes of non zero frequency.
 245.676 -     */
 245.677 -    while (s->heap_len < 2) {
 245.678 -        node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0);
 245.679 -        tree[node].Freq = 1;
 245.680 -        s->depth[node] = 0;
 245.681 -        s->opt_len--; if (stree) s->static_len -= stree[node].Len;
 245.682 -        /* node is 0 or 1 so it does not have extra bits */
 245.683 -    }
 245.684 -    desc->max_code = max_code;
 245.685 -
 245.686 -    /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
 245.687 -     * establish sub-heaps of increasing lengths:
 245.688 -     */
 245.689 -    for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n);
 245.690 -
 245.691 -    /* Construct the Huffman tree by repeatedly combining the least two
 245.692 -     * frequent nodes.
 245.693 -     */
 245.694 -    node = elems;              /* next internal node of the tree */
 245.695 -    do {
 245.696 -        pqremove(s, tree, n);  /* n = node of least frequency */
 245.697 -        m = s->heap[SMALLEST]; /* m = node of next least frequency */
 245.698 -
 245.699 -        s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */
 245.700 -        s->heap[--(s->heap_max)] = m;
 245.701 -
 245.702 -        /* Create a new node father of n and m */
 245.703 -        tree[node].Freq = tree[n].Freq + tree[m].Freq;
 245.704 -        s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ?
 245.705 -                                s->depth[n] : s->depth[m]) + 1);
 245.706 -        tree[n].Dad = tree[m].Dad = (ush)node;
 245.707 -#ifdef DUMP_BL_TREE
 245.708 -        if (tree == s->bl_tree) {
 245.709 -            fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)",
 245.710 -                    node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq);
 245.711 -        }
 245.712 -#endif
 245.713 -        /* and insert the new node in the heap */
 245.714 -        s->heap[SMALLEST] = node++;
 245.715 -        pqdownheap(s, tree, SMALLEST);
 245.716 -
 245.717 -    } while (s->heap_len >= 2);
 245.718 -
 245.719 -    s->heap[--(s->heap_max)] = s->heap[SMALLEST];
 245.720 -
 245.721 -    /* At this point, the fields freq and dad are set. We can now
 245.722 -     * generate the bit lengths.
 245.723 -     */
 245.724 -    gen_bitlen(s, (tree_desc *)desc);
 245.725 -
 245.726 -    /* The field len is now set, we can generate the bit codes */
 245.727 -    gen_codes ((ct_data *)tree, max_code, s->bl_count);
 245.728 -}
 245.729 -
 245.730 -/* ===========================================================================
 245.731 - * Scan a literal or distance tree to determine the frequencies of the codes
 245.732 - * in the bit length tree.
 245.733 - */
 245.734 -local void scan_tree (s, tree, max_code)
 245.735 -    deflate_state *s;
 245.736 -    ct_data *tree;   /* the tree to be scanned */
 245.737 -    int max_code;    /* and its largest code of non zero frequency */
 245.738 -{
 245.739 -    int n;                     /* iterates over all tree elements */
 245.740 -    int prevlen = -1;          /* last emitted length */
 245.741 -    int curlen;                /* length of current code */
 245.742 -    int nextlen = tree[0].Len; /* length of next code */
 245.743 -    int count = 0;             /* repeat count of the current code */
 245.744 -    int max_count = 7;         /* max repeat count */
 245.745 -    int min_count = 4;         /* min repeat count */
 245.746 -
 245.747 -    if (nextlen == 0) max_count = 138, min_count = 3;
 245.748 -    tree[max_code+1].Len = (ush)0xffff; /* guard */
 245.749 -
 245.750 -    for (n = 0; n <= max_code; n++) {
 245.751 -        curlen = nextlen; nextlen = tree[n+1].Len;
 245.752 -        if (++count < max_count && curlen == nextlen) {
 245.753 -            continue;
 245.754 -        } else if (count < min_count) {
 245.755 -            s->bl_tree[curlen].Freq += count;
 245.756 -        } else if (curlen != 0) {
 245.757 -            if (curlen != prevlen) s->bl_tree[curlen].Freq++;
 245.758 -            s->bl_tree[REP_3_6].Freq++;
 245.759 -        } else if (count <= 10) {
 245.760 -            s->bl_tree[REPZ_3_10].Freq++;
 245.761 -        } else {
 245.762 -            s->bl_tree[REPZ_11_138].Freq++;
 245.763 -        }
 245.764 -        count = 0; prevlen = curlen;
 245.765 -        if (nextlen == 0) {
 245.766 -            max_count = 138, min_count = 3;
 245.767 -        } else if (curlen == nextlen) {
 245.768 -            max_count = 6, min_count = 3;
 245.769 -        } else {
 245.770 -            max_count = 7, min_count = 4;
 245.771 -        }
 245.772 -    }
 245.773 -}
 245.774 -
 245.775 -/* ===========================================================================
 245.776 - * Send a literal or distance tree in compressed form, using the codes in
 245.777 - * bl_tree.
 245.778 - */
 245.779 -local void send_tree (s, tree, max_code)
 245.780 -    deflate_state *s;
 245.781 -    ct_data *tree; /* the tree to be scanned */
 245.782 -    int max_code;       /* and its largest code of non zero frequency */
 245.783 -{
 245.784 -    int n;                     /* iterates over all tree elements */
 245.785 -    int prevlen = -1;          /* last emitted length */
 245.786 -    int curlen;                /* length of current code */
 245.787 -    int nextlen = tree[0].Len; /* length of next code */
 245.788 -    int count = 0;             /* repeat count of the current code */
 245.789 -    int max_count = 7;         /* max repeat count */
 245.790 -    int min_count = 4;         /* min repeat count */
 245.791 -
 245.792 -    /* tree[max_code+1].Len = -1; */  /* guard already set */
 245.793 -    if (nextlen == 0) max_count = 138, min_count = 3;
 245.794 -
 245.795 -    for (n = 0; n <= max_code; n++) {
 245.796 -        curlen = nextlen; nextlen = tree[n+1].Len;
 245.797 -        if (++count < max_count && curlen == nextlen) {
 245.798 -            continue;
 245.799 -        } else if (count < min_count) {
 245.800 -            do { send_code(s, curlen, s->bl_tree); } while (--count != 0);
 245.801 -
 245.802 -        } else if (curlen != 0) {
 245.803 -            if (curlen != prevlen) {
 245.804 -                send_code(s, curlen, s->bl_tree); count--;
 245.805 -            }
 245.806 -            Assert(count >= 3 && count <= 6, " 3_6?");
 245.807 -            send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);
 245.808 -
 245.809 -        } else if (count <= 10) {
 245.810 -            send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);
 245.811 -
 245.812 -        } else {
 245.813 -            send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);
 245.814 -        }
 245.815 -        count = 0; prevlen = curlen;
 245.816 -        if (nextlen == 0) {
 245.817 -            max_count = 138, min_count = 3;
 245.818 -        } else if (curlen == nextlen) {
 245.819 -            max_count = 6, min_count = 3;
 245.820 -        } else {
 245.821 -            max_count = 7, min_count = 4;
 245.822 -        }
 245.823 -    }
 245.824 -}
 245.825 -
 245.826 -/* ===========================================================================
 245.827 - * Construct the Huffman tree for the bit lengths and return the index in
 245.828 - * bl_order of the last bit length code to send.
 245.829 - */
 245.830 -local int build_bl_tree(s)
 245.831 -    deflate_state *s;
 245.832 -{
 245.833 -    int max_blindex;  /* index of last bit length code of non zero freq */
 245.834 -
 245.835 -    /* Determine the bit length frequencies for literal and distance trees */
 245.836 -    scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code);
 245.837 -    scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code);
 245.838 -
 245.839 -    /* Build the bit length tree: */
 245.840 -    build_tree(s, (tree_desc *)(&(s->bl_desc)));
 245.841 -    /* opt_len now includes the length of the tree representations, except
 245.842 -     * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
 245.843 -     */
 245.844 -
 245.845 -    /* Determine the number of bit length codes to send. The pkzip format
 245.846 -     * requires that at least 4 bit length codes be sent. (appnote.txt says
 245.847 -     * 3 but the actual value used is 4.)
 245.848 -     */
 245.849 -    for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
 245.850 -        if (s->bl_tree[bl_order[max_blindex]].Len != 0) break;
 245.851 -    }
 245.852 -    /* Update opt_len to include the bit length tree and counts */
 245.853 -    s->opt_len += 3*(max_blindex+1) + 5+5+4;
 245.854 -    Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
 245.855 -            s->opt_len, s->static_len));
 245.856 -
 245.857 -    return max_blindex;
 245.858 -}
 245.859 -
 245.860 -/* ===========================================================================
 245.861 - * Send the header for a block using dynamic Huffman trees: the counts, the
 245.862 - * lengths of the bit length codes, the literal tree and the distance tree.
 245.863 - * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
 245.864 - */
 245.865 -local void send_all_trees(s, lcodes, dcodes, blcodes)
 245.866 -    deflate_state *s;
 245.867 -    int lcodes, dcodes, blcodes; /* number of codes for each tree */
 245.868 -{
 245.869 -    int rank;                    /* index in bl_order */
 245.870 -
 245.871 -    Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
 245.872 -    Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
 245.873 -            "too many codes");
 245.874 -    Tracev((stderr, "\nbl counts: "));
 245.875 -    send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */
 245.876 -    send_bits(s, dcodes-1,   5);
 245.877 -    send_bits(s, blcodes-4,  4); /* not -3 as stated in appnote.txt */
 245.878 -    for (rank = 0; rank < blcodes; rank++) {
 245.879 -        Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
 245.880 -        send_bits(s, s->bl_tree[bl_order[rank]].Len, 3);
 245.881 -    }
 245.882 -    Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
 245.883 -
 245.884 -    send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */
 245.885 -    Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent));
 245.886 -
 245.887 -    send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */
 245.888 -    Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
 245.889 -}
 245.890 -
 245.891 -/* ===========================================================================
 245.892 - * Send a stored block
 245.893 - */
 245.894 -void _tr_stored_block(s, buf, stored_len, eof)
 245.895 -    deflate_state *s;
 245.896 -    charf *buf;       /* input block */
 245.897 -    ulg stored_len;   /* length of input block */
 245.898 -    int eof;          /* true if this is the last block for a file */
 245.899 -{
 245.900 -    send_bits(s, (STORED_BLOCK<<1)+eof, 3);  /* send block type */
 245.901 -#ifdef DEBUG
 245.902 -    s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
 245.903 -    s->compressed_len += (stored_len + 4) << 3;
 245.904 -#endif
 245.905 -    copy_block(s, buf, (unsigned)stored_len, 1); /* with header */
 245.906 -}
 245.907 -
 245.908 -/* ===========================================================================
 245.909 - * Send one empty static block to give enough lookahead for inflate.
 245.910 - * This takes 10 bits, of which 7 may remain in the bit buffer.
 245.911 - * The current inflate code requires 9 bits of lookahead. If the
 245.912 - * last two codes for the previous block (real code plus EOB) were coded
 245.913 - * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode
 245.914 - * the last real code. In this case we send two empty static blocks instead
 245.915 - * of one. (There are no problems if the previous block is stored or fixed.)
 245.916 - * To simplify the code, we assume the worst case of last real code encoded
 245.917 - * on one bit only.
 245.918 - */
 245.919 -void _tr_align(s)
 245.920 -    deflate_state *s;
 245.921 -{
 245.922 -    send_bits(s, STATIC_TREES<<1, 3);
 245.923 -    send_code(s, END_BLOCK, static_ltree);
 245.924 -#ifdef DEBUG
 245.925 -    s->compressed_len += 10L; /* 3 for block type, 7 for EOB */
 245.926 -#endif
 245.927 -    bi_flush(s);
 245.928 -    /* Of the 10 bits for the empty block, we have already sent
 245.929 -     * (10 - bi_valid) bits. The lookahead for the last real code (before
 245.930 -     * the EOB of the previous block) was thus at least one plus the length
 245.931 -     * of the EOB plus what we have just sent of the empty static block.
 245.932 -     */
 245.933 -    if (1 + s->last_eob_len + 10 - s->bi_valid < 9) {
 245.934 -        send_bits(s, STATIC_TREES<<1, 3);
 245.935 -        send_code(s, END_BLOCK, static_ltree);
 245.936 -#ifdef DEBUG
 245.937 -        s->compressed_len += 10L;
 245.938 -#endif
 245.939 -        bi_flush(s);
 245.940 -    }
 245.941 -    s->last_eob_len = 7;
 245.942 -}
 245.943 -
 245.944 -/* ===========================================================================
 245.945 - * Determine the best encoding for the current block: dynamic trees, static
 245.946 - * trees or store, and output the encoded block to the zip file.
 245.947 - */
 245.948 -void _tr_flush_block(s, buf, stored_len, eof)
 245.949 -    deflate_state *s;
 245.950 -    charf *buf;       /* input block, or NULL if too old */
 245.951 -    ulg stored_len;   /* length of input block */
 245.952 -    int eof;          /* true if this is the last block for a file */
 245.953 -{
 245.954 -    ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
 245.955 -    int max_blindex = 0;  /* index of last bit length code of non zero freq */
 245.956 -
 245.957 -    /* Build the Huffman trees unless a stored block is forced */
 245.958 -    if (s->level > 0) {
 245.959 -
 245.960 -        /* Check if the file is binary or text */
 245.961 -        if (stored_len > 0 && s->strm->data_type == Z_UNKNOWN)
 245.962 -            set_data_type(s);
 245.963 -
 245.964 -        /* Construct the literal and distance trees */
 245.965 -        build_tree(s, (tree_desc *)(&(s->l_desc)));
 245.966 -        Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len,
 245.967 -                s->static_len));
 245.968 -
 245.969 -        build_tree(s, (tree_desc *)(&(s->d_desc)));
 245.970 -        Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len,
 245.971 -                s->static_len));
 245.972 -        /* At this point, opt_len and static_len are the total bit lengths of
 245.973 -         * the compressed block data, excluding the tree representations.
 245.974 -         */
 245.975 -
 245.976 -        /* Build the bit length tree for the above two trees, and get the index
 245.977 -         * in bl_order of the last bit length code to send.
 245.978 -         */
 245.979 -        max_blindex = build_bl_tree(s);
 245.980 -
 245.981 -        /* Determine the best encoding. Compute the block lengths in bytes. */
 245.982 -        opt_lenb = (s->opt_len+3+7)>>3;
 245.983 -        static_lenb = (s->static_len+3+7)>>3;
 245.984 -
 245.985 -        Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
 245.986 -                opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
 245.987 -                s->last_lit));
 245.988 -
 245.989 -        if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
 245.990 -
 245.991 -    } else {
 245.992 -        Assert(buf != (char*)0, "lost buf");
 245.993 -        opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
 245.994 -    }
 245.995 -
 245.996 -#ifdef FORCE_STORED
 245.997 -    if (buf != (char*)0) { /* force stored block */
 245.998 -#else
 245.999 -    if (stored_len+4 <= opt_lenb && buf != (char*)0) {
245.1000 -                       /* 4: two words for the lengths */
245.1001 -#endif
245.1002 -        /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
245.1003 -         * Otherwise we can't have processed more than WSIZE input bytes since
245.1004 -         * the last block flush, because compression would have been
245.1005 -         * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
245.1006 -         * transform a block into a stored block.
245.1007 -         */
245.1008 -        _tr_stored_block(s, buf, stored_len, eof);
245.1009 -
245.1010 -#ifdef FORCE_STATIC
245.1011 -    } else if (static_lenb >= 0) { /* force static trees */
245.1012 -#else
245.1013 -    } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) {
245.1014 -#endif
245.1015 -        send_bits(s, (STATIC_TREES<<1)+eof, 3);
245.1016 -        compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree);
245.1017 -#ifdef DEBUG
245.1018 -        s->compressed_len += 3 + s->static_len;
245.1019 -#endif
245.1020 -    } else {
245.1021 -        send_bits(s, (DYN_TREES<<1)+eof, 3);
245.1022 -        send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
245.1023 -                       max_blindex+1);
245.1024 -        compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree);
245.1025 -#ifdef DEBUG
245.1026 -        s->compressed_len += 3 + s->opt_len;
245.1027 -#endif
245.1028 -    }
245.1029 -    Assert (s->compressed_len == s->bits_sent, "bad compressed size");
245.1030 -    /* The above check is made mod 2^32, for files larger than 512 MB
245.1031 -     * and uLong implemented on 32 bits.
245.1032 -     */
245.1033 -    init_block(s);
245.1034 -
245.1035 -    if (eof) {
245.1036 -        bi_windup(s);
245.1037 -#ifdef DEBUG
245.1038 -        s->compressed_len += 7;  /* align on byte boundary */
245.1039 -#endif
245.1040 -    }
245.1041 -    Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
245.1042 -           s->compressed_len-7*eof));
245.1043 -}
245.1044 -
245.1045 -/* ===========================================================================
245.1046 - * Save the match info and tally the frequency counts. Return true if
245.1047 - * the current block must be flushed.
245.1048 - */
245.1049 -int _tr_tally (s, dist, lc)
245.1050 -    deflate_state *s;
245.1051 -    unsigned dist;  /* distance of matched string */
245.1052 -    unsigned lc;    /* match length-MIN_MATCH or unmatched char (if dist==0) */
245.1053 -{
245.1054 -    s->d_buf[s->last_lit] = (ush)dist;
245.1055 -    s->l_buf[s->last_lit++] = (uch)lc;
245.1056 -    if (dist == 0) {
245.1057 -        /* lc is the unmatched char */
245.1058 -        s->dyn_ltree[lc].Freq++;
245.1059 -    } else {
245.1060 -        s->matches++;
245.1061 -        /* Here, lc is the match length - MIN_MATCH */
245.1062 -        dist--;             /* dist = match distance - 1 */
245.1063 -        Assert((ush)dist < (ush)MAX_DIST(s) &&
245.1064 -               (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
245.1065 -               (ush)d_code(dist) < (ush)D_CODES,  "_tr_tally: bad match");
245.1066 -
245.1067 -        s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
245.1068 -        s->dyn_dtree[d_code(dist)].Freq++;
245.1069 -    }
245.1070 -
245.1071 -#ifdef TRUNCATE_BLOCK
245.1072 -    /* Try to guess if it is profitable to stop the current block here */
245.1073 -    if ((s->last_lit & 0x1fff) == 0 && s->level > 2) {
245.1074 -        /* Compute an upper bound for the compressed length */
245.1075 -        ulg out_length = (ulg)s->last_lit*8L;
245.1076 -        ulg in_length = (ulg)((long)s->strstart - s->block_start);
245.1077 -        int dcode;
245.1078 -        for (dcode = 0; dcode < D_CODES; dcode++) {
245.1079 -            out_length += (ulg)s->dyn_dtree[dcode].Freq *
245.1080 -                (5L+extra_dbits[dcode]);
245.1081 -        }
245.1082 -        out_length >>= 3;
245.1083 -        Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
245.1084 -               s->last_lit, in_length, out_length,
245.1085 -               100L - out_length*100L/in_length));
245.1086 -        if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1;
245.1087 -    }
245.1088 -#endif
245.1089 -    return (s->last_lit == s->lit_bufsize-1);
245.1090 -    /* We avoid equality with lit_bufsize because of wraparound at 64K
245.1091 -     * on 16 bit machines and because stored blocks are restricted to
245.1092 -     * 64K-1 bytes.
245.1093 -     */
245.1094 -}
245.1095 -
245.1096 -/* ===========================================================================
245.1097 - * Send the block data compressed using the given Huffman trees
245.1098 - */
245.1099 -local void compress_block(s, ltree, dtree)
245.1100 -    deflate_state *s;
245.1101 -    ct_data *ltree; /* literal tree */
245.1102 -    ct_data *dtree; /* distance tree */
245.1103 -{
245.1104 -    unsigned dist;      /* distance of matched string */
245.1105 -    int lc;             /* match length or unmatched char (if dist == 0) */
245.1106 -    unsigned lx = 0;    /* running index in l_buf */
245.1107 -    unsigned code;      /* the code to send */
245.1108 -    int extra;          /* number of extra bits to send */
245.1109 -
245.1110 -    if (s->last_lit != 0) do {
245.1111 -        dist = s->d_buf[lx];
245.1112 -        lc = s->l_buf[lx++];
245.1113 -        if (dist == 0) {
245.1114 -            send_code(s, lc, ltree); /* send a literal byte */
245.1115 -            Tracecv(isgraph(lc), (stderr," '%c' ", lc));
245.1116 -        } else {
245.1117 -            /* Here, lc is the match length - MIN_MATCH */
245.1118 -            code = _length_code[lc];
245.1119 -            send_code(s, code+LITERALS+1, ltree); /* send the length code */
245.1120 -            extra = extra_lbits[code];
245.1121 -            if (extra != 0) {
245.1122 -                lc -= base_length[code];
245.1123 -                send_bits(s, lc, extra);       /* send the extra length bits */
245.1124 -            }
245.1125 -            dist--; /* dist is now the match distance - 1 */
245.1126 -            code = d_code(dist);
245.1127 -            Assert (code < D_CODES, "bad d_code");
245.1128 -
245.1129 -            send_code(s, code, dtree);       /* send the distance code */
245.1130 -            extra = extra_dbits[code];
245.1131 -            if (extra != 0) {
245.1132 -                dist -= base_dist[code];
245.1133 -                send_bits(s, dist, extra);   /* send the extra distance bits */
245.1134 -            }
245.1135 -        } /* literal or match pair ? */
245.1136 -
245.1137 -        /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
245.1138 -        Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
245.1139 -               "pendingBuf overflow");
245.1140 -
245.1141 -    } while (lx < s->last_lit);
245.1142 -
245.1143 -    send_code(s, END_BLOCK, ltree);
245.1144 -    s->last_eob_len = ltree[END_BLOCK].Len;
245.1145 -}
245.1146 -
245.1147 -/* ===========================================================================
245.1148 - * Set the data type to BINARY or TEXT, using a crude approximation:
245.1149 - * set it to Z_TEXT if all symbols are either printable characters (33 to 255)
245.1150 - * or white spaces (9 to 13, or 32); or set it to Z_BINARY otherwise.
245.1151 - * IN assertion: the fields Freq of dyn_ltree are set.
245.1152 - */
245.1153 -local void set_data_type(s)
245.1154 -    deflate_state *s;
245.1155 -{
245.1156 -    int n;
245.1157 -
245.1158 -    for (n = 0; n < 9; n++)
245.1159 -        if (s->dyn_ltree[n].Freq != 0)
245.1160 -            break;
245.1161 -    if (n == 9)
245.1162 -        for (n = 14; n < 32; n++)
245.1163 -            if (s->dyn_ltree[n].Freq != 0)
245.1164 -                break;
245.1165 -    s->strm->data_type = (n == 32) ? Z_TEXT : Z_BINARY;
245.1166 -}
245.1167 -
245.1168 -/* ===========================================================================
245.1169 - * Reverse the first len bits of a code, using straightforward code (a faster
245.1170 - * method would use a table)
245.1171 - * IN assertion: 1 <= len <= 15
245.1172 - */
245.1173 -local unsigned bi_reverse(code, len)
245.1174 -    unsigned code; /* the value to invert */
245.1175 -    int len;       /* its bit length */
245.1176 -{
245.1177 -    register unsigned res = 0;
245.1178 -    do {
245.1179 -        res |= code & 1;
245.1180 -        code >>= 1, res <<= 1;
245.1181 -    } while (--len > 0);
245.1182 -    return res >> 1;
245.1183 -}
245.1184 -
245.1185 -/* ===========================================================================
245.1186 - * Flush the bit buffer, keeping at most 7 bits in it.
245.1187 - */
245.1188 -local void bi_flush(s)
245.1189 -    deflate_state *s;
245.1190 -{
245.1191 -    if (s->bi_valid == 16) {
245.1192 -        put_short(s, s->bi_buf);
245.1193 -        s->bi_buf = 0;
245.1194 -        s->bi_valid = 0;
245.1195 -    } else if (s->bi_valid >= 8) {
245.1196 -        put_byte(s, (Byte)s->bi_buf);
245.1197 -        s->bi_buf >>= 8;
245.1198 -        s->bi_valid -= 8;
245.1199 -    }
245.1200 -}
245.1201 -
245.1202 -/* ===========================================================================
245.1203 - * Flush the bit buffer and align the output on a byte boundary
245.1204 - */
245.1205 -local void bi_windup(s)
245.1206 -    deflate_state *s;
245.1207 -{
245.1208 -    if (s->bi_valid > 8) {
245.1209 -        put_short(s, s->bi_buf);
245.1210 -    } else if (s->bi_valid > 0) {
245.1211 -        put_byte(s, (Byte)s->bi_buf);
245.1212 -    }
245.1213 -    s->bi_buf = 0;
245.1214 -    s->bi_valid = 0;
245.1215 -#ifdef DEBUG
245.1216 -    s->bits_sent = (s->bits_sent+7) & ~7;
245.1217 -#endif
245.1218 -}
245.1219 -
245.1220 -/* ===========================================================================
245.1221 - * Copy a stored block, storing first the length and its
245.1222 - * one's complement if requested.
245.1223 - */
245.1224 -local void copy_block(s, buf, len, header)
245.1225 -    deflate_state *s;
245.1226 -    charf    *buf;    /* the input data */
245.1227 -    unsigned len;     /* its length */
245.1228 -    int      header;  /* true if block header must be written */
245.1229 -{
245.1230 -    bi_windup(s);        /* align on byte boundary */
245.1231 -    s->last_eob_len = 8; /* enough lookahead for inflate */
245.1232 -
245.1233 -    if (header) {
245.1234 -        put_short(s, (ush)len);
245.1235 -        put_short(s, (ush)~len);
245.1236 -#ifdef DEBUG
245.1237 -        s->bits_sent += 2*16;
245.1238 -#endif
245.1239 -    }
245.1240 -#ifdef DEBUG
245.1241 -    s->bits_sent += (ulg)len<<3;
245.1242 -#endif
245.1243 -    while (len--) {
245.1244 -        put_byte(s, *buf++);
245.1245 -    }
245.1246 -}
   246.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/trees.h	Tue Dec 06 16:31:58 2011 -0800
   246.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   246.3 @@ -1,152 +0,0 @@
   246.4 -/*
   246.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   246.6 - *
   246.7 - * This code is free software; you can redistribute it and/or modify it
   246.8 - * under the terms of the GNU General Public License version 2 only, as
   246.9 - * published by the Free Software Foundation.  Oracle designates this
  246.10 - * particular file as subject to the "Classpath" exception as provided
  246.11 - * by Oracle in the LICENSE file that accompanied this code.
  246.12 - *
  246.13 - * This code is distributed in the hope that it will be useful, but WITHOUT
  246.14 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  246.15 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  246.16 - * version 2 for more details (a copy is included in the LICENSE file that
  246.17 - * accompanied this code).
  246.18 - *
  246.19 - * You should have received a copy of the GNU General Public License version
  246.20 - * 2 along with this work; if not, write to the Free Software Foundation,
  246.21 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  246.22 - *
  246.23 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  246.24 - * or visit www.oracle.com if you need additional information or have any
  246.25 - * questions.
  246.26 - */
  246.27 -
  246.28 -/* header created automatically with -DGEN_TREES_H */
  246.29 -
  246.30 -local const ct_data static_ltree[L_CODES+2] = {
  246.31 -{{ 12},{  8}}, {{140},{  8}}, {{ 76},{  8}}, {{204},{  8}}, {{ 44},{  8}},
  246.32 -{{172},{  8}}, {{108},{  8}}, {{236},{  8}}, {{ 28},{  8}}, {{156},{  8}},
  246.33 -{{ 92},{  8}}, {{220},{  8}}, {{ 60},{  8}}, {{188},{  8}}, {{124},{  8}},
  246.34 -{{252},{  8}}, {{  2},{  8}}, {{130},{  8}}, {{ 66},{  8}}, {{194},{  8}},
  246.35 -{{ 34},{  8}}, {{162},{  8}}, {{ 98},{  8}}, {{226},{  8}}, {{ 18},{  8}},
  246.36 -{{146},{  8}}, {{ 82},{  8}}, {{210},{  8}}, {{ 50},{  8}}, {{178},{  8}},
  246.37 -{{114},{  8}}, {{242},{  8}}, {{ 10},{  8}}, {{138},{  8}}, {{ 74},{  8}},
  246.38 -{{202},{  8}}, {{ 42},{  8}}, {{170},{  8}}, {{106},{  8}}, {{234},{  8}},
  246.39 -{{ 26},{  8}}, {{154},{  8}}, {{ 90},{  8}}, {{218},{  8}}, {{ 58},{  8}},
  246.40 -{{186},{  8}}, {{122},{  8}}, {{250},{  8}}, {{  6},{  8}}, {{134},{  8}},
  246.41 -{{ 70},{  8}}, {{198},{  8}}, {{ 38},{  8}}, {{166},{  8}}, {{102},{  8}},
  246.42 -{{230},{  8}}, {{ 22},{  8}}, {{150},{  8}}, {{ 86},{  8}}, {{214},{  8}},
  246.43 -{{ 54},{  8}}, {{182},{  8}}, {{118},{  8}}, {{246},{  8}}, {{ 14},{  8}},
  246.44 -{{142},{  8}}, {{ 78},{  8}}, {{206},{  8}}, {{ 46},{  8}}, {{174},{  8}},
  246.45 -{{110},{  8}}, {{238},{  8}}, {{ 30},{  8}}, {{158},{  8}}, {{ 94},{  8}},
  246.46 -{{222},{  8}}, {{ 62},{  8}}, {{190},{  8}}, {{126},{  8}}, {{254},{  8}},
  246.47 -{{  1},{  8}}, {{129},{  8}}, {{ 65},{  8}}, {{193},{  8}}, {{ 33},{  8}},
  246.48 -{{161},{  8}}, {{ 97},{  8}}, {{225},{  8}}, {{ 17},{  8}}, {{145},{  8}},
  246.49 -{{ 81},{  8}}, {{209},{  8}}, {{ 49},{  8}}, {{177},{  8}}, {{113},{  8}},
  246.50 -{{241},{  8}}, {{  9},{  8}}, {{137},{  8}}, {{ 73},{  8}}, {{201},{  8}},
  246.51 -{{ 41},{  8}}, {{169},{  8}}, {{105},{  8}}, {{233},{  8}}, {{ 25},{  8}},
  246.52 -{{153},{  8}}, {{ 89},{  8}}, {{217},{  8}}, {{ 57},{  8}}, {{185},{  8}},
  246.53 -{{121},{  8}}, {{249},{  8}}, {{  5},{  8}}, {{133},{  8}}, {{ 69},{  8}},
  246.54 -{{197},{  8}}, {{ 37},{  8}}, {{165},{  8}}, {{101},{  8}}, {{229},{  8}},
  246.55 -{{ 21},{  8}}, {{149},{  8}}, {{ 85},{  8}}, {{213},{  8}}, {{ 53},{  8}},
  246.56 -{{181},{  8}}, {{117},{  8}}, {{245},{  8}}, {{ 13},{  8}}, {{141},{  8}},
  246.57 -{{ 77},{  8}}, {{205},{  8}}, {{ 45},{  8}}, {{173},{  8}}, {{109},{  8}},
  246.58 -{{237},{  8}}, {{ 29},{  8}}, {{157},{  8}}, {{ 93},{  8}}, {{221},{  8}},
  246.59 -{{ 61},{  8}}, {{189},{  8}}, {{125},{  8}}, {{253},{  8}}, {{ 19},{  9}},
  246.60 -{{275},{  9}}, {{147},{  9}}, {{403},{  9}}, {{ 83},{  9}}, {{339},{  9}},
  246.61 -{{211},{  9}}, {{467},{  9}}, {{ 51},{  9}}, {{307},{  9}}, {{179},{  9}},
  246.62 -{{435},{  9}}, {{115},{  9}}, {{371},{  9}}, {{243},{  9}}, {{499},{  9}},
  246.63 -{{ 11},{  9}}, {{267},{  9}}, {{139},{  9}}, {{395},{  9}}, {{ 75},{  9}},
  246.64 -{{331},{  9}}, {{203},{  9}}, {{459},{  9}}, {{ 43},{  9}}, {{299},{  9}},
  246.65 -{{171},{  9}}, {{427},{  9}}, {{107},{  9}}, {{363},{  9}}, {{235},{  9}},
  246.66 -{{491},{  9}}, {{ 27},{  9}}, {{283},{  9}}, {{155},{  9}}, {{411},{  9}},
  246.67 -{{ 91},{  9}}, {{347},{  9}}, {{219},{  9}}, {{475},{  9}}, {{ 59},{  9}},
  246.68 -{{315},{  9}}, {{187},{  9}}, {{443},{  9}}, {{123},{  9}}, {{379},{  9}},
  246.69 -{{251},{  9}}, {{507},{  9}}, {{  7},{  9}}, {{263},{  9}}, {{135},{  9}},
  246.70 -{{391},{  9}}, {{ 71},{  9}}, {{327},{  9}}, {{199},{  9}}, {{455},{  9}},
  246.71 -{{ 39},{  9}}, {{295},{  9}}, {{167},{  9}}, {{423},{  9}}, {{103},{  9}},
  246.72 -{{359},{  9}}, {{231},{  9}}, {{487},{  9}}, {{ 23},{  9}}, {{279},{  9}},
  246.73 -{{151},{  9}}, {{407},{  9}}, {{ 87},{  9}}, {{343},{  9}}, {{215},{  9}},
  246.74 -{{471},{  9}}, {{ 55},{  9}}, {{311},{  9}}, {{183},{  9}}, {{439},{  9}},
  246.75 -{{119},{  9}}, {{375},{  9}}, {{247},{  9}}, {{503},{  9}}, {{ 15},{  9}},
  246.76 -{{271},{  9}}, {{143},{  9}}, {{399},{  9}}, {{ 79},{  9}}, {{335},{  9}},
  246.77 -{{207},{  9}}, {{463},{  9}}, {{ 47},{  9}}, {{303},{  9}}, {{175},{  9}},
  246.78 -{{431},{  9}}, {{111},{  9}}, {{367},{  9}}, {{239},{  9}}, {{495},{  9}},
  246.79 -{{ 31},{  9}}, {{287},{  9}}, {{159},{  9}}, {{415},{  9}}, {{ 95},{  9}},
  246.80 -{{351},{  9}}, {{223},{  9}}, {{479},{  9}}, {{ 63},{  9}}, {{319},{  9}},
  246.81 -{{191},{  9}}, {{447},{  9}}, {{127},{  9}}, {{383},{  9}}, {{255},{  9}},
  246.82 -{{511},{  9}}, {{  0},{  7}}, {{ 64},{  7}}, {{ 32},{  7}}, {{ 96},{  7}},
  246.83 -{{ 16},{  7}}, {{ 80},{  7}}, {{ 48},{  7}}, {{112},{  7}}, {{  8},{  7}},
  246.84 -{{ 72},{  7}}, {{ 40},{  7}}, {{104},{  7}}, {{ 24},{  7}}, {{ 88},{  7}},
  246.85 -{{ 56},{  7}}, {{120},{  7}}, {{  4},{  7}}, {{ 68},{  7}}, {{ 36},{  7}},
  246.86 -{{100},{  7}}, {{ 20},{  7}}, {{ 84},{  7}}, {{ 52},{  7}}, {{116},{  7}},
  246.87 -{{  3},{  8}}, {{131},{  8}}, {{ 67},{  8}}, {{195},{  8}}, {{ 35},{  8}},
  246.88 -{{163},{  8}}, {{ 99},{  8}}, {{227},{  8}}
  246.89 -};
  246.90 -
  246.91 -local const ct_data static_dtree[D_CODES] = {
  246.92 -{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}},
  246.93 -{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}},
  246.94 -{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}},
  246.95 -{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}},
  246.96 -{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}},
  246.97 -{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}}
  246.98 -};
  246.99 -
 246.100 -const uch _dist_code[DIST_CODE_LEN] = {
 246.101 - 0,  1,  2,  3,  4,  4,  5,  5,  6,  6,  6,  6,  7,  7,  7,  7,  8,  8,  8,  8,
 246.102 - 8,  8,  8,  8,  9,  9,  9,  9,  9,  9,  9,  9, 10, 10, 10, 10, 10, 10, 10, 10,
 246.103 -10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
 246.104 -11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
 246.105 -12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13,
 246.106 -13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
 246.107 -13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
 246.108 -14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
 246.109 -14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
 246.110 -14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15,
 246.111 -15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
 246.112 -15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
 246.113 -15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,  0,  0, 16, 17,
 246.114 -18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22,
 246.115 -23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
 246.116 -24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
 246.117 -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
 246.118 -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27,
 246.119 -27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
 246.120 -27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
 246.121 -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
 246.122 -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
 246.123 -28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
 246.124 -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
 246.125 -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
 246.126 -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
 246.127 -};
 246.128 -
 246.129 -const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {
 246.130 - 0,  1,  2,  3,  4,  5,  6,  7,  8,  8,  9,  9, 10, 10, 11, 11, 12, 12, 12, 12,
 246.131 -13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
 246.132 -17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,
 246.133 -19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
 246.134 -21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22,
 246.135 -22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23,
 246.136 -23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
 246.137 -24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
 246.138 -25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
 246.139 -25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26,
 246.140 -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
 246.141 -26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
 246.142 -27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28
 246.143 -};
 246.144 -
 246.145 -local const int base_length[LENGTH_CODES] = {
 246.146 -0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56,
 246.147 -64, 80, 96, 112, 128, 160, 192, 224, 0
 246.148 -};
 246.149 -
 246.150 -local const int base_dist[D_CODES] = {
 246.151 -    0,     1,     2,     3,     4,     6,     8,    12,    16,    24,
 246.152 -   32,    48,    64,    96,   128,   192,   256,   384,   512,   768,
 246.153 - 1024,  1536,  2048,  3072,  4096,  6144,  8192, 12288, 16384, 24576
 246.154 -};
 246.155 -
   247.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/uncompr.c	Tue Dec 06 16:31:58 2011 -0800
   247.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   247.3 @@ -1,85 +0,0 @@
   247.4 -/*
   247.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   247.6 - *
   247.7 - * This code is free software; you can redistribute it and/or modify it
   247.8 - * under the terms of the GNU General Public License version 2 only, as
   247.9 - * published by the Free Software Foundation.  Oracle designates this
  247.10 - * particular file as subject to the "Classpath" exception as provided
  247.11 - * by Oracle in the LICENSE file that accompanied this code.
  247.12 - *
  247.13 - * This code is distributed in the hope that it will be useful, but WITHOUT
  247.14 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  247.15 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  247.16 - * version 2 for more details (a copy is included in the LICENSE file that
  247.17 - * accompanied this code).
  247.18 - *
  247.19 - * You should have received a copy of the GNU General Public License version
  247.20 - * 2 along with this work; if not, write to the Free Software Foundation,
  247.21 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  247.22 - *
  247.23 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  247.24 - * or visit www.oracle.com if you need additional information or have any
  247.25 - * questions.
  247.26 - */
  247.27 -
  247.28 -/* uncompr.c -- decompress a memory buffer
  247.29 - * Copyright (C) 1995-2003 Jean-loup Gailly.
  247.30 - * For conditions of distribution and use, see copyright notice in zlib.h
  247.31 - */
  247.32 -
  247.33 -/* @(#) $Id$ */
  247.34 -
  247.35 -#define ZLIB_INTERNAL
  247.36 -#include "zlib.h"
  247.37 -
  247.38 -/* ===========================================================================
  247.39 -     Decompresses the source buffer into the destination buffer.  sourceLen is
  247.40 -   the byte length of the source buffer. Upon entry, destLen is the total
  247.41 -   size of the destination buffer, which must be large enough to hold the
  247.42 -   entire uncompressed data. (The size of the uncompressed data must have
  247.43 -   been saved previously by the compressor and transmitted to the decompressor
  247.44 -   by some mechanism outside the scope of this compression library.)
  247.45 -   Upon exit, destLen is the actual size of the compressed buffer.
  247.46 -     This function can be used to decompress a whole file at once if the
  247.47 -   input file is mmap'ed.
  247.48 -
  247.49 -     uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
  247.50 -   enough memory, Z_BUF_ERROR if there was not enough room in the output
  247.51 -   buffer, or Z_DATA_ERROR if the input data was corrupted.
  247.52 -*/
  247.53 -int ZEXPORT uncompress (dest, destLen, source, sourceLen)
  247.54 -    Bytef *dest;
  247.55 -    uLongf *destLen;
  247.56 -    const Bytef *source;
  247.57 -    uLong sourceLen;
  247.58 -{
  247.59 -    z_stream stream;
  247.60 -    int err;
  247.61 -
  247.62 -    stream.next_in = (Bytef*)source;
  247.63 -    stream.avail_in = (uInt)sourceLen;
  247.64 -    /* Check for source > 64K on 16-bit machine: */
  247.65 -    if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
  247.66 -
  247.67 -    stream.next_out = dest;
  247.68 -    stream.avail_out = (uInt)*destLen;
  247.69 -    if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
  247.70 -
  247.71 -    stream.zalloc = (alloc_func)0;
  247.72 -    stream.zfree = (free_func)0;
  247.73 -
  247.74 -    err = inflateInit(&stream);
  247.75 -    if (err != Z_OK) return err;
  247.76 -
  247.77 -    err = inflate(&stream, Z_FINISH);
  247.78 -    if (err != Z_STREAM_END) {
  247.79 -        inflateEnd(&stream);
  247.80 -        if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0))
  247.81 -            return Z_DATA_ERROR;
  247.82 -        return err;
  247.83 -    }
  247.84 -    *destLen = (uLong)stream.total_out;
  247.85 -
  247.86 -    err = inflateEnd(&stream);
  247.87 -    return err;
  247.88 -}
   248.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/zadler32.c	Tue Dec 06 16:31:58 2011 -0800
   248.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   248.3 @@ -1,173 +0,0 @@
   248.4 -/*
   248.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   248.6 - *
   248.7 - * This code is free software; you can redistribute it and/or modify it
   248.8 - * under the terms of the GNU General Public License version 2 only, as
   248.9 - * published by the Free Software Foundation.  Oracle designates this
  248.10 - * particular file as subject to the "Classpath" exception as provided
  248.11 - * by Oracle in the LICENSE file that accompanied this code.
  248.12 - *
  248.13 - * This code is distributed in the hope that it will be useful, but WITHOUT
  248.14 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  248.15 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  248.16 - * version 2 for more details (a copy is included in the LICENSE file that
  248.17 - * accompanied this code).
  248.18 - *
  248.19 - * You should have received a copy of the GNU General Public License version
  248.20 - * 2 along with this work; if not, write to the Free Software Foundation,
  248.21 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  248.22 - *
  248.23 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  248.24 - * or visit www.oracle.com if you need additional information or have any
  248.25 - * questions.
  248.26 - */
  248.27 -
  248.28 -/* adler32.c -- compute the Adler-32 checksum of a data stream
  248.29 - * Copyright (C) 1995-2004 Mark Adler
  248.30 - * For conditions of distribution and use, see copyright notice in zlib.h
  248.31 - */
  248.32 -
  248.33 -/* @(#) $Id$ */
  248.34 -
  248.35 -#define ZLIB_INTERNAL
  248.36 -#include "zlib.h"
  248.37 -
  248.38 -#define BASE 65521UL    /* largest prime smaller than 65536 */
  248.39 -#define NMAX 5552
  248.40 -/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
  248.41 -
  248.42 -#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  248.43 -#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  248.44 -#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  248.45 -#define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  248.46 -#define DO16(buf)   DO8(buf,0); DO8(buf,8);
  248.47 -
  248.48 -/* use NO_DIVIDE if your processor does not do division in hardware */
  248.49 -#ifdef NO_DIVIDE
  248.50 -#  define MOD(a) \
  248.51 -    do { \
  248.52 -        if (a >= (BASE << 16)) a -= (BASE << 16); \
  248.53 -        if (a >= (BASE << 15)) a -= (BASE << 15); \
  248.54 -        if (a >= (BASE << 14)) a -= (BASE << 14); \
  248.55 -        if (a >= (BASE << 13)) a -= (BASE << 13); \
  248.56 -        if (a >= (BASE << 12)) a -= (BASE << 12); \
  248.57 -        if (a >= (BASE << 11)) a -= (BASE << 11); \
  248.58 -        if (a >= (BASE << 10)) a -= (BASE << 10); \
  248.59 -        if (a >= (BASE << 9)) a -= (BASE << 9); \
  248.60 -        if (a >= (BASE << 8)) a -= (BASE << 8); \
  248.61 -        if (a >= (BASE << 7)) a -= (BASE << 7); \
  248.62 -        if (a >= (BASE << 6)) a -= (BASE << 6); \
  248.63 -        if (a >= (BASE << 5)) a -= (BASE << 5); \
  248.64 -        if (a >= (BASE << 4)) a -= (BASE << 4); \
  248.65 -        if (a >= (BASE << 3)) a -= (BASE << 3); \
  248.66 -        if (a >= (BASE << 2)) a -= (BASE << 2); \
  248.67 -        if (a >= (BASE << 1)) a -= (BASE << 1); \
  248.68 -        if (a >= BASE) a -= BASE; \
  248.69 -    } while (0)
  248.70 -#  define MOD4(a) \
  248.71 -    do { \
  248.72 -        if (a >= (BASE << 4)) a -= (BASE << 4); \
  248.73 -        if (a >= (BASE << 3)) a -= (BASE << 3); \
  248.74 -        if (a >= (BASE << 2)) a -= (BASE << 2); \
  248.75 -        if (a >= (BASE << 1)) a -= (BASE << 1); \
  248.76 -        if (a >= BASE) a -= BASE; \
  248.77 -    } while (0)
  248.78 -#else
  248.79 -#  define MOD(a) a %= BASE
  248.80 -#  define MOD4(a) a %= BASE
  248.81 -#endif
  248.82 -
  248.83 -/* ========================================================================= */
  248.84 -uLong ZEXPORT adler32(adler, buf, len)
  248.85 -    uLong adler;
  248.86 -    const Bytef *buf;
  248.87 -    uInt len;
  248.88 -{
  248.89 -    unsigned long sum2;
  248.90 -    unsigned n;
  248.91 -
  248.92 -    /* split Adler-32 into component sums */
  248.93 -    sum2 = (adler >> 16) & 0xffff;
  248.94 -    adler &= 0xffff;
  248.95 -
  248.96 -    /* in case user likes doing a byte at a time, keep it fast */
  248.97 -    if (len == 1) {
  248.98 -        adler += buf[0];
  248.99 -        if (adler >= BASE)
 248.100 -            adler -= BASE;
 248.101 -        sum2 += adler;
 248.102 -        if (sum2 >= BASE)
 248.103 -            sum2 -= BASE;
 248.104 -        return adler | (sum2 << 16);
 248.105 -    }
 248.106 -
 248.107 -    /* initial Adler-32 value (deferred check for len == 1 speed) */
 248.108 -    if (buf == Z_NULL)
 248.109 -        return 1L;
 248.110 -
 248.111 -    /* in case short lengths are provided, keep it somewhat fast */
 248.112 -    if (len < 16) {
 248.113 -        while (len--) {
 248.114 -            adler += *buf++;
 248.115 -            sum2 += adler;
 248.116 -        }
 248.117 -        if (adler >= BASE)
 248.118 -            adler -= BASE;
 248.119 -        MOD4(sum2);             /* only added so many BASE's */
 248.120 -        return adler | (sum2 << 16);
 248.121 -    }
 248.122 -
 248.123 -    /* do length NMAX blocks -- requires just one modulo operation */
 248.124 -    while (len >= NMAX) {
 248.125 -        len -= NMAX;
 248.126 -        n = NMAX / 16;          /* NMAX is divisible by 16 */
 248.127 -        do {
 248.128 -            DO16(buf);          /* 16 sums unrolled */
 248.129 -            buf += 16;
 248.130 -        } while (--n);
 248.131 -        MOD(adler);
 248.132 -        MOD(sum2);
 248.133 -    }
 248.134 -
 248.135 -    /* do remaining bytes (less than NMAX, still just one modulo) */
 248.136 -    if (len) {                  /* avoid modulos if none remaining */
 248.137 -        while (len >= 16) {
 248.138 -            len -= 16;
 248.139 -            DO16(buf);
 248.140 -            buf += 16;
 248.141 -        }
 248.142 -        while (len--) {
 248.143 -            adler += *buf++;
 248.144 -            sum2 += adler;
 248.145 -        }
 248.146 -        MOD(adler);
 248.147 -        MOD(sum2);
 248.148 -    }
 248.149 -
 248.150 -    /* return recombined sums */
 248.151 -    return adler | (sum2 << 16);
 248.152 -}
 248.153 -
 248.154 -/* ========================================================================= */
 248.155 -uLong ZEXPORT adler32_combine(adler1, adler2, len2)
 248.156 -    uLong adler1;
 248.157 -    uLong adler2;
 248.158 -    z_off_t len2;
 248.159 -{
 248.160 -    unsigned long sum1;
 248.161 -    unsigned long sum2;
 248.162 -    unsigned rem;
 248.163 -
 248.164 -    /* the derivation of this formula is left as an exercise for the reader */
 248.165 -    rem = (unsigned)(len2 % BASE);
 248.166 -    sum1 = adler1 & 0xffff;
 248.167 -    sum2 = rem * sum1;
 248.168 -    MOD(sum2);
 248.169 -    sum1 += (adler2 & 0xffff) + BASE - 1;
 248.170 -    sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
 248.171 -    if (sum1 > BASE) sum1 -= BASE;
 248.172 -    if (sum1 > BASE) sum1 -= BASE;
 248.173 -    if (sum2 > (BASE << 1)) sum2 -= (BASE << 1);
 248.174 -    if (sum2 > BASE) sum2 -= BASE;
 248.175 -    return sum1 | (sum2 << 16);
 248.176 -}
   249.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/zconf.h	Tue Dec 06 16:31:58 2011 -0800
   249.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   249.3 @@ -1,363 +0,0 @@
   249.4 -/*
   249.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   249.6 - *
   249.7 - * This code is free software; you can redistribute it and/or modify it
   249.8 - * under the terms of the GNU General Public License version 2 only, as
   249.9 - * published by the Free Software Foundation.  Oracle designates this
  249.10 - * particular file as subject to the "Classpath" exception as provided
  249.11 - * by Oracle in the LICENSE file that accompanied this code.
  249.12 - *
  249.13 - * This code is distributed in the hope that it will be useful, but WITHOUT
  249.14 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  249.15 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  249.16 - * version 2 for more details (a copy is included in the LICENSE file that
  249.17 - * accompanied this code).
  249.18 - *
  249.19 - * You should have received a copy of the GNU General Public License version
  249.20 - * 2 along with this work; if not, write to the Free Software Foundation,
  249.21 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  249.22 - *
  249.23 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  249.24 - * or visit www.oracle.com if you need additional information or have any
  249.25 - * questions.
  249.26 - */
  249.27 -
  249.28 -/* zconf.h -- configuration of the zlib compression library
  249.29 - * Copyright (C) 1995-2005 Jean-loup Gailly.
  249.30 - * For conditions of distribution and use, see copyright notice in zlib.h
  249.31 - */
  249.32 -
  249.33 -/* @(#) $Id$ */
  249.34 -
  249.35 -#ifndef ZCONF_H
  249.36 -#define ZCONF_H
  249.37 -
  249.38 -/* for _LP64 */
  249.39 -#include <sys/types.h>
  249.40 -
  249.41 -/*
  249.42 - * If you *really* need a unique prefix for all types and library functions,
  249.43 - * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
  249.44 - */
  249.45 -#ifdef Z_PREFIX
  249.46 -#  define deflateInit_          z_deflateInit_
  249.47 -#  define deflate               z_deflate
  249.48 -#  define deflateEnd            z_deflateEnd
  249.49 -#  define inflateInit_          z_inflateInit_
  249.50 -#  define inflate               z_inflate
  249.51 -#  define inflateEnd            z_inflateEnd
  249.52 -#  define deflateInit2_         z_deflateInit2_
  249.53 -#  define deflateSetDictionary  z_deflateSetDictionary
  249.54 -#  define deflateCopy           z_deflateCopy
  249.55 -#  define deflateReset          z_deflateReset
  249.56 -#  define deflateParams         z_deflateParams
  249.57 -#  define deflateBound          z_deflateBound
  249.58 -#  define deflatePrime          z_deflatePrime
  249.59 -#  define inflateInit2_         z_inflateInit2_
  249.60 -#  define inflateSetDictionary  z_inflateSetDictionary
  249.61 -#  define inflateSync           z_inflateSync
  249.62 -#  define inflateSyncPoint      z_inflateSyncPoint
  249.63 -#  define inflateCopy           z_inflateCopy
  249.64 -#  define inflateReset          z_inflateReset
  249.65 -#  define inflateBack           z_inflateBack
  249.66 -#  define inflateBackEnd        z_inflateBackEnd
  249.67 -#  define compress              z_compress
  249.68 -#  define compress2             z_compress2
  249.69 -#  define compressBound         z_compressBound
  249.70 -#  define uncompress            z_uncompress
  249.71 -#  define adler32               z_adler32
  249.72 -#  define crc32                 z_crc32
  249.73 -#  define get_crc_table         z_get_crc_table
  249.74 -#  define zError                z_zError
  249.75 -
  249.76 -#  define alloc_func            z_alloc_func
  249.77 -#  define free_func             z_free_func
  249.78 -#  define in_func               z_in_func
  249.79 -#  define out_func              z_out_func
  249.80 -#  define Byte                  z_Byte
  249.81 -#  define uInt                  z_uInt
  249.82 -#  define uLong                 z_uLong
  249.83 -#  define Bytef                 z_Bytef
  249.84 -#  define charf                 z_charf
  249.85 -#  define intf                  z_intf
  249.86 -#  define uIntf                 z_uIntf
  249.87 -#  define uLongf                z_uLongf
  249.88 -#  define voidpf                z_voidpf
  249.89 -#  define voidp                 z_voidp
  249.90 -#endif
  249.91 -
  249.92 -#if defined(__MSDOS__) && !defined(MSDOS)
  249.93 -#  define MSDOS
  249.94 -#endif
  249.95 -#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
  249.96 -#  define OS2
  249.97 -#endif
  249.98 -#if defined(_WINDOWS) && !defined(WINDOWS)
  249.99 -#  define WINDOWS
 249.100 -#endif
 249.101 -#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
 249.102 -#  ifndef WIN32
 249.103 -#    define WIN32
 249.104 -#  endif
 249.105 -#endif
 249.106 -#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
 249.107 -#  if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
 249.108 -#    ifndef SYS16BIT
 249.109 -#      define SYS16BIT
 249.110 -#    endif
 249.111 -#  endif
 249.112 -#endif
 249.113 -
 249.114 -/*
 249.115 - * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
 249.116 - * than 64k bytes at a time (needed on systems with 16-bit int).
 249.117 - */
 249.118 -#ifdef SYS16BIT
 249.119 -#  define MAXSEG_64K
 249.120 -#endif
 249.121 -#ifdef MSDOS
 249.122 -#  define UNALIGNED_OK
 249.123 -#endif
 249.124 -
 249.125 -#ifdef __STDC_VERSION__
 249.126 -#  ifndef STDC
 249.127 -#    define STDC
 249.128 -#  endif
 249.129 -#  if __STDC_VERSION__ >= 199901L
 249.130 -#    ifndef STDC99
 249.131 -#      define STDC99
 249.132 -#    endif
 249.133 -#  endif
 249.134 -#endif
 249.135 -#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
 249.136 -#  define STDC
 249.137 -#endif
 249.138 -#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
 249.139 -#  define STDC
 249.140 -#endif
 249.141 -#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
 249.142 -#  define STDC
 249.143 -#endif
 249.144 -#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
 249.145 -#  define STDC
 249.146 -#endif
 249.147 -
 249.148 -#if defined(__OS400__) && !defined(STDC)    /* iSeries (formerly AS/400). */
 249.149 -#  define STDC
 249.150 -#endif
 249.151 -
 249.152 -#ifndef STDC
 249.153 -#  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
 249.154 -#    define const       /* note: need a more gentle solution here */
 249.155 -#  endif
 249.156 -#endif
 249.157 -
 249.158 -/* Some Mac compilers merge all .h files incorrectly: */
 249.159 -#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
 249.160 -#  define NO_DUMMY_DECL
 249.161 -#endif
 249.162 -
 249.163 -/* Maximum value for memLevel in deflateInit2 */
 249.164 -#ifndef MAX_MEM_LEVEL
 249.165 -#  ifdef MAXSEG_64K
 249.166 -#    define MAX_MEM_LEVEL 8
 249.167 -#  else
 249.168 -#    define MAX_MEM_LEVEL 9
 249.169 -#  endif
 249.170 -#endif
 249.171 -
 249.172 -/* Maximum value for windowBits in deflateInit2 and inflateInit2.
 249.173 - * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
 249.174 - * created by gzip. (Files created by minigzip can still be extracted by
 249.175 - * gzip.)
 249.176 - */
 249.177 -#ifndef MAX_WBITS
 249.178 -#  define MAX_WBITS   15 /* 32K LZ77 window */
 249.179 -#endif
 249.180 -
 249.181 -/* The memory requirements for deflate are (in bytes):
 249.182 -            (1 << (windowBits+2)) +  (1 << (memLevel+9))
 249.183 - that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
 249.184 - plus a few kilobytes for small objects. For example, if you want to reduce
 249.185 - the default memory requirements from 256K to 128K, compile with
 249.186 -     make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
 249.187 - Of course this will generally degrade compression (there's no free lunch).
 249.188 -
 249.189 -   The memory requirements for inflate are (in bytes) 1 << windowBits
 249.190 - that is, 32K for windowBits=15 (default value) plus a few kilobytes
 249.191 - for small objects.
 249.192 -*/
 249.193 -
 249.194 -                        /* Type declarations */
 249.195 -
 249.196 -#ifndef OF /* function prototypes */
 249.197 -#  ifdef STDC
 249.198 -#    define OF(args)  args
 249.199 -#  else
 249.200 -#    define OF(args)  ()
 249.201 -#  endif
 249.202 -#endif
 249.203 -
 249.204 -/* The following definitions for FAR are needed only for MSDOS mixed
 249.205 - * model programming (small or medium model with some far allocations).
 249.206 - * This was tested only with MSC; for other MSDOS compilers you may have
 249.207 - * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
 249.208 - * just define FAR to be empty.
 249.209 - */
 249.210 -#ifdef SYS16BIT
 249.211 -#  if defined(M_I86SM) || defined(M_I86MM)
 249.212 -     /* MSC small or medium model */
 249.213 -#    define SMALL_MEDIUM
 249.214 -#    ifdef _MSC_VER
 249.215 -#      define FAR _far
 249.216 -#    else
 249.217 -#      define FAR far
 249.218 -#    endif
 249.219 -#  endif
 249.220 -#  if (defined(__SMALL__) || defined(__MEDIUM__))
 249.221 -     /* Turbo C small or medium model */
 249.222 -#    define SMALL_MEDIUM
 249.223 -#    ifdef __BORLANDC__
 249.224 -#      define FAR _far
 249.225 -#    else
 249.226 -#      define FAR far
 249.227 -#    endif
 249.228 -#  endif
 249.229 -#endif
 249.230 -
 249.231 -#if defined(WINDOWS) || defined(WIN32)
 249.232 -   /* If building or using zlib as a DLL, define ZLIB_DLL.
 249.233 -    * This is not mandatory, but it offers a little performance increase.
 249.234 -    */
 249.235 -#  ifdef ZLIB_DLL
 249.236 -#    if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
 249.237 -#      ifdef ZLIB_INTERNAL
 249.238 -#        define ZEXTERN extern __declspec(dllexport)
 249.239 -#      else
 249.240 -#        define ZEXTERN extern __declspec(dllimport)
 249.241 -#      endif
 249.242 -#    endif
 249.243 -#  endif  /* ZLIB_DLL */
 249.244 -   /* If building or using zlib with the WINAPI/WINAPIV calling convention,
 249.245 -    * define ZLIB_WINAPI.
 249.246 -    * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
 249.247 -    */
 249.248 -#  ifdef ZLIB_WINAPI
 249.249 -#    ifdef FAR
 249.250 -#      undef FAR
 249.251 -#    endif
 249.252 -#    include <windows.h>
 249.253 -     /* No need for _export, use ZLIB.DEF instead. */
 249.254 -     /* For complete Windows compatibility, use WINAPI, not __stdcall. */
 249.255 -#    define ZEXPORT WINAPI
 249.256 -#    ifdef WIN32
 249.257 -#      define ZEXPORTVA WINAPIV
 249.258 -#    else
 249.259 -#      define ZEXPORTVA FAR CDECL
 249.260 -#    endif
 249.261 -#  endif
 249.262 -#endif
 249.263 -
 249.264 -#if defined (__BEOS__)
 249.265 -#  ifdef ZLIB_DLL
 249.266 -#    ifdef ZLIB_INTERNAL
 249.267 -#      define ZEXPORT   __declspec(dllexport)
 249.268 -#      define ZEXPORTVA __declspec(dllexport)
 249.269 -#    else
 249.270 -#      define ZEXPORT   __declspec(dllimport)
 249.271 -#      define ZEXPORTVA __declspec(dllimport)
 249.272 -#    endif
 249.273 -#  endif
 249.274 -#endif
 249.275 -
 249.276 -#ifndef ZEXTERN
 249.277 -#  define ZEXTERN extern
 249.278 -#endif
 249.279 -#ifndef ZEXPORT
 249.280 -#  define ZEXPORT
 249.281 -#endif
 249.282 -#ifndef ZEXPORTVA
 249.283 -#  define ZEXPORTVA
 249.284 -#endif
 249.285 -
 249.286 -#ifndef FAR
 249.287 -#  define FAR
 249.288 -#endif
 249.289 -
 249.290 -#if !defined(__MACTYPES__)
 249.291 -typedef unsigned char  Byte;  /* 8 bits */
 249.292 -#endif
 249.293 -typedef unsigned int   uInt;  /* 16 bits or more */
 249.294 -#ifdef _LP64
 249.295 -typedef unsigned int  uLong;  /* 32 bits or more */
 249.296 -#else
 249.297 -typedef unsigned long  uLong; /* 32 bits or more */
 249.298 -#endif
 249.299 -
 249.300 -#ifdef SMALL_MEDIUM
 249.301 -   /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
 249.302 -#  define Bytef Byte FAR
 249.303 -#else
 249.304 -   typedef Byte  FAR Bytef;
 249.305 -#endif
 249.306 -typedef char  FAR charf;
 249.307 -typedef int   FAR intf;
 249.308 -typedef uInt  FAR uIntf;
 249.309 -typedef uLong FAR uLongf;
 249.310 -
 249.311 -#ifdef STDC
 249.312 -   typedef void const *voidpc;
 249.313 -   typedef void FAR   *voidpf;
 249.314 -   typedef void       *voidp;
 249.315 -#else
 249.316 -   typedef Byte const *voidpc;
 249.317 -   typedef Byte FAR   *voidpf;
 249.318 -   typedef Byte       *voidp;
 249.319 -#endif
 249.320 -
 249.321 -#if 0           /* HAVE_UNISTD_H -- this line is updated by ./configure */
 249.322 -#  include <sys/types.h> /* for off_t */
 249.323 -#  include <unistd.h>    /* for SEEK_* and off_t */
 249.324 -#  ifdef VMS
 249.325 -#    include <unixio.h>   /* for off_t */
 249.326 -#  endif
 249.327 -#  define z_off_t off_t
 249.328 -#endif
 249.329 -#ifndef SEEK_SET
 249.330 -#  define SEEK_SET        0       /* Seek from beginning of file.  */
 249.331 -#  define SEEK_CUR        1       /* Seek from current position.  */
 249.332 -#  define SEEK_END        2       /* Set file pointer to EOF plus "offset" */
 249.333 -#endif
 249.334 -#ifndef z_off_t
 249.335 -#  define z_off_t long
 249.336 -#endif
 249.337 -
 249.338 -#if defined(__OS400__)
 249.339 -#  define NO_vsnprintf
 249.340 -#endif
 249.341 -
 249.342 -#if defined(__MVS__)
 249.343 -#  define NO_vsnprintf
 249.344 -#  ifdef FAR
 249.345 -#    undef FAR
 249.346 -#  endif
 249.347 -#endif
 249.348 -
 249.349 -/* MVS linker does not support external names larger than 8 bytes */
 249.350 -#if defined(__MVS__)
 249.351 -#   pragma map(deflateInit_,"DEIN")
 249.352 -#   pragma map(deflateInit2_,"DEIN2")
 249.353 -#   pragma map(deflateEnd,"DEEND")
 249.354 -#   pragma map(deflateBound,"DEBND")
 249.355 -#   pragma map(inflateInit_,"ININ")
 249.356 -#   pragma map(inflateInit2_,"ININ2")
 249.357 -#   pragma map(inflateEnd,"INEND")
 249.358 -#   pragma map(inflateSync,"INSY")
 249.359 -#   pragma map(inflateSetDictionary,"INSEDI")
 249.360 -#   pragma map(compressBound,"CMBND")
 249.361 -#   pragma map(inflate_table,"INTABL")
 249.362 -#   pragma map(inflate_fast,"INFA")
 249.363 -#   pragma map(inflate_copyright,"INCOPY")
 249.364 -#endif
 249.365 -
 249.366 -#endif /* ZCONF_H */
   250.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/zcrc32.c	Tue Dec 06 16:31:58 2011 -0800
   250.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   250.3 @@ -1,447 +0,0 @@
   250.4 -/*
   250.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   250.6 - *
   250.7 - * This code is free software; you can redistribute it and/or modify it
   250.8 - * under the terms of the GNU General Public License version 2 only, as
   250.9 - * published by the Free Software Foundation.  Oracle designates this
  250.10 - * particular file as subject to the "Classpath" exception as provided
  250.11 - * by Oracle in the LICENSE file that accompanied this code.
  250.12 - *
  250.13 - * This code is distributed in the hope that it will be useful, but WITHOUT
  250.14 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  250.15 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  250.16 - * version 2 for more details (a copy is included in the LICENSE file that
  250.17 - * accompanied this code).
  250.18 - *
  250.19 - * You should have received a copy of the GNU General Public License version
  250.20 - * 2 along with this work; if not, write to the Free Software Foundation,
  250.21 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  250.22 - *
  250.23 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  250.24 - * or visit www.oracle.com if you need additional information or have any
  250.25 - * questions.
  250.26 - */
  250.27 -
  250.28 -/* crc32.c -- compute the CRC-32 of a data stream
  250.29 - * Copyright (C) 1995-2005 Mark Adler
  250.30 - * For conditions of distribution and use, see copyright notice in zlib.h
  250.31 - *
  250.32 - * Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster
  250.33 - * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing
  250.34 - * tables for updating the shift register in one step with three exclusive-ors
  250.35 - * instead of four steps with four exclusive-ors.  This results in about a
  250.36 - * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3.
  250.37 - */
  250.38 -
  250.39 -/* @(#) $Id$ */
  250.40 -
  250.41 -/*
  250.42 -  Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore
  250.43 -  protection on the static variables used to control the first-use generation
  250.44 -  of the crc tables.  Therefore, if you #define DYNAMIC_CRC_TABLE, you should
  250.45 -  first call get_crc_table() to initialize the tables before allowing more than
  250.46 -  one thread to use crc32().
  250.47 - */
  250.48 -
  250.49 -#ifdef MAKECRCH
  250.50 -#  include <stdio.h>
  250.51 -#  ifndef DYNAMIC_CRC_TABLE
  250.52 -#    define DYNAMIC_CRC_TABLE
  250.53 -#  endif /* !DYNAMIC_CRC_TABLE */
  250.54 -#endif /* MAKECRCH */
  250.55 -
  250.56 -#include "zutil.h"      /* for STDC and FAR definitions */
  250.57 -
  250.58 -#define local static
  250.59 -
  250.60 -/* Find a four-byte integer type for crc32_little() and crc32_big(). */
  250.61 -#ifndef NOBYFOUR
  250.62 -#  ifdef STDC           /* need ANSI C limits.h to determine sizes */
  250.63 -#    include <limits.h>
  250.64 -#    define BYFOUR
  250.65 -#    if (UINT_MAX == 0xffffffffUL)
  250.66 -       typedef unsigned int u4;
  250.67 -#    else
  250.68 -#      if (ULONG_MAX == 0xffffffffUL)
  250.69 -         typedef unsigned long u4;
  250.70 -#      else
  250.71 -#        if (USHRT_MAX == 0xffffffffUL)
  250.72 -           typedef unsigned short u4;
  250.73 -#        else
  250.74 -#          undef BYFOUR     /* can't find a four-byte integer type! */
  250.75 -#        endif
  250.76 -#      endif
  250.77 -#    endif
  250.78 -#  endif /* STDC */
  250.79 -#endif /* !NOBYFOUR */
  250.80 -
  250.81 -/* Definitions for doing the crc four data bytes at a time. */
  250.82 -#ifdef BYFOUR
  250.83 -#  define REV(w) (((w)>>24)+(((w)>>8)&0xff00)+ \
  250.84 -                (((w)&0xff00)<<8)+(((w)&0xff)<<24))
  250.85 -   local unsigned long crc32_little OF((unsigned long,
  250.86 -                        const unsigned char FAR *, unsigned));
  250.87 -   local unsigned long crc32_big OF((unsigned long,
  250.88 -                        const unsigned char FAR *, unsigned));
  250.89 -#  define TBLS 8
  250.90 -#else
  250.91 -#  define TBLS 1
  250.92 -#endif /* BYFOUR */
  250.93 -
  250.94 -/* Local functions for crc concatenation */
  250.95 -local unsigned long gf2_matrix_times OF((unsigned long *mat,
  250.96 -                                         unsigned long vec));
  250.97 -local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat));
  250.98 -
  250.99 -#ifdef DYNAMIC_CRC_TABLE
 250.100 -
 250.101 -local volatile int crc_table_empty = 1;
 250.102 -local unsigned long FAR crc_table[TBLS][256];
 250.103 -local void make_crc_table OF((void));
 250.104 -#ifdef MAKECRCH
 250.105 -   local void write_table OF((FILE *, const unsigned long FAR *));
 250.106 -#endif /* MAKECRCH */
 250.107 -/*
 250.108 -  Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
 250.109 -  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.
 250.110 -
 250.111 -  Polynomials over GF(2) are represented in binary, one bit per coefficient,
 250.112 -  with the lowest powers in the most significant bit.  Then adding polynomials
 250.113 -  is just exclusive-or, and multiplying a polynomial by x is a right shift by
 250.114 -  one.  If we call the above polynomial p, and represent a byte as the
 250.115 -  polynomial q, also with the lowest power in the most significant bit (so the
 250.116 -  byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p,
 250.117 -  where a mod b means the remainder after dividing a by b.
 250.118 -
 250.119 -  This calculation is done using the shift-register method of multiplying and
 250.120 -  taking the remainder.  The register is initialized to zero, and for each
 250.121 -  incoming bit, x^32 is added mod p to the register if the bit is a one (where
 250.122 -  x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by
 250.123 -  x (which is shifting right by one and adding x^32 mod p if the bit shifted
 250.124 -  out is a one).  We start with the highest power (least significant bit) of
 250.125 -  q and repeat for all eight bits of q.
 250.126 -
 250.127 -  The first table is simply the CRC of all possible eight bit values.  This is
 250.128 -  all the information needed to generate CRCs on data a byte at a time for all
 250.129 -  combinations of CRC register values and incoming bytes.  The remaining tables
 250.130 -  allow for word-at-a-time CRC calculation for both big-endian and little-
 250.131 -  endian machines, where a word is four bytes.
 250.132 -*/
 250.133 -local void make_crc_table()
 250.134 -{
 250.135 -    unsigned long c;
 250.136 -    int n, k;
 250.137 -    unsigned long poly;                 /* polynomial exclusive-or pattern */
 250.138 -    /* terms of polynomial defining this crc (except x^32): */
 250.139 -    static volatile int first = 1;      /* flag to limit concurrent making */
 250.140 -    static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
 250.141 -
 250.142 -    /* See if another task is already doing this (not thread-safe, but better
 250.143 -       than nothing -- significantly reduces duration of vulnerability in
 250.144 -       case the advice about DYNAMIC_CRC_TABLE is ignored) */
 250.145 -    if (first) {
 250.146 -        first = 0;
 250.147 -
 250.148 -        /* make exclusive-or pattern from polynomial (0xedb88320UL) */
 250.149 -        poly = 0UL;
 250.150 -        for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++)
 250.151 -            poly |= 1UL << (31 - p[n]);
 250.152 -
 250.153 -        /* generate a crc for every 8-bit value */
 250.154 -        for (n = 0; n < 256; n++) {
 250.155 -            c = (unsigned long)n;
 250.156 -            for (k = 0; k < 8; k++)
 250.157 -                c = c & 1 ? poly ^ (c >> 1) : c >> 1;
 250.158 -            crc_table[0][n] = c;
 250.159 -        }
 250.160 -
 250.161 -#ifdef BYFOUR
 250.162 -        /* generate crc for each value followed by one, two, and three zeros,
 250.163 -           and then the byte reversal of those as well as the first table */
 250.164 -        for (n = 0; n < 256; n++) {
 250.165 -            c = crc_table[0][n];
 250.166 -            crc_table[4][n] = REV(c);
 250.167 -            for (k = 1; k < 4; k++) {
 250.168 -                c = crc_table[0][c & 0xff] ^ (c >> 8);
 250.169 -                crc_table[k][n] = c;
 250.170 -                crc_table[k + 4][n] = REV(c);
 250.171 -            }
 250.172 -        }
 250.173 -#endif /* BYFOUR */
 250.174 -
 250.175 -        crc_table_empty = 0;
 250.176 -    }
 250.177 -    else {      /* not first */
 250.178 -        /* wait for the other guy to finish (not efficient, but rare) */
 250.179 -        while (crc_table_empty)
 250.180 -            ;
 250.181 -    }
 250.182 -
 250.183 -#ifdef MAKECRCH
 250.184 -    /* write out CRC tables to crc32.h */
 250.185 -    {
 250.186 -        FILE *out;
 250.187 -
 250.188 -        out = fopen("crc32.h", "w");
 250.189 -        if (out == NULL) return;
 250.190 -        fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n");
 250.191 -        fprintf(out, " * Generated automatically by crc32.c\n */\n\n");
 250.192 -        fprintf(out, "local const unsigned long FAR ");
 250.193 -        fprintf(out, "crc_table[TBLS][256] =\n{\n  {\n");
 250.194 -        write_table(out, crc_table[0]);
 250.195 -#  ifdef BYFOUR
 250.196 -        fprintf(out, "#ifdef BYFOUR\n");
 250.197 -        for (k = 1; k < 8; k++) {
 250.198 -            fprintf(out, "  },\n  {\n");
 250.199 -            write_table(out, crc_table[k]);
 250.200 -        }
 250.201 -        fprintf(out, "#endif\n");
 250.202 -#  endif /* BYFOUR */
 250.203 -        fprintf(out, "  }\n};\n");
 250.204 -        fclose(out);
 250.205 -    }
 250.206 -#endif /* MAKECRCH */
 250.207 -}
 250.208 -
 250.209 -#ifdef MAKECRCH
 250.210 -local void write_table(out, table)
 250.211 -    FILE *out;
 250.212 -    const unsigned long FAR *table;
 250.213 -{
 250.214 -    int n;
 250.215 -
 250.216 -    for (n = 0; n < 256; n++)
 250.217 -        fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : "    ", table[n],
 250.218 -                n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", "));
 250.219 -}
 250.220 -#endif /* MAKECRCH */
 250.221 -
 250.222 -#else /* !DYNAMIC_CRC_TABLE */
 250.223 -/* ========================================================================
 250.224 - * Tables of CRC-32s of all single-byte values, made by make_crc_table().
 250.225 - */
 250.226 -#include "crc32.h"
 250.227 -#endif /* DYNAMIC_CRC_TABLE */
 250.228 -
 250.229 -/* =========================================================================
 250.230 - * This function can be used by asm versions of crc32()
 250.231 - */
 250.232 -const unsigned long FAR * ZEXPORT get_crc_table()
 250.233 -{
 250.234 -#ifdef DYNAMIC_CRC_TABLE
 250.235 -    if (crc_table_empty)
 250.236 -        make_crc_table();
 250.237 -#endif /* DYNAMIC_CRC_TABLE */
 250.238 -    return (const unsigned long FAR *)crc_table;
 250.239 -}
 250.240 -
 250.241 -/* ========================================================================= */
 250.242 -#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8)
 250.243 -#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1
 250.244 -
 250.245 -/* ========================================================================= */
 250.246 -uLong ZEXPORT crc32(crc, buf, len)
 250.247 -    uLong crc;
 250.248 -    const unsigned char FAR *buf;
 250.249 -    unsigned len;
 250.250 -{
 250.251 -    if (buf == Z_NULL) return 0UL;
 250.252 -
 250.253 -#ifdef DYNAMIC_CRC_TABLE
 250.254 -    if (crc_table_empty)
 250.255 -        make_crc_table();
 250.256 -#endif /* DYNAMIC_CRC_TABLE */
 250.257 -
 250.258 -#ifdef BYFOUR
 250.259 -    if (sizeof(void *) == sizeof(ptrdiff_t)) {
 250.260 -        u4 endian;
 250.261 -
 250.262 -        endian = 1;
 250.263 -        if (*((unsigned char *)(&endian)))
 250.264 -            return (uLong)crc32_little(crc, buf, len);
 250.265 -        else
 250.266 -            return (uLong)crc32_big(crc, buf, len);
 250.267 -    }
 250.268 -#endif /* BYFOUR */
 250.269 -    crc = crc ^ 0xffffffffUL;
 250.270 -    while (len >= 8) {
 250.271 -        DO8;
 250.272 -        len -= 8;
 250.273 -    }
 250.274 -    if (len) do {
 250.275 -        DO1;
 250.276 -    } while (--len);
 250.277 -    return crc ^ 0xffffffffUL;
 250.278 -}
 250.279 -
 250.280 -#ifdef BYFOUR
 250.281 -
 250.282 -/* ========================================================================= */
 250.283 -#define DOLIT4 c ^= *buf4++; \
 250.284 -        c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \
 250.285 -            crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24]
 250.286 -#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4
 250.287 -
 250.288 -/* ========================================================================= */
 250.289 -local unsigned long crc32_little(crc, buf, len)
 250.290 -    unsigned long crc;
 250.291 -    const unsigned char FAR *buf;
 250.292 -    unsigned len;
 250.293 -{
 250.294 -    register u4 c;
 250.295 -    register const u4 FAR *buf4;
 250.296 -
 250.297 -    c = (u4)crc;
 250.298 -    c = ~c;
 250.299 -    while (len && ((ptrdiff_t)buf & 3)) {
 250.300 -        c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
 250.301 -        len--;
 250.302 -    }
 250.303 -
 250.304 -    buf4 = (const u4 FAR *)(const void FAR *)buf;
 250.305 -    while (len >= 32) {
 250.306 -        DOLIT32;
 250.307 -        len -= 32;
 250.308 -    }
 250.309 -    while (len >= 4) {
 250.310 -        DOLIT4;
 250.311 -        len -= 4;
 250.312 -    }
 250.313 -    buf = (const unsigned char FAR *)buf4;
 250.314 -
 250.315 -    if (len) do {
 250.316 -        c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
 250.317 -    } while (--len);
 250.318 -    c = ~c;
 250.319 -    return (unsigned long)c;
 250.320 -}
 250.321 -
 250.322 -/* ========================================================================= */
 250.323 -#define DOBIG4 c ^= *++buf4; \
 250.324 -        c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \
 250.325 -            crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24]
 250.326 -#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4
 250.327 -
 250.328 -/* ========================================================================= */
 250.329 -local unsigned long crc32_big(crc, buf, len)
 250.330 -    unsigned long crc;
 250.331 -    const unsigned char FAR *buf;
 250.332 -    unsigned len;
 250.333 -{
 250.334 -    register u4 c;
 250.335 -    register const u4 FAR *buf4;
 250.336 -
 250.337 -    c = REV((u4)crc);
 250.338 -    c = ~c;
 250.339 -    while (len && ((ptrdiff_t)buf & 3)) {
 250.340 -        c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
 250.341 -        len--;
 250.342 -    }
 250.343 -
 250.344 -    buf4 = (const u4 FAR *)(const void FAR *)buf;
 250.345 -    buf4--;
 250.346 -    while (len >= 32) {
 250.347 -        DOBIG32;
 250.348 -        len -= 32;
 250.349 -    }
 250.350 -    while (len >= 4) {
 250.351 -        DOBIG4;
 250.352 -        len -= 4;
 250.353 -    }
 250.354 -    buf4++;
 250.355 -    buf = (const unsigned char FAR *)buf4;
 250.356 -
 250.357 -    if (len) do {
 250.358 -        c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
 250.359 -    } while (--len);
 250.360 -    c = ~c;
 250.361 -    return (unsigned long)(REV(c));
 250.362 -}
 250.363 -
 250.364 -#endif /* BYFOUR */
 250.365 -
 250.366 -#define GF2_DIM 32      /* dimension of GF(2) vectors (length of CRC) */
 250.367 -
 250.368 -/* ========================================================================= */
 250.369 -local unsigned long gf2_matrix_times(mat, vec)
 250.370 -    unsigned long *mat;
 250.371 -    unsigned long vec;
 250.372 -{
 250.373 -    unsigned long sum;
 250.374 -
 250.375 -    sum = 0;
 250.376 -    while (vec) {
 250.377 -        if (vec & 1)
 250.378 -            sum ^= *mat;
 250.379 -        vec >>= 1;
 250.380 -        mat++;
 250.381 -    }
 250.382 -    return sum;
 250.383 -}
 250.384 -
 250.385 -/* ========================================================================= */
 250.386 -local void gf2_matrix_square(square, mat)
 250.387 -    unsigned long *square;
 250.388 -    unsigned long *mat;
 250.389 -{
 250.390 -    int n;
 250.391 -
 250.392 -    for (n = 0; n < GF2_DIM; n++)
 250.393 -        square[n] = gf2_matrix_times(mat, mat[n]);
 250.394 -}
 250.395 -
 250.396 -/* ========================================================================= */
 250.397 -uLong ZEXPORT crc32_combine(crc1, crc2, len2)
 250.398 -    uLong crc1;
 250.399 -    uLong crc2;
 250.400 -    z_off_t len2;
 250.401 -{
 250.402 -    int n;
 250.403 -    unsigned long row;
 250.404 -    unsigned long even[GF2_DIM];    /* even-power-of-two zeros operator */
 250.405 -    unsigned long odd[GF2_DIM];     /* odd-power-of-two zeros operator */
 250.406 -
 250.407 -    /* degenerate case */
 250.408 -    if (len2 == 0)
 250.409 -        return crc1;
 250.410 -
 250.411 -    /* put operator for one zero bit in odd */
 250.412 -    odd[0] = 0xedb88320UL;           /* CRC-32 polynomial */
 250.413 -    row = 1;
 250.414 -    for (n = 1; n < GF2_DIM; n++) {
 250.415 -        odd[n] = row;
 250.416 -        row <<= 1;
 250.417 -    }
 250.418 -
 250.419 -    /* put operator for two zero bits in even */
 250.420 -    gf2_matrix_square(even, odd);
 250.421 -
 250.422 -    /* put operator for four zero bits in odd */
 250.423 -    gf2_matrix_square(odd, even);
 250.424 -
 250.425 -    /* apply len2 zeros to crc1 (first square will put the operator for one
 250.426 -       zero byte, eight zero bits, in even) */
 250.427 -    do {
 250.428 -        /* apply zeros operator for this bit of len2 */
 250.429 -        gf2_matrix_square(even, odd);
 250.430 -        if (len2 & 1)
 250.431 -            crc1 = gf2_matrix_times(even, crc1);
 250.432 -        len2 >>= 1;
 250.433 -
 250.434 -        /* if no more bits set, then done */
 250.435 -        if (len2 == 0)
 250.436 -            break;
 250.437 -
 250.438 -        /* another iteration of the loop with odd and even swapped */
 250.439 -        gf2_matrix_square(odd, even);
 250.440 -        if (len2 & 1)
 250.441 -            crc1 = gf2_matrix_times(odd, crc1);
 250.442 -        len2 >>= 1;
 250.443 -
 250.444 -        /* if no more bits set, then done */
 250.445 -    } while (len2 != 0);
 250.446 -
 250.447 -    /* return combined crc */
 250.448 -    crc1 ^= crc2;
 250.449 -    return crc1;
 250.450 -}
   251.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/zlib.h	Tue Dec 06 16:31:58 2011 -0800
   251.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   251.3 @@ -1,1381 +0,0 @@
   251.4 -/*
   251.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   251.6 - *
   251.7 - * This code is free software; you can redistribute it and/or modify it
   251.8 - * under the terms of the GNU General Public License version 2 only, as
   251.9 - * published by the Free Software Foundation.  Oracle designates this
  251.10 - * particular file as subject to the "Classpath" exception as provided
  251.11 - * by Oracle in the LICENSE file that accompanied this code.
  251.12 - *
  251.13 - * This code is distributed in the hope that it will be useful, but WITHOUT
  251.14 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  251.15 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  251.16 - * version 2 for more details (a copy is included in the LICENSE file that
  251.17 - * accompanied this code).
  251.18 - *
  251.19 - * You should have received a copy of the GNU General Public License version
  251.20 - * 2 along with this work; if not, write to the Free Software Foundation,
  251.21 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  251.22 - *
  251.23 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  251.24 - * or visit www.oracle.com if you need additional information or have any
  251.25 - * questions.
  251.26 - */
  251.27 -
  251.28 -/* zlib.h -- interface of the 'zlib' general purpose compression library
  251.29 -  version 1.2.3, July 18th, 2005
  251.30 -
  251.31 -  Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler
  251.32 -
  251.33 -  This software is provided 'as-is', without any express or implied
  251.34 -  warranty.  In no event will the authors be held liable for any damages
  251.35 -  arising from the use of this software.
  251.36 -
  251.37 -  Permission is granted to anyone to use this software for any purpose,
  251.38 -  including commercial applications, and to alter it and redistribute it
  251.39 -  freely, subject to the following restrictions:
  251.40 -
  251.41 -  1. The origin of this software must not be misrepresented; you must not
  251.42 -     claim that you wrote the original software. If you use this software
  251.43 -     in a product, an acknowledgment in the product documentation would be
  251.44 -     appreciated but is not required.
  251.45 -  2. Altered source versions must be plainly marked as such, and must not be
  251.46 -     misrepresented as being the original software.
  251.47 -  3. This notice may not be removed or altered from any source distribution.
  251.48 -
  251.49 -  Jean-loup Gailly        Mark Adler
  251.50 -  jloup@gzip.org          madler@alumni.caltech.edu
  251.51 -
  251.52 -
  251.53 -  The data format used by the zlib library is described by RFCs (Request for
  251.54 -  Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt
  251.55 -  (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
  251.56 -*/
  251.57 -
  251.58 -#ifndef ZLIB_H
  251.59 -#define ZLIB_H
  251.60 -
  251.61 -#include "zconf.h"
  251.62 -
  251.63 -#ifdef __cplusplus
  251.64 -extern "C" {
  251.65 -#endif
  251.66 -
  251.67 -#define ZLIB_VERSION "1.2.3"
  251.68 -#define ZLIB_VERNUM 0x1230
  251.69 -
  251.70 -/*
  251.71 -     The 'zlib' compression library provides in-memory compression and
  251.72 -  decompression functions, including integrity checks of the uncompressed
  251.73 -  data.  This version of the library supports only one compression method
  251.74 -  (deflation) but other algorithms will be added later and will have the same
  251.75 -  stream interface.
  251.76 -
  251.77 -     Compression can be done in a single step if the buffers are large
  251.78 -  enough (for example if an input file is mmap'ed), or can be done by
  251.79 -  repeated calls of the compression function.  In the latter case, the
  251.80 -  application must provide more input and/or consume the output
  251.81 -  (providing more output space) before each call.
  251.82 -
  251.83 -     The compressed data format used by default by the in-memory functions is
  251.84 -  the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
  251.85 -  around a deflate stream, which is itself documented in RFC 1951.
  251.86 -
  251.87 -     The library also supports reading and writing files in gzip (.gz) format
  251.88 -  with an interface similar to that of stdio using the functions that start
  251.89 -  with "gz".  The gzip format is different from the zlib format.  gzip is a
  251.90 -  gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
  251.91 -
  251.92 -     This library can optionally read and write gzip streams in memory as well.
  251.93 -
  251.94 -     The zlib format was designed to be compact and fast for use in memory
  251.95 -  and on communications channels.  The gzip format was designed for single-
  251.96 -  file compression on file systems, has a larger header than zlib to maintain
  251.97 -  directory information, and uses a different, slower check method than zlib.
  251.98 -
  251.99 -     The library does not install any signal handler. The decoder checks
 251.100 -  the consistency of the compressed data, so the library should never
 251.101 -  crash even in case of corrupted input.
 251.102 -*/
 251.103 -
 251.104 -typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
 251.105 -typedef void   (*free_func)  OF((voidpf opaque, voidpf address));
 251.106 -
 251.107 -struct internal_state;
 251.108 -
 251.109 -typedef struct z_stream_s {
 251.110 -    Bytef    *next_in;  /* next input byte */
 251.111 -    uInt     avail_in;  /* number of bytes available at next_in */
 251.112 -    long long total_in; /* total nb of input bytes read so far */
 251.113 -
 251.114 -    Bytef    *next_out; /* next output byte should be put there */
 251.115 -    uInt     avail_out; /* remaining free space at next_out */
 251.116 -    long long total_out;/* total nb of bytes output so far */
 251.117 -
 251.118 -    char     *msg;      /* last error message, NULL if no error */
 251.119 -    struct internal_state FAR *state; /* not visible by applications */
 251.120 -
 251.121 -    alloc_func zalloc;  /* used to allocate the internal state */
 251.122 -    free_func  zfree;   /* used to free the internal state */
 251.123 -    voidpf     opaque;  /* private data object passed to zalloc and zfree */
 251.124 -
 251.125 -    int     data_type;  /* best guess about the data type: binary or text */
 251.126 -    uLong   adler;      /* adler32 value of the uncompressed data */
 251.127 -    uLong   reserved;   /* reserved for future use */
 251.128 -} z_stream;
 251.129 -
 251.130 -typedef z_stream FAR *z_streamp;
 251.131 -
 251.132 -/*
 251.133 -     gzip header information passed to and from zlib routines.  See RFC 1952
 251.134 -  for more details on the meanings of these fields.
 251.135 -*/
 251.136 -typedef struct gz_header_s {
 251.137 -    int     text;       /* true if compressed data believed to be text */
 251.138 -    uLong   time;       /* modification time */
 251.139 -    int     xflags;     /* extra flags (not used when writing a gzip file) */
 251.140 -    int     os;         /* operating system */
 251.141 -    Bytef   *extra;     /* pointer to extra field or Z_NULL if none */
 251.142 -    uInt    extra_len;  /* extra field length (valid if extra != Z_NULL) */
 251.143 -    uInt    extra_max;  /* space at extra (only when reading header) */
 251.144 -    Bytef   *name;      /* pointer to zero-terminated file name or Z_NULL */
 251.145 -    uInt    name_max;   /* space at name (only when reading header) */
 251.146 -    Bytef   *comment;   /* pointer to zero-terminated comment or Z_NULL */
 251.147 -    uInt    comm_max;   /* space at comment (only when reading header) */
 251.148 -    int     hcrc;       /* true if there was or will be a header crc */
 251.149 -    int     done;       /* true when done reading gzip header (not used
 251.150 -                           when writing a gzip file) */
 251.151 -} gz_header;
 251.152 -
 251.153 -typedef gz_header FAR *gz_headerp;
 251.154 -
 251.155 -/*
 251.156 -   The application must update next_in and avail_in when avail_in has
 251.157 -   dropped to zero. It must update next_out and avail_out when avail_out
 251.158 -   has dropped to zero. The application must initialize zalloc, zfree and
 251.159 -   opaque before calling the init function. All other fields are set by the
 251.160 -   compression library and must not be updated by the application.
 251.161 -
 251.162 -   The opaque value provided by the application will be passed as the first
 251.163 -   parameter for calls of zalloc and zfree. This can be useful for custom
 251.164 -   memory management. The compression library attaches no meaning to the
 251.165 -   opaque value.
 251.166 -
 251.167 -   zalloc must return Z_NULL if there is not enough memory for the object.
 251.168 -   If zlib is used in a multi-threaded application, zalloc and zfree must be
 251.169 -   thread safe.
 251.170 -
 251.171 -   On 16-bit systems, the functions zalloc and zfree must be able to allocate
 251.172 -   exactly 65536 bytes, but will not be required to allocate more than this
 251.173 -   if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
 251.174 -   pointers returned by zalloc for objects of exactly 65536 bytes *must*
 251.175 -   have their offset normalized to zero. The default allocation function
 251.176 -   provided by this library ensures this (see zutil.c). To reduce memory
 251.177 -   requirements and avoid any allocation of 64K objects, at the expense of
 251.178 -   compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
 251.179 -
 251.180 -   The fields total_in and total_out can be used for statistics or
 251.181 -   progress reports. After compression, total_in holds the total size of
 251.182 -   the uncompressed data and may be saved for use in the decompressor
 251.183 -   (particularly if the decompressor wants to decompress everything in
 251.184 -   a single step).
 251.185 -*/
 251.186 -
 251.187 -                        /* constants */
 251.188 -
 251.189 -#define Z_NO_FLUSH      0
 251.190 -#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */
 251.191 -#define Z_SYNC_FLUSH    2
 251.192 -#define Z_FULL_FLUSH    3
 251.193 -#define Z_FINISH        4
 251.194 -#define Z_BLOCK         5
 251.195 -/* Allowed flush values; see deflate() and inflate() below for details */
 251.196 -
 251.197 -#define Z_OK            0
 251.198 -#define Z_STREAM_END    1
 251.199 -#define Z_NEED_DICT     2
 251.200 -#define Z_ERRNO        (-1)
 251.201 -#define Z_STREAM_ERROR (-2)
 251.202 -#define Z_DATA_ERROR   (-3)
 251.203 -#define Z_MEM_ERROR    (-4)
 251.204 -#define Z_BUF_ERROR    (-5)
 251.205 -#define Z_VERSION_ERROR (-6)
 251.206 -/* Return codes for the compression/decompression functions. Negative
 251.207 - * values are errors, positive values are used for special but normal events.
 251.208 - */
 251.209 -
 251.210 -#define Z_NO_COMPRESSION         0
 251.211 -#define Z_BEST_SPEED             1
 251.212 -#define Z_BEST_COMPRESSION       9
 251.213 -#define Z_DEFAULT_COMPRESSION  (-1)
 251.214 -/* compression levels */
 251.215 -
 251.216 -#define Z_FILTERED            1
 251.217 -#define Z_HUFFMAN_ONLY        2
 251.218 -#define Z_RLE                 3
 251.219 -#define Z_FIXED               4
 251.220 -#define Z_DEFAULT_STRATEGY    0
 251.221 -/* compression strategy; see deflateInit2() below for details */
 251.222 -
 251.223 -#define Z_BINARY   0
 251.224 -#define Z_TEXT     1
 251.225 -#define Z_ASCII    Z_TEXT   /* for compatibility with 1.2.2 and earlier */
 251.226 -#define Z_UNKNOWN  2
 251.227 -/* Possible values of the data_type field (though see inflate()) */
 251.228 -
 251.229 -#define Z_DEFLATED   8
 251.230 -/* The deflate compression method (the only one supported in this version) */
 251.231 -
 251.232 -#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
 251.233 -
 251.234 -#define zlib_version zlibVersion()
 251.235 -/* for compatibility with versions < 1.0.2 */
 251.236 -
 251.237 -                        /* basic functions */
 251.238 -
 251.239 -ZEXTERN const char * ZEXPORT zlibVersion OF((void));
 251.240 -/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
 251.241 -   If the first character differs, the library code actually used is
 251.242 -   not compatible with the zlib.h header file used by the application.
 251.243 -   This check is automatically made by deflateInit and inflateInit.
 251.244 - */
 251.245 -
 251.246 -/*
 251.247 -ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
 251.248 -
 251.249 -     Initializes the internal stream state for compression. The fields
 251.250 -   zalloc, zfree and opaque must be initialized before by the caller.
 251.251 -   If zalloc and zfree are set to Z_NULL, deflateInit updates them to
 251.252 -   use default allocation functions.
 251.253 -
 251.254 -     The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
 251.255 -   1 gives best speed, 9 gives best compression, 0 gives no compression at
 251.256 -   all (the input data is simply copied a block at a time).
 251.257 -   Z_DEFAULT_COMPRESSION requests a default compromise between speed and
 251.258 -   compression (currently equivalent to level 6).
 251.259 -
 251.260 -     deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
 251.261 -   enough memory, Z_STREAM_ERROR if level is not a valid compression level,
 251.262 -   Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
 251.263 -   with the version assumed by the caller (ZLIB_VERSION).
 251.264 -   msg is set to null if there is no error message.  deflateInit does not
 251.265 -   perform any compression: this will be done by deflate().
 251.266 -*/
 251.267 -
 251.268 -
 251.269 -ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
 251.270 -/*
 251.271 -    deflate compresses as much data as possible, and stops when the input
 251.272 -  buffer becomes empty or the output buffer becomes full. It may introduce some
 251.273 -  output latency (reading input without producing any output) except when
 251.274 -  forced to flush.
 251.275 -
 251.276 -    The detailed semantics are as follows. deflate performs one or both of the
 251.277 -  following actions:
 251.278 -
 251.279 -  - Compress more input starting at next_in and update next_in and avail_in
 251.280 -    accordingly. If not all input can be processed (because there is not
 251.281 -    enough room in the output buffer), next_in and avail_in are updated and
 251.282 -    processing will resume at this point for the next call of deflate().
 251.283 -
 251.284 -  - Provide more output starting at next_out and update next_out and avail_out
 251.285 -    accordingly. This action is forced if the parameter flush is non zero.
 251.286 -    Forcing flush frequently degrades the compression ratio, so this parameter
 251.287 -    should be set only when necessary (in interactive applications).
 251.288 -    Some output may be provided even if flush is not set.
 251.289 -
 251.290 -  Before the call of deflate(), the application should ensure that at least
 251.291 -  one of the actions is possible, by providing more input and/or consuming
 251.292 -  more output, and updating avail_in or avail_out accordingly; avail_out
 251.293 -  should never be zero before the call. The application can consume the
 251.294 -  compressed output when it wants, for example when the output buffer is full
 251.295 -  (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
 251.296 -  and with zero avail_out, it must be called again after making room in the
 251.297 -  output buffer because there might be more output pending.
 251.298 -
 251.299 -    Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
 251.300 -  decide how much data to accumualte before producing output, in order to
 251.301 -  maximize compression.
 251.302 -
 251.303 -    If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
 251.304 -  flushed to the output buffer and the output is aligned on a byte boundary, so
 251.305 -  that the decompressor can get all input data available so far. (In particular
 251.306 -  avail_in is zero after the call if enough output space has been provided
 251.307 -  before the call.)  Flushing may degrade compression for some compression
 251.308 -  algorithms and so it should be used only when necessary.
 251.309 -
 251.310 -    If flush is set to Z_FULL_FLUSH, all output is flushed as with
 251.311 -  Z_SYNC_FLUSH, and the compression state is reset so that decompression can
 251.312 -  restart from this point if previous compressed data has been damaged or if
 251.313 -  random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
 251.314 -  compression.
 251.315 -
 251.316 -    If deflate returns with avail_out == 0, this function must be called again
 251.317 -  with the same value of the flush parameter and more output space (updated
 251.318 -  avail_out), until the flush is complete (deflate returns with non-zero
 251.319 -  avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
 251.320 -  avail_out is greater than six to avoid repeated flush markers due to
 251.321 -  avail_out == 0 on return.
 251.322 -
 251.323 -    If the parameter flush is set to Z_FINISH, pending input is processed,
 251.324 -  pending output is flushed and deflate returns with Z_STREAM_END if there
 251.325 -  was enough output space; if deflate returns with Z_OK, this function must be
 251.326 -  called again with Z_FINISH and more output space (updated avail_out) but no
 251.327 -  more input data, until it returns with Z_STREAM_END or an error. After
 251.328 -  deflate has returned Z_STREAM_END, the only possible operations on the
 251.329 -  stream are deflateReset or deflateEnd.
 251.330 -
 251.331 -    Z_FINISH can be used immediately after deflateInit if all the compression
 251.332 -  is to be done in a single step. In this case, avail_out must be at least
 251.333 -  the value returned by deflateBound (see below). If deflate does not return
 251.334 -  Z_STREAM_END, then it must be called again as described above.
 251.335 -
 251.336 -    deflate() sets strm->adler to the adler32 checksum of all input read
 251.337 -  so far (that is, total_in bytes).
 251.338 -
 251.339 -    deflate() may update strm->data_type if it can make a good guess about
 251.340 -  the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered
 251.341 -  binary. This field is only for information purposes and does not affect
 251.342 -  the compression algorithm in any manner.
 251.343 -
 251.344 -    deflate() returns Z_OK if some progress has been made (more input
 251.345 -  processed or more output produced), Z_STREAM_END if all input has been
 251.346 -  consumed and all output has been produced (only when flush is set to
 251.347 -  Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
 251.348 -  if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
 251.349 -  (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not
 251.350 -  fatal, and deflate() can be called again with more input and more output
 251.351 -  space to continue compressing.
 251.352 -*/
 251.353 -
 251.354 -
 251.355 -ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
 251.356 -/*
 251.357 -     All dynamically allocated data structures for this stream are freed.
 251.358 -   This function discards any unprocessed input and does not flush any
 251.359 -   pending output.
 251.360 -
 251.361 -     deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
 251.362 -   stream state was inconsistent, Z_DATA_ERROR if the stream was freed
 251.363 -   prematurely (some input or output was discarded). In the error case,
 251.364 -   msg may be set but then points to a static string (which must not be
 251.365 -   deallocated).
 251.366 -*/
 251.367 -
 251.368 -
 251.369 -/*
 251.370 -ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
 251.371 -
 251.372 -     Initializes the internal stream state for decompression. The fields
 251.373 -   next_in, avail_in, zalloc, zfree and opaque must be initialized before by
 251.374 -   the caller. If next_in is not Z_NULL and avail_in is large enough (the exact
 251.375 -   value depends on the compression method), inflateInit determines the
 251.376 -   compression method from the zlib header and allocates all data structures
 251.377 -   accordingly; otherwise the allocation will be deferred to the first call of
 251.378 -   inflate.  If zalloc and zfree are set to Z_NULL, inflateInit updates them to
 251.379 -   use default allocation functions.
 251.380 -
 251.381 -     inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
 251.382 -   memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
 251.383 -   version assumed by the caller.  msg is set to null if there is no error
 251.384 -   message. inflateInit does not perform any decompression apart from reading
 251.385 -   the zlib header if present: this will be done by inflate().  (So next_in and
 251.386 -   avail_in may be modified, but next_out and avail_out are unchanged.)
 251.387 -*/
 251.388 -
 251.389 -
 251.390 -ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
 251.391 -/*
 251.392 -    inflate decompresses as much data as possible, and stops when the input
 251.393 -  buffer becomes empty or the output buffer becomes full. It may introduce
 251.394 -  some output latency (reading input without producing any output) except when
 251.395 -  forced to flush.
 251.396 -
 251.397 -  The detailed semantics are as follows. inflate performs one or both of the
 251.398 -  following actions:
 251.399 -
 251.400 -  - Decompress more input starting at next_in and update next_in and avail_in
 251.401 -    accordingly. If not all input can be processed (because there is not
 251.402 -    enough room in the output buffer), next_in is updated and processing
 251.403 -    will resume at this point for the next call of inflate().
 251.404 -
 251.405 -  - Provide more output starting at next_out and update next_out and avail_out
 251.406 -    accordingly.  inflate() provides as much output as possible, until there
 251.407 -    is no more input data or no more space in the output buffer (see below
 251.408 -    about the flush parameter).
 251.409 -
 251.410 -  Before the call of inflate(), the application should ensure that at least
 251.411 -  one of the actions is possible, by providing more input and/or consuming
 251.412 -  more output, and updating the next_* and avail_* values accordingly.
 251.413 -  The application can consume the uncompressed output when it wants, for
 251.414 -  example when the output buffer is full (avail_out == 0), or after each
 251.415 -  call of inflate(). If inflate returns Z_OK and with zero avail_out, it
 251.416 -  must be called again after making room in the output buffer because there
 251.417 -  might be more output pending.
 251.418 -
 251.419 -    The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH,
 251.420 -  Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much
 251.421 -  output as possible to the output buffer. Z_BLOCK requests that inflate() stop
 251.422 -  if and when it gets to the next deflate block boundary. When decoding the
 251.423 -  zlib or gzip format, this will cause inflate() to return immediately after
 251.424 -  the header and before the first block. When doing a raw inflate, inflate()
 251.425 -  will go ahead and process the first block, and will return when it gets to
 251.426 -  the end of that block, or when it runs out of data.
 251.427 -
 251.428 -    The Z_BLOCK option assists in appending to or combining deflate streams.
 251.429 -  Also to assist in this, on return inflate() will set strm->data_type to the
 251.430 -  number of unused bits in the last byte taken from strm->next_in, plus 64
 251.431 -  if inflate() is currently decoding the last block in the deflate stream,
 251.432 -  plus 128 if inflate() returned immediately after decoding an end-of-block
 251.433 -  code or decoding the complete header up to just before the first byte of the
 251.434 -  deflate stream. The end-of-block will not be indicated until all of the
 251.435 -  uncompressed data from that block has been written to strm->next_out.  The
 251.436 -  number of unused bits may in general be greater than seven, except when
 251.437 -  bit 7 of data_type is set, in which case the number of unused bits will be
 251.438 -  less than eight.
 251.439 -
 251.440 -    inflate() should normally be called until it returns Z_STREAM_END or an
 251.441 -  error. However if all decompression is to be performed in a single step
 251.442 -  (a single call of inflate), the parameter flush should be set to
 251.443 -  Z_FINISH. In this case all pending input is processed and all pending
 251.444 -  output is flushed; avail_out must be large enough to hold all the
 251.445 -  uncompressed data. (The size of the uncompressed data may have been saved
 251.446 -  by the compressor for this purpose.) The next operation on this stream must
 251.447 -  be inflateEnd to deallocate the decompression state. The use of Z_FINISH
 251.448 -  is never required, but can be used to inform inflate that a faster approach
 251.449 -  may be used for the single inflate() call.
 251.450 -
 251.451 -     In this implementation, inflate() always flushes as much output as
 251.452 -  possible to the output buffer, and always uses the faster approach on the
 251.453 -  first call. So the only effect of the flush parameter in this implementation
 251.454 -  is on the return value of inflate(), as noted below, or when it returns early
 251.455 -  because Z_BLOCK is used.
 251.456 -
 251.457 -     If a preset dictionary is needed after this call (see inflateSetDictionary
 251.458 -  below), inflate sets strm->adler to the adler32 checksum of the dictionary
 251.459 -  chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
 251.460 -  strm->adler to the adler32 checksum of all output produced so far (that is,
 251.461 -  total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
 251.462 -  below. At the end of the stream, inflate() checks that its computed adler32
 251.463 -  checksum is equal to that saved by the compressor and returns Z_STREAM_END
 251.464 -  only if the checksum is correct.
 251.465 -
 251.466 -    inflate() will decompress and check either zlib-wrapped or gzip-wrapped
 251.467 -  deflate data.  The header type is detected automatically.  Any information
 251.468 -  contained in the gzip header is not retained, so applications that need that
 251.469 -  information should instead use raw inflate, see inflateInit2() below, or
 251.470 -  inflateBack() and perform their own processing of the gzip header and
 251.471 -  trailer.
 251.472 -
 251.473 -    inflate() returns Z_OK if some progress has been made (more input processed
 251.474 -  or more output produced), Z_STREAM_END if the end of the compressed data has
 251.475 -  been reached and all uncompressed output has been produced, Z_NEED_DICT if a
 251.476 -  preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
 251.477 -  corrupted (input stream not conforming to the zlib format or incorrect check
 251.478 -  value), Z_STREAM_ERROR if the stream structure was inconsistent (for example
 251.479 -  if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory,
 251.480 -  Z_BUF_ERROR if no progress is possible or if there was not enough room in the
 251.481 -  output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and
 251.482 -  inflate() can be called again with more input and more output space to
 251.483 -  continue decompressing. If Z_DATA_ERROR is returned, the application may then
 251.484 -  call inflateSync() to look for a good compression block if a partial recovery
 251.485 -  of the data is desired.
 251.486 -*/
 251.487 -
 251.488 -
 251.489 -ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
 251.490 -/*
 251.491 -     All dynamically allocated data structures for this stream are freed.
 251.492 -   This function discards any unprocessed input and does not flush any
 251.493 -   pending output.
 251.494 -
 251.495 -     inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
 251.496 -   was inconsistent. In the error case, msg may be set but then points to a
 251.497 -   static string (which must not be deallocated).
 251.498 -*/
 251.499 -
 251.500 -                        /* Advanced functions */
 251.501 -
 251.502 -/*
 251.503 -    The following functions are needed only in some special applications.
 251.504 -*/
 251.505 -
 251.506 -/*
 251.507 -ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
 251.508 -                                     int  level,
 251.509 -                                     int  method,
 251.510 -                                     int  windowBits,
 251.511 -                                     int  memLevel,
 251.512 -                                     int  strategy));
 251.513 -
 251.514 -     This is another version of deflateInit with more compression options. The
 251.515 -   fields next_in, zalloc, zfree and opaque must be initialized before by
 251.516 -   the caller.
 251.517 -
 251.518 -     The method parameter is the compression method. It must be Z_DEFLATED in
 251.519 -   this version of the library.
 251.520 -
 251.521 -     The windowBits parameter is the base two logarithm of the window size
 251.522 -   (the size of the history buffer). It should be in the range 8..15 for this
 251.523 -   version of the library. Larger values of this parameter result in better
 251.524 -   compression at the expense of memory usage. The default value is 15 if
 251.525 -   deflateInit is used instead.
 251.526 -
 251.527 -     windowBits can also be -8..-15 for raw deflate. In this case, -windowBits
 251.528 -   determines the window size. deflate() will then generate raw deflate data
 251.529 -   with no zlib header or trailer, and will not compute an adler32 check value.
 251.530 -
 251.531 -     windowBits can also be greater than 15 for optional gzip encoding. Add
 251.532 -   16 to windowBits to write a simple gzip header and trailer around the
 251.533 -   compressed data instead of a zlib wrapper. The gzip header will have no
 251.534 -   file name, no extra data, no comment, no modification time (set to zero),
 251.535 -   no header crc, and the operating system will be set to 255 (unknown).  If a
 251.536 -   gzip stream is being written, strm->adler is a crc32 instead of an adler32.
 251.537 -
 251.538 -     The memLevel parameter specifies how much memory should be allocated
 251.539 -   for the internal compression state. memLevel=1 uses minimum memory but
 251.540 -   is slow and reduces compression ratio; memLevel=9 uses maximum memory
 251.541 -   for optimal speed. The default value is 8. See zconf.h for total memory
 251.542 -   usage as a function of windowBits and memLevel.
 251.543 -
 251.544 -     The strategy parameter is used to tune the compression algorithm. Use the
 251.545 -   value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
 251.546 -   filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no
 251.547 -   string match), or Z_RLE to limit match distances to one (run-length
 251.548 -   encoding). Filtered data consists mostly of small values with a somewhat
 251.549 -   random distribution. In this case, the compression algorithm is tuned to
 251.550 -   compress them better. The effect of Z_FILTERED is to force more Huffman
 251.551 -   coding and less string matching; it is somewhat intermediate between
 251.552 -   Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as
 251.553 -   Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy
 251.554 -   parameter only affects the compression ratio but not the correctness of the
 251.555 -   compressed output even if it is not set appropriately.  Z_FIXED prevents the
 251.556 -   use of dynamic Huffman codes, allowing for a simpler decoder for special
 251.557 -   applications.
 251.558 -
 251.559 -      deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
 251.560 -   memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
 251.561 -   method). msg is set to null if there is no error message.  deflateInit2 does
 251.562 -   not perform any compression: this will be done by deflate().
 251.563 -*/
 251.564 -
 251.565 -ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
 251.566 -                                             const Bytef *dictionary,
 251.567 -                                             uInt  dictLength));
 251.568 -/*
 251.569 -     Initializes the compression dictionary from the given byte sequence
 251.570 -   without producing any compressed output. This function must be called
 251.571 -   immediately after deflateInit, deflateInit2 or deflateReset, before any
 251.572 -   call of deflate. The compressor and decompressor must use exactly the same
 251.573 -   dictionary (see inflateSetDictionary).
 251.574 -
 251.575 -     The dictionary should consist of strings (byte sequences) that are likely
 251.576 -   to be encountered later in the data to be compressed, with the most commonly
 251.577 -   used strings preferably put towards the end of the dictionary. Using a
 251.578 -   dictionary is most useful when the data to be compressed is short and can be
 251.579 -   predicted with good accuracy; the data can then be compressed better than
 251.580 -   with the default empty dictionary.
 251.581 -
 251.582 -     Depending on the size of the compression data structures selected by
 251.583 -   deflateInit or deflateInit2, a part of the dictionary may in effect be
 251.584 -   discarded, for example if the dictionary is larger than the window size in
 251.585 -   deflate or deflate2. Thus the strings most likely to be useful should be
 251.586 -   put at the end of the dictionary, not at the front. In addition, the
 251.587 -   current implementation of deflate will use at most the window size minus
 251.588 -   262 bytes of the provided dictionary.
 251.589 -
 251.590 -     Upon return of this function, strm->adler is set to the adler32 value
 251.591 -   of the dictionary; the decompressor may later use this value to determine
 251.592 -   which dictionary has been used by the compressor. (The adler32 value
 251.593 -   applies to the whole dictionary even if only a subset of the dictionary is
 251.594 -   actually used by the compressor.) If a raw deflate was requested, then the
 251.595 -   adler32 value is not computed and strm->adler is not set.
 251.596 -
 251.597 -     deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
 251.598 -   parameter is invalid (such as NULL dictionary) or the stream state is
 251.599 -   inconsistent (for example if deflate has already been called for this stream
 251.600 -   or if the compression method is bsort). deflateSetDictionary does not
 251.601 -   perform any compression: this will be done by deflate().
 251.602 -*/
 251.603 -
 251.604 -ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
 251.605 -                                    z_streamp source));
 251.606 -/*
 251.607 -     Sets the destination stream as a complete copy of the source stream.
 251.608 -
 251.609 -     This function can be useful when several compression strategies will be
 251.610 -   tried, for example when there are several ways of pre-processing the input
 251.611 -   data with a filter. The streams that will be discarded should then be freed
 251.612 -   by calling deflateEnd.  Note that deflateCopy duplicates the internal
 251.613 -   compression state which can be quite large, so this strategy is slow and
 251.614 -   can consume lots of memory.
 251.615 -
 251.616 -     deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
 251.617 -   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
 251.618 -   (such as zalloc being NULL). msg is left unchanged in both source and
 251.619 -   destination.
 251.620 -*/
 251.621 -
 251.622 -ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
 251.623 -/*
 251.624 -     This function is equivalent to deflateEnd followed by deflateInit,
 251.625 -   but does not free and reallocate all the internal compression state.
 251.626 -   The stream will keep the same compression level and any other attributes
 251.627 -   that may have been set by deflateInit2.
 251.628 -
 251.629 -      deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
 251.630 -   stream state was inconsistent (such as zalloc or state being NULL).
 251.631 -*/
 251.632 -
 251.633 -ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
 251.634 -                                      int level,
 251.635 -                                      int strategy));
 251.636 -/*
 251.637 -     Dynamically update the compression level and compression strategy.  The
 251.638 -   interpretation of level and strategy is as in deflateInit2.  This can be
 251.639 -   used to switch between compression and straight copy of the input data, or
 251.640 -   to switch to a different kind of input data requiring a different
 251.641 -   strategy. If the compression level is changed, the input available so far
 251.642 -   is compressed with the old level (and may be flushed); the new level will
 251.643 -   take effect only at the next call of deflate().
 251.644 -
 251.645 -     Before the call of deflateParams, the stream state must be set as for
 251.646 -   a call of deflate(), since the currently available input may have to
 251.647 -   be compressed and flushed. In particular, strm->avail_out must be non-zero.
 251.648 -
 251.649 -     deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
 251.650 -   stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
 251.651 -   if strm->avail_out was zero.
 251.652 -*/
 251.653 -
 251.654 -ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
 251.655 -                                    int good_length,
 251.656 -                                    int max_lazy,
 251.657 -                                    int nice_length,
 251.658 -                                    int max_chain));
 251.659 -/*
 251.660 -     Fine tune deflate's internal compression parameters.  This should only be
 251.661 -   used by someone who understands the algorithm used by zlib's deflate for
 251.662 -   searching for the best matching string, and even then only by the most
 251.663 -   fanatic optimizer trying to squeeze out the last compressed bit for their
 251.664 -   specific input data.  Read the deflate.c source code for the meaning of the
 251.665 -   max_lazy, good_length, nice_length, and max_chain parameters.
 251.666 -
 251.667 -     deflateTune() can be called after deflateInit() or deflateInit2(), and
 251.668 -   returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
 251.669 - */
 251.670 -
 251.671 -ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
 251.672 -                                       uLong sourceLen));
 251.673 -/*
 251.674 -     deflateBound() returns an upper bound on the compressed size after
 251.675 -   deflation of sourceLen bytes.  It must be called after deflateInit()
 251.676 -   or deflateInit2().  This would be used to allocate an output buffer
 251.677 -   for deflation in a single pass, and so would be called before deflate().
 251.678 -*/
 251.679 -
 251.680 -ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
 251.681 -                                     int bits,
 251.682 -                                     int value));
 251.683 -/*
 251.684 -     deflatePrime() inserts bits in the deflate output stream.  The intent
 251.685 -  is that this function is used to start off the deflate output with the
 251.686 -  bits leftover from a previous deflate stream when appending to it.  As such,
 251.687 -  this function can only be used for raw deflate, and must be used before the
 251.688 -  first deflate() call after a deflateInit2() or deflateReset().  bits must be
 251.689 -  less than or equal to 16, and that many of the least significant bits of
 251.690 -  value will be inserted in the output.
 251.691 -
 251.692 -      deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
 251.693 -   stream state was inconsistent.
 251.694 -*/
 251.695 -
 251.696 -ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
 251.697 -                                         gz_headerp head));
 251.698 -/*
 251.699 -      deflateSetHeader() provides gzip header information for when a gzip
 251.700 -   stream is requested by deflateInit2().  deflateSetHeader() may be called
 251.701 -   after deflateInit2() or deflateReset() and before the first call of
 251.702 -   deflate().  The text, time, os, extra field, name, and comment information
 251.703 -   in the provided gz_header structure are written to the gzip header (xflag is
 251.704 -   ignored -- the extra flags are set according to the compression level).  The
 251.705 -   caller must assure that, if not Z_NULL, name and comment are terminated with
 251.706 -   a zero byte, and that if extra is not Z_NULL, that extra_len bytes are
 251.707 -   available there.  If hcrc is true, a gzip header crc is included.  Note that
 251.708 -   the current versions of the command-line version of gzip (up through version
 251.709 -   1.3.x) do not support header crc's, and will report that it is a "multi-part
 251.710 -   gzip file" and give up.
 251.711 -
 251.712 -      If deflateSetHeader is not used, the default gzip header has text false,
 251.713 -   the time set to zero, and os set to 255, with no extra, name, or comment
 251.714 -   fields.  The gzip header is returned to the default state by deflateReset().
 251.715 -
 251.716 -      deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
 251.717 -   stream state was inconsistent.
 251.718 -*/
 251.719 -
 251.720 -/*
 251.721 -ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
 251.722 -                                     int  windowBits));
 251.723 -
 251.724 -     This is another version of inflateInit with an extra parameter. The
 251.725 -   fields next_in, avail_in, zalloc, zfree and opaque must be initialized
 251.726 -   before by the caller.
 251.727 -
 251.728 -     The windowBits parameter is the base two logarithm of the maximum window
 251.729 -   size (the size of the history buffer).  It should be in the range 8..15 for
 251.730 -   this version of the library. The default value is 15 if inflateInit is used
 251.731 -   instead. windowBits must be greater than or equal to the windowBits value
 251.732 -   provided to deflateInit2() while compressing, or it must be equal to 15 if
 251.733 -   deflateInit2() was not used. If a compressed stream with a larger window
 251.734 -   size is given as input, inflate() will return with the error code
 251.735 -   Z_DATA_ERROR instead of trying to allocate a larger window.
 251.736 -
 251.737 -     windowBits can also be -8..-15 for raw inflate. In this case, -windowBits
 251.738 -   determines the window size. inflate() will then process raw deflate data,
 251.739 -   not looking for a zlib or gzip header, not generating a check value, and not
 251.740 -   looking for any check values for comparison at the end of the stream. This
 251.741 -   is for use with other formats that use the deflate compressed data format
 251.742 -   such as zip.  Those formats provide their own check values. If a custom
 251.743 -   format is developed using the raw deflate format for compressed data, it is
 251.744 -   recommended that a check value such as an adler32 or a crc32 be applied to
 251.745 -   the uncompressed data as is done in the zlib, gzip, and zip formats.  For
 251.746 -   most applications, the zlib format should be used as is. Note that comments
 251.747 -   above on the use in deflateInit2() applies to the magnitude of windowBits.
 251.748 -
 251.749 -     windowBits can also be greater than 15 for optional gzip decoding. Add
 251.750 -   32 to windowBits to enable zlib and gzip decoding with automatic header
 251.751 -   detection, or add 16 to decode only the gzip format (the zlib format will
 251.752 -   return a Z_DATA_ERROR).  If a gzip stream is being decoded, strm->adler is
 251.753 -   a crc32 instead of an adler32.
 251.754 -
 251.755 -     inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
 251.756 -   memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg
 251.757 -   is set to null if there is no error message.  inflateInit2 does not perform
 251.758 -   any decompression apart from reading the zlib header if present: this will
 251.759 -   be done by inflate(). (So next_in and avail_in may be modified, but next_out
 251.760 -   and avail_out are unchanged.)
 251.761 -*/
 251.762 -
 251.763 -ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
 251.764 -                                             const Bytef *dictionary,
 251.765 -                                             uInt  dictLength));
 251.766 -/*
 251.767 -     Initializes the decompression dictionary from the given uncompressed byte
 251.768 -   sequence. This function must be called immediately after a call of inflate,
 251.769 -   if that call returned Z_NEED_DICT. The dictionary chosen by the compressor
 251.770 -   can be determined from the adler32 value returned by that call of inflate.
 251.771 -   The compressor and decompressor must use exactly the same dictionary (see
 251.772 -   deflateSetDictionary).  For raw inflate, this function can be called
 251.773 -   immediately after inflateInit2() or inflateReset() and before any call of
 251.774 -   inflate() to set the dictionary.  The application must insure that the
 251.775 -   dictionary that was used for compression is provided.
 251.776 -
 251.777 -     inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
 251.778 -   parameter is invalid (such as NULL dictionary) or the stream state is
 251.779 -   inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
 251.780 -   expected one (incorrect adler32 value). inflateSetDictionary does not
 251.781 -   perform any decompression: this will be done by subsequent calls of
 251.782 -   inflate().
 251.783 -*/
 251.784 -
 251.785 -ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
 251.786 -/*
 251.787 -    Skips invalid compressed data until a full flush point (see above the
 251.788 -  description of deflate with Z_FULL_FLUSH) can be found, or until all
 251.789 -  available input is skipped. No output is provided.
 251.790 -
 251.791 -    inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
 251.792 -  if no more input was provided, Z_DATA_ERROR if no flush point has been found,
 251.793 -  or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
 251.794 -  case, the application may save the current current value of total_in which
 251.795 -  indicates where valid compressed data was found. In the error case, the
 251.796 -  application may repeatedly call inflateSync, providing more input each time,
 251.797 -  until success or end of the input data.
 251.798 -*/
 251.799 -
 251.800 -ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
 251.801 -                                    z_streamp source));
 251.802 -/*
 251.803 -     Sets the destination stream as a complete copy of the source stream.
 251.804 -
 251.805 -     This function can be useful when randomly accessing a large stream.  The
 251.806 -   first pass through the stream can periodically record the inflate state,
 251.807 -   allowing restarting inflate at those points when randomly accessing the
 251.808 -   stream.
 251.809 -
 251.810 -     inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
 251.811 -   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
 251.812 -   (such as zalloc being NULL). msg is left unchanged in both source and
 251.813 -   destination.
 251.814 -*/
 251.815 -
 251.816 -ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
 251.817 -/*
 251.818 -     This function is equivalent to inflateEnd followed by inflateInit,
 251.819 -   but does not free and reallocate all the internal decompression state.
 251.820 -   The stream will keep attributes that may have been set by inflateInit2.
 251.821 -
 251.822 -      inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
 251.823 -   stream state was inconsistent (such as zalloc or state being NULL).
 251.824 -*/
 251.825 -
 251.826 -ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
 251.827 -                                     int bits,
 251.828 -                                     int value));
 251.829 -/*
 251.830 -     This function inserts bits in the inflate input stream.  The intent is
 251.831 -  that this function is used to start inflating at a bit position in the
 251.832 -  middle of a byte.  The provided bits will be used before any bytes are used
 251.833 -  from next_in.  This function should only be used with raw inflate, and
 251.834 -  should be used before the first inflate() call after inflateInit2() or
 251.835 -  inflateReset().  bits must be less than or equal to 16, and that many of the
 251.836 -  least significant bits of value will be inserted in the input.
 251.837 -
 251.838 -      inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
 251.839 -   stream state was inconsistent.
 251.840 -*/
 251.841 -
 251.842 -ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
 251.843 -                                         gz_headerp head));
 251.844 -/*
 251.845 -      inflateGetHeader() requests that gzip header information be stored in the
 251.846 -   provided gz_header structure.  inflateGetHeader() may be called after
 251.847 -   inflateInit2() or inflateReset(), and before the first call of inflate().
 251.848 -   As inflate() processes the gzip stream, head->done is zero until the header
 251.849 -   is completed, at which time head->done is set to one.  If a zlib stream is
 251.850 -   being decoded, then head->done is set to -1 to indicate that there will be
 251.851 -   no gzip header information forthcoming.  Note that Z_BLOCK can be used to
 251.852 -   force inflate() to return immediately after header processing is complete
 251.853 -   and before any actual data is decompressed.
 251.854 -
 251.855 -      The text, time, xflags, and os fields are filled in with the gzip header
 251.856 -   contents.  hcrc is set to true if there is a header CRC.  (The header CRC
 251.857 -   was valid if done is set to one.)  If extra is not Z_NULL, then extra_max
 251.858 -   contains the maximum number of bytes to write to extra.  Once done is true,
 251.859 -   extra_len contains the actual extra field length, and extra contains the
 251.860 -   extra field, or that field truncated if extra_max is less than extra_len.
 251.861 -   If name is not Z_NULL, then up to name_max characters are written there,
 251.862 -   terminated with a zero unless the length is greater than name_max.  If
 251.863 -   comment is not Z_NULL, then up to comm_max characters are written there,
 251.864 -   terminated with a zero unless the length is greater than comm_max.  When
 251.865 -   any of extra, name, or comment are not Z_NULL and the respective field is
 251.866 -   not present in the header, then that field is set to Z_NULL to signal its
 251.867 -   absence.  This allows the use of deflateSetHeader() with the returned
 251.868 -   structure to duplicate the header.  However if those fields are set to
 251.869 -   allocated memory, then the application will need to save those pointers
 251.870 -   elsewhere so that they can be eventually freed.
 251.871 -
 251.872 -      If inflateGetHeader is not used, then the header information is simply
 251.873 -   discarded.  The header is always checked for validity, including the header
 251.874 -   CRC if present.  inflateReset() will reset the process to discard the header
 251.875 -   information.  The application would need to call inflateGetHeader() again to
 251.876 -   retrieve the header from the next gzip stream.
 251.877 -
 251.878 -      inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
 251.879 -   stream state was inconsistent.
 251.880 -*/
 251.881 -
 251.882 -/*
 251.883 -ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
 251.884 -                                        unsigned char FAR *window));
 251.885 -
 251.886 -     Initialize the internal stream state for decompression using inflateBack()
 251.887 -   calls.  The fields zalloc, zfree and opaque in strm must be initialized
 251.888 -   before the call.  If zalloc and zfree are Z_NULL, then the default library-
 251.889 -   derived memory allocation routines are used.  windowBits is the base two
 251.890 -   logarithm of the window size, in the range 8..15.  window is a caller
 251.891 -   supplied buffer of that size.  Except for special applications where it is
 251.892 -   assured that deflate was used with small window sizes, windowBits must be 15
 251.893 -   and a 32K byte window must be supplied to be able to decompress general
 251.894 -   deflate streams.
 251.895 -
 251.896 -     See inflateBack() for the usage of these routines.
 251.897 -
 251.898 -     inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
 251.899 -   the paramaters are invalid, Z_MEM_ERROR if the internal state could not
 251.900 -   be allocated, or Z_VERSION_ERROR if the version of the library does not
 251.901 -   match the version of the header file.
 251.902 -*/
 251.903 -
 251.904 -typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));
 251.905 -typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
 251.906 -
 251.907 -ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
 251.908 -                                    in_func in, void FAR *in_desc,
 251.909 -                                    out_func out, void FAR *out_desc));
 251.910 -/*
 251.911 -     inflateBack() does a raw inflate with a single call using a call-back
 251.912 -   interface for input and output.  This is more efficient than inflate() for
 251.913 -   file i/o applications in that it avoids copying between the output and the
 251.914 -   sliding window by simply making the window itself the output buffer.  This
 251.915 -   function trusts the application to not change the output buffer passed by
 251.916 -   the output function, at least until inflateBack() returns.
 251.917 -
 251.918 -     inflateBackInit() must be called first to allocate the internal state
 251.919 -   and to initialize the state with the user-provided window buffer.
 251.920 -   inflateBack() may then be used multiple times to inflate a complete, raw
 251.921 -   deflate stream with each call.  inflateBackEnd() is then called to free
 251.922 -   the allocated state.
 251.923 -
 251.924 -     A raw deflate stream is one with no zlib or gzip header or trailer.
 251.925 -   This routine would normally be used in a utility that reads zip or gzip
 251.926 -   files and writes out uncompressed files.  The utility would decode the
 251.927 -   header and process the trailer on its own, hence this routine expects
 251.928 -   only the raw deflate stream to decompress.  This is different from the
 251.929 -   normal behavior of inflate(), which expects either a zlib or gzip header and
 251.930 -   trailer around the deflate stream.
 251.931 -
 251.932 -     inflateBack() uses two subroutines supplied by the caller that are then
 251.933 -   called by inflateBack() for input and output.  inflateBack() calls those
 251.934 -   routines until it reads a complete deflate stream and writes out all of the
 251.935 -   uncompressed data, or until it encounters an error.  The function's
 251.936 -   parameters and return types are defined above in the in_func and out_func
 251.937 -   typedefs.  inflateBack() will call in(in_desc, &buf) which should return the
 251.938 -   number of bytes of provided input, and a pointer to that input in buf.  If
 251.939 -   there is no input available, in() must return zero--buf is ignored in that
 251.940 -   case--and inflateBack() will return a buffer error.  inflateBack() will call
 251.941 -   out(out_desc, buf, len) to write the uncompressed data buf[0..len-1].  out()
 251.942 -   should return zero on success, or non-zero on failure.  If out() returns
 251.943 -   non-zero, inflateBack() will return with an error.  Neither in() nor out()
 251.944 -   are permitted to change the contents of the window provided to
 251.945 -   inflateBackInit(), which is also the buffer that out() uses to write from.
 251.946 -   The length written by out() will be at most the window size.  Any non-zero
 251.947 -   amount of input may be provided by in().
 251.948 -
 251.949 -     For convenience, inflateBack() can be provided input on the first call by
 251.950 -   setting strm->next_in and strm->avail_in.  If that input is exhausted, then
 251.951 -   in() will be called.  Therefore strm->next_in must be initialized before
 251.952 -   calling inflateBack().  If strm->next_in is Z_NULL, then in() will be called
 251.953 -   immediately for input.  If strm->next_in is not Z_NULL, then strm->avail_in
 251.954 -   must also be initialized, and then if strm->avail_in is not zero, input will
 251.955 -   initially be taken from strm->next_in[0 .. strm->avail_in - 1].
 251.956 -
 251.957 -     The in_desc and out_desc parameters of inflateBack() is passed as the
 251.958 -   first parameter of in() and out() respectively when they are called.  These
 251.959 -   descriptors can be optionally used to pass any information that the caller-
 251.960 -   supplied in() and out() functions need to do their job.
 251.961 -
 251.962 -     On return, inflateBack() will set strm->next_in and strm->avail_in to
 251.963 -   pass back any unused input that was provided by the last in() call.  The
 251.964 -   return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR
 251.965 -   if in() or out() returned an error, Z_DATA_ERROR if there was a format
 251.966 -   error in the deflate stream (in which case strm->msg is set to indicate the
 251.967 -   nature of the error), or Z_STREAM_ERROR if the stream was not properly
 251.968 -   initialized.  In the case of Z_BUF_ERROR, an input or output error can be
 251.969 -   distinguished using strm->next_in which will be Z_NULL only if in() returned
 251.970 -   an error.  If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to
 251.971 -   out() returning non-zero.  (in() will always be called before out(), so
 251.972 -   strm->next_in is assured to be defined if out() returns non-zero.)  Note
 251.973 -   that inflateBack() cannot return Z_OK.
 251.974 -*/
 251.975 -
 251.976 -ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
 251.977 -/*
 251.978 -     All memory allocated by inflateBackInit() is freed.
 251.979 -
 251.980 -     inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream
 251.981 -   state was inconsistent.
 251.982 -*/
 251.983 -
 251.984 -ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
 251.985 -/* Return flags indicating compile-time options.
 251.986 -
 251.987 -    Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
 251.988 -     1.0: size of uInt
 251.989 -     3.2: size of uLong
 251.990 -     5.4: size of voidpf (pointer)
 251.991 -     7.6: size of z_off_t
 251.992 -
 251.993 -    Compiler, assembler, and debug options:
 251.994 -     8: DEBUG
 251.995 -     9: ASMV or ASMINF -- use ASM code
 251.996 -     10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
 251.997 -     11: 0 (reserved)
 251.998 -
 251.999 -    One-time table building (smaller code, but not thread-safe if true):
251.1000 -     12: BUILDFIXED -- build static block decoding tables when needed
251.1001 -     13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed
251.1002 -     14,15: 0 (reserved)
251.1003 -
251.1004 -    Library content (indicates missing functionality):
251.1005 -     16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking
251.1006 -                          deflate code when not needed)
251.1007 -     17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect
251.1008 -                    and decode gzip streams (to avoid linking crc code)
251.1009 -     18-19: 0 (reserved)
251.1010 -
251.1011 -    Operation variations (changes in library functionality):
251.1012 -     20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate
251.1013 -     21: FASTEST -- deflate algorithm with only one, lowest compression level
251.1014 -     22,23: 0 (reserved)
251.1015 -
251.1016 -    The sprintf variant used by gzprintf (zero is best):
251.1017 -     24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format
251.1018 -     25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!
251.1019 -     26: 0 = returns value, 1 = void -- 1 means inferred string length returned
251.1020 -
251.1021 -    Remainder:
251.1022 -     27-31: 0 (reserved)
251.1023 - */
251.1024 -
251.1025 -
251.1026 -                        /* utility functions */
251.1027 -
251.1028 -/*
251.1029 -     The following utility functions are implemented on top of the
251.1030 -   basic stream-oriented functions. To simplify the interface, some
251.1031 -   default options are assumed (compression level and memory usage,
251.1032 -   standard memory allocation functions). The source code of these
251.1033 -   utility functions can easily be modified if you need special options.
251.1034 -*/
251.1035 -
251.1036 -ZEXTERN int ZEXPORT compress OF((Bytef *dest,   uLongf *destLen,
251.1037 -                                 const Bytef *source, uLong sourceLen));
251.1038 -/*
251.1039 -     Compresses the source buffer into the destination buffer.  sourceLen is
251.1040 -   the byte length of the source buffer. Upon entry, destLen is the total
251.1041 -   size of the destination buffer, which must be at least the value returned
251.1042 -   by compressBound(sourceLen). Upon exit, destLen is the actual size of the
251.1043 -   compressed buffer.
251.1044 -     This function can be used to compress a whole file at once if the
251.1045 -   input file is mmap'ed.
251.1046 -     compress returns Z_OK if success, Z_MEM_ERROR if there was not
251.1047 -   enough memory, Z_BUF_ERROR if there was not enough room in the output
251.1048 -   buffer.
251.1049 -*/
251.1050 -
251.1051 -ZEXTERN int ZEXPORT compress2 OF((Bytef *dest,   uLongf *destLen,
251.1052 -                                  const Bytef *source, uLong sourceLen,
251.1053 -                                  int level));
251.1054 -/*
251.1055 -     Compresses the source buffer into the destination buffer. The level
251.1056 -   parameter has the same meaning as in deflateInit.  sourceLen is the byte
251.1057 -   length of the source buffer. Upon entry, destLen is the total size of the
251.1058 -   destination buffer, which must be at least the value returned by
251.1059 -   compressBound(sourceLen). Upon exit, destLen is the actual size of the
251.1060 -   compressed buffer.
251.1061 -
251.1062 -     compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
251.1063 -   memory, Z_BUF_ERROR if there was not enough room in the output buffer,
251.1064 -   Z_STREAM_ERROR if the level parameter is invalid.
251.1065 -*/
251.1066 -
251.1067 -ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
251.1068 -/*
251.1069 -     compressBound() returns an upper bound on the compressed size after
251.1070 -   compress() or compress2() on sourceLen bytes.  It would be used before
251.1071 -   a compress() or compress2() call to allocate the destination buffer.
251.1072 -*/
251.1073 -
251.1074 -ZEXTERN int ZEXPORT uncompress OF((Bytef *dest,   uLongf *destLen,
251.1075 -                                   const Bytef *source, uLong sourceLen));
251.1076 -/*
251.1077 -     Decompresses the source buffer into the destination buffer.  sourceLen is
251.1078 -   the byte length of the source buffer. Upon entry, destLen is the total
251.1079 -   size of the destination buffer, which must be large enough to hold the
251.1080 -   entire uncompressed data. (The size of the uncompressed data must have
251.1081 -   been saved previously by the compressor and transmitted to the decompressor
251.1082 -   by some mechanism outside the scope of this compression library.)
251.1083 -   Upon exit, destLen is the actual size of the compressed buffer.
251.1084 -     This function can be used to decompress a whole file at once if the
251.1085 -   input file is mmap'ed.
251.1086 -
251.1087 -     uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
251.1088 -   enough memory, Z_BUF_ERROR if there was not enough room in the output
251.1089 -   buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete.
251.1090 -*/
251.1091 -
251.1092 -
251.1093 -typedef voidp gzFile;
251.1094 -
251.1095 -ZEXTERN gzFile ZEXPORT gzopen  OF((const char *path, const char *mode));
251.1096 -/*
251.1097 -     Opens a gzip (.gz) file for reading or writing. The mode parameter
251.1098 -   is as in fopen ("rb" or "wb") but can also include a compression level
251.1099 -   ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
251.1100 -   Huffman only compression as in "wb1h", or 'R' for run-length encoding
251.1101 -   as in "wb1R". (See the description of deflateInit2 for more information
251.1102 -   about the strategy parameter.)
251.1103 -
251.1104 -     gzopen can be used to read a file which is not in gzip format; in this
251.1105 -   case gzread will directly read from the file without decompression.
251.1106 -
251.1107 -     gzopen returns NULL if the file could not be opened or if there was
251.1108 -   insufficient memory to allocate the (de)compression state; errno
251.1109 -   can be checked to distinguish the two cases (if errno is zero, the
251.1110 -   zlib error is Z_MEM_ERROR).  */
251.1111 -
251.1112 -ZEXTERN gzFile ZEXPORT gzdopen  OF((int fd, const char *mode));
251.1113 -/*
251.1114 -     gzdopen() associates a gzFile with the file descriptor fd.  File
251.1115 -   descriptors are obtained from calls like open, dup, creat, pipe or
251.1116 -   fileno (in the file has been previously opened with fopen).
251.1117 -   The mode parameter is as in gzopen.
251.1118 -     The next call of gzclose on the returned gzFile will also close the
251.1119 -   file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
251.1120 -   descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
251.1121 -     gzdopen returns NULL if there was insufficient memory to allocate
251.1122 -   the (de)compression state.
251.1123 -*/
251.1124 -
251.1125 -ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
251.1126 -/*
251.1127 -     Dynamically update the compression level or strategy. See the description
251.1128 -   of deflateInit2 for the meaning of these parameters.
251.1129 -     gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
251.1130 -   opened for writing.
251.1131 -*/
251.1132 -
251.1133 -ZEXTERN int ZEXPORT    gzread  OF((gzFile file, voidp buf, unsigned len));
251.1134 -/*
251.1135 -     Reads the given number of uncompressed bytes from the compressed file.
251.1136 -   If the input file was not in gzip format, gzread copies the given number
251.1137 -   of bytes into the buffer.
251.1138 -     gzread returns the number of uncompressed bytes actually read (0 for
251.1139 -   end of file, -1 for error). */
251.1140 -
251.1141 -ZEXTERN int ZEXPORT    gzwrite OF((gzFile file,
251.1142 -                                   voidpc buf, unsigned len));
251.1143 -/*
251.1144 -     Writes the given number of uncompressed bytes into the compressed file.
251.1145 -   gzwrite returns the number of uncompressed bytes actually written
251.1146 -   (0 in case of error).
251.1147 -*/
251.1148 -
251.1149 -ZEXTERN int ZEXPORTVA   gzprintf OF((gzFile file, const char *format, ...));
251.1150 -/*
251.1151 -     Converts, formats, and writes the args to the compressed file under
251.1152 -   control of the format string, as in fprintf. gzprintf returns the number of
251.1153 -   uncompressed bytes actually written (0 in case of error).  The number of
251.1154 -   uncompressed bytes written is limited to 4095. The caller should assure that
251.1155 -   this limit is not exceeded. If it is exceeded, then gzprintf() will return
251.1156 -   return an error (0) with nothing written. In this case, there may also be a
251.1157 -   buffer overflow with unpredictable consequences, which is possible only if
251.1158 -   zlib was compiled with the insecure functions sprintf() or vsprintf()
251.1159 -   because the secure snprintf() or vsnprintf() functions were not available.
251.1160 -*/
251.1161 -
251.1162 -ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
251.1163 -/*
251.1164 -      Writes the given null-terminated string to the compressed file, excluding
251.1165 -   the terminating null character.
251.1166 -      gzputs returns the number of characters written, or -1 in case of error.
251.1167 -*/
251.1168 -
251.1169 -ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
251.1170 -/*
251.1171 -      Reads bytes from the compressed file until len-1 characters are read, or
251.1172 -   a newline character is read and transferred to buf, or an end-of-file
251.1173 -   condition is encountered.  The string is then terminated with a null
251.1174 -   character.
251.1175 -      gzgets returns buf, or Z_NULL in case of error.
251.1176 -*/
251.1177 -
251.1178 -ZEXTERN int ZEXPORT    gzputc OF((gzFile file, int c));
251.1179 -/*
251.1180 -      Writes c, converted to an unsigned char, into the compressed file.
251.1181 -   gzputc returns the value that was written, or -1 in case of error.
251.1182 -*/
251.1183 -
251.1184 -ZEXTERN int ZEXPORT    gzgetc OF((gzFile file));
251.1185 -/*
251.1186 -      Reads one byte from the compressed file. gzgetc returns this byte
251.1187 -   or -1 in case of end of file or error.
251.1188 -*/
251.1189 -
251.1190 -ZEXTERN int ZEXPORT    gzungetc OF((int c, gzFile file));
251.1191 -/*
251.1192 -      Push one character back onto the stream to be read again later.
251.1193 -   Only one character of push-back is allowed.  gzungetc() returns the
251.1194 -   character pushed, or -1 on failure.  gzungetc() will fail if a
251.1195 -   character has been pushed but not read yet, or if c is -1. The pushed
251.1196 -   character will be discarded if the stream is repositioned with gzseek()
251.1197 -   or gzrewind().
251.1198 -*/
251.1199 -
251.1200 -ZEXTERN int ZEXPORT    gzflush OF((gzFile file, int flush));
251.1201 -/*
251.1202 -     Flushes all pending output into the compressed file. The parameter
251.1203 -   flush is as in the deflate() function. The return value is the zlib
251.1204 -   error number (see function gzerror below). gzflush returns Z_OK if
251.1205 -   the flush parameter is Z_FINISH and all output could be flushed.
251.1206 -     gzflush should be called only when strictly necessary because it can
251.1207 -   degrade compression.
251.1208 -*/
251.1209 -
251.1210 -ZEXTERN z_off_t ZEXPORT    gzseek OF((gzFile file,
251.1211 -                                      z_off_t offset, int whence));
251.1212 -/*
251.1213 -      Sets the starting position for the next gzread or gzwrite on the
251.1214 -   given compressed file. The offset represents a number of bytes in the
251.1215 -   uncompressed data stream. The whence parameter is defined as in lseek(2);
251.1216 -   the value SEEK_END is not supported.
251.1217 -     If the file is opened for reading, this function is emulated but can be
251.1218 -   extremely slow. If the file is opened for writing, only forward seeks are
251.1219 -   supported; gzseek then compresses a sequence of zeroes up to the new
251.1220 -   starting position.
251.1221 -
251.1222 -      gzseek returns the resulting offset location as measured in bytes from
251.1223 -   the beginning of the uncompressed stream, or -1 in case of error, in
251.1224 -   particular if the file is opened for writing and the new starting position
251.1225 -   would be before the current position.
251.1226 -*/
251.1227 -
251.1228 -ZEXTERN int ZEXPORT    gzrewind OF((gzFile file));
251.1229 -/*
251.1230 -     Rewinds the given file. This function is supported only for reading.
251.1231 -
251.1232 -   gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
251.1233 -*/
251.1234 -
251.1235 -ZEXTERN z_off_t ZEXPORT    gztell OF((gzFile file));
251.1236 -/*
251.1237 -     Returns the starting position for the next gzread or gzwrite on the
251.1238 -   given compressed file. This position represents a number of bytes in the
251.1239 -   uncompressed data stream.
251.1240 -
251.1241 -   gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
251.1242 -*/
251.1243 -
251.1244 -ZEXTERN int ZEXPORT gzeof OF((gzFile file));
251.1245 -/*
251.1246 -     Returns 1 when EOF has previously been detected reading the given
251.1247 -   input stream, otherwise zero.
251.1248 -*/
251.1249 -
251.1250 -ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
251.1251 -/*
251.1252 -     Returns 1 if file is being read directly without decompression, otherwise
251.1253 -   zero.
251.1254 -*/
251.1255 -
251.1256 -ZEXTERN int ZEXPORT    gzclose OF((gzFile file));
251.1257 -/*
251.1258 -     Flushes all pending output if necessary, closes the compressed file
251.1259 -   and deallocates all the (de)compression state. The return value is the zlib
251.1260 -   error number (see function gzerror below).
251.1261 -*/
251.1262 -
251.1263 -ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
251.1264 -/*
251.1265 -     Returns the error message for the last error which occurred on the
251.1266 -   given compressed file. errnum is set to zlib error number. If an
251.1267 -   error occurred in the file system and not in the compression library,
251.1268 -   errnum is set to Z_ERRNO and the application may consult errno
251.1269 -   to get the exact error code.
251.1270 -*/
251.1271 -
251.1272 -ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
251.1273 -/*
251.1274 -     Clears the error and end-of-file flags for file. This is analogous to the
251.1275 -   clearerr() function in stdio. This is useful for continuing to read a gzip
251.1276 -   file that is being written concurrently.
251.1277 -*/
251.1278 -
251.1279 -                        /* checksum functions */
251.1280 -
251.1281 -/*
251.1282 -     These functions are not related to compression but are exported
251.1283 -   anyway because they might be useful in applications using the
251.1284 -   compression library.
251.1285 -*/
251.1286 -
251.1287 -ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
251.1288 -/*
251.1289 -     Update a running Adler-32 checksum with the bytes buf[0..len-1] and
251.1290 -   return the updated checksum. If buf is NULL, this function returns
251.1291 -   the required initial value for the checksum.
251.1292 -   An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
251.1293 -   much faster. Usage example:
251.1294 -
251.1295 -     uLong adler = adler32(0L, Z_NULL, 0);
251.1296 -
251.1297 -     while (read_buffer(buffer, length) != EOF) {
251.1298 -       adler = adler32(adler, buffer, length);
251.1299 -     }
251.1300 -     if (adler != original_adler) error();
251.1301 -*/
251.1302 -
251.1303 -ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
251.1304 -                                          z_off_t len2));
251.1305 -/*
251.1306 -     Combine two Adler-32 checksums into one.  For two sequences of bytes, seq1
251.1307 -   and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
251.1308 -   each, adler1 and adler2.  adler32_combine() returns the Adler-32 checksum of
251.1309 -   seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.
251.1310 -*/
251.1311 -
251.1312 -ZEXTERN uLong ZEXPORT crc32   OF((uLong crc, const Bytef *buf, uInt len));
251.1313 -/*
251.1314 -     Update a running CRC-32 with the bytes buf[0..len-1] and return the
251.1315 -   updated CRC-32. If buf is NULL, this function returns the required initial
251.1316 -   value for the for the crc. Pre- and post-conditioning (one's complement) is
251.1317 -   performed within this function so it shouldn't be done by the application.
251.1318 -   Usage example:
251.1319 -
251.1320 -     uLong crc = crc32(0L, Z_NULL, 0);
251.1321 -
251.1322 -     while (read_buffer(buffer, length) != EOF) {
251.1323 -       crc = crc32(crc, buffer, length);
251.1324 -     }
251.1325 -     if (crc != original_crc) error();
251.1326 -*/
251.1327 -
251.1328 -ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
251.1329 -
251.1330 -/*
251.1331 -     Combine two CRC-32 check values into one.  For two sequences of bytes,
251.1332 -   seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
251.1333 -   calculated for each, crc1 and crc2.  crc32_combine() returns the CRC-32
251.1334 -   check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
251.1335 -   len2.
251.1336 -*/
251.1337 -
251.1338 -
251.1339 -                        /* various hacks, don't look :) */
251.1340 -
251.1341 -/* deflateInit and inflateInit are macros to allow checking the zlib version
251.1342 - * and the compiler's view of z_stream:
251.1343 - */
251.1344 -ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
251.1345 -                                     const char *version, int stream_size));
251.1346 -ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
251.1347 -                                     const char *version, int stream_size));
251.1348 -ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int  level, int  method,
251.1349 -                                      int windowBits, int memLevel,
251.1350 -                                      int strategy, const char *version,
251.1351 -                                      int stream_size));
251.1352 -ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int  windowBits,
251.1353 -                                      const char *version, int stream_size));
251.1354 -ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
251.1355 -                                         unsigned char FAR *window,
251.1356 -                                         const char *version,
251.1357 -                                         int stream_size));
251.1358 -#define deflateInit(strm, level) \
251.1359 -        deflateInit_((strm), (level),       ZLIB_VERSION, sizeof(z_stream))
251.1360 -#define inflateInit(strm) \
251.1361 -        inflateInit_((strm),                ZLIB_VERSION, sizeof(z_stream))
251.1362 -#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
251.1363 -        deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
251.1364 -                      (strategy),           ZLIB_VERSION, sizeof(z_stream))
251.1365 -#define inflateInit2(strm, windowBits) \
251.1366 -        inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
251.1367 -#define inflateBackInit(strm, windowBits, window) \
251.1368 -        inflateBackInit_((strm), (windowBits), (window), \
251.1369 -        ZLIB_VERSION, sizeof(z_stream))
251.1370 -
251.1371 -
251.1372 -#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
251.1373 -    struct internal_state {int dummy;}; /* hack for buggy compilers */
251.1374 -#endif
251.1375 -
251.1376 -ZEXTERN const char   * ZEXPORT zError           OF((int));
251.1377 -ZEXTERN int            ZEXPORT inflateSyncPoint OF((z_streamp z));
251.1378 -ZEXTERN const unsigned long FAR * ZEXPORT get_crc_table    OF((void));
251.1379 -
251.1380 -#ifdef __cplusplus
251.1381 -}
251.1382 -#endif
251.1383 -
251.1384 -#endif /* ZLIB_H */
   252.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/zutil.c	Tue Dec 06 16:31:58 2011 -0800
   252.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   252.3 @@ -1,342 +0,0 @@
   252.4 -/*
   252.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   252.6 - *
   252.7 - * This code is free software; you can redistribute it and/or modify it
   252.8 - * under the terms of the GNU General Public License version 2 only, as
   252.9 - * published by the Free Software Foundation.  Oracle designates this
  252.10 - * particular file as subject to the "Classpath" exception as provided
  252.11 - * by Oracle in the LICENSE file that accompanied this code.
  252.12 - *
  252.13 - * This code is distributed in the hope that it will be useful, but WITHOUT
  252.14 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  252.15 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  252.16 - * version 2 for more details (a copy is included in the LICENSE file that
  252.17 - * accompanied this code).
  252.18 - *
  252.19 - * You should have received a copy of the GNU General Public License version
  252.20 - * 2 along with this work; if not, write to the Free Software Foundation,
  252.21 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  252.22 - *
  252.23 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  252.24 - * or visit www.oracle.com if you need additional information or have any
  252.25 - * questions.
  252.26 - */
  252.27 -
  252.28 -/* zutil.c -- target dependent utility functions for the compression library
  252.29 - * Copyright (C) 1995-2005 Jean-loup Gailly.
  252.30 - * For conditions of distribution and use, see copyright notice in zlib.h
  252.31 - */
  252.32 -
  252.33 -/* @(#) $Id$ */
  252.34 -
  252.35 -#include "zutil.h"
  252.36 -
  252.37 -#ifndef NO_DUMMY_DECL
  252.38 -struct internal_state      {int dummy;}; /* for buggy compilers */
  252.39 -#endif
  252.40 -
  252.41 -const char * const z_errmsg[10] = {
  252.42 -"need dictionary",     /* Z_NEED_DICT       2  */
  252.43 -"stream end",          /* Z_STREAM_END      1  */
  252.44 -"",                    /* Z_OK              0  */
  252.45 -"file error",          /* Z_ERRNO         (-1) */
  252.46 -"stream error",        /* Z_STREAM_ERROR  (-2) */
  252.47 -"data error",          /* Z_DATA_ERROR    (-3) */
  252.48 -"insufficient memory", /* Z_MEM_ERROR     (-4) */
  252.49 -"buffer error",        /* Z_BUF_ERROR     (-5) */
  252.50 -"incompatible version",/* Z_VERSION_ERROR (-6) */
  252.51 -""};
  252.52 -
  252.53 -
  252.54 -const char * ZEXPORT zlibVersion()
  252.55 -{
  252.56 -    return ZLIB_VERSION;
  252.57 -}
  252.58 -
  252.59 -uLong ZEXPORT zlibCompileFlags()
  252.60 -{
  252.61 -    uLong flags;
  252.62 -
  252.63 -    flags = 0;
  252.64 -    switch (sizeof(uInt)) {
  252.65 -    case 2:     break;
  252.66 -    case 4:     flags += 1;     break;
  252.67 -    case 8:     flags += 2;     break;
  252.68 -    default:    flags += 3;
  252.69 -    }
  252.70 -    switch (sizeof(uLong)) {
  252.71 -    case 2:     break;
  252.72 -    case 4:     flags += 1 << 2;        break;
  252.73 -    case 8:     flags += 2 << 2;        break;
  252.74 -    default:    flags += 3 << 2;
  252.75 -    }
  252.76 -    switch (sizeof(voidpf)) {
  252.77 -    case 2:     break;
  252.78 -    case 4:     flags += 1 << 4;        break;
  252.79 -    case 8:     flags += 2 << 4;        break;
  252.80 -    default:    flags += 3 << 4;
  252.81 -    }
  252.82 -    switch (sizeof(z_off_t)) {
  252.83 -    case 2:     break;
  252.84 -    case 4:     flags += 1 << 6;        break;
  252.85 -    case 8:     flags += 2 << 6;        break;
  252.86 -    default:    flags += 3 << 6;
  252.87 -    }
  252.88 -#ifdef DEBUG
  252.89 -    flags += 1 << 8;
  252.90 -#endif
  252.91 -#if defined(ASMV) || defined(ASMINF)
  252.92 -    flags += 1 << 9;
  252.93 -#endif
  252.94 -#ifdef ZLIB_WINAPI
  252.95 -    flags += 1 << 10;
  252.96 -#endif
  252.97 -#ifdef BUILDFIXED
  252.98 -    flags += 1 << 12;
  252.99 -#endif
 252.100 -#ifdef DYNAMIC_CRC_TABLE
 252.101 -    flags += 1 << 13;
 252.102 -#endif
 252.103 -#ifdef NO_GZCOMPRESS
 252.104 -    flags += 1L << 16;
 252.105 -#endif
 252.106 -#ifdef NO_GZIP
 252.107 -    flags += 1L << 17;
 252.108 -#endif
 252.109 -#ifdef PKZIP_BUG_WORKAROUND
 252.110 -    flags += 1L << 20;
 252.111 -#endif
 252.112 -#ifdef FASTEST
 252.113 -    flags += 1L << 21;
 252.114 -#endif
 252.115 -#ifdef STDC
 252.116 -#  ifdef NO_vsnprintf
 252.117 -        flags += 1L << 25;
 252.118 -#    ifdef HAS_vsprintf_void
 252.119 -        flags += 1L << 26;
 252.120 -#    endif
 252.121 -#  else
 252.122 -#    ifdef HAS_vsnprintf_void
 252.123 -        flags += 1L << 26;
 252.124 -#    endif
 252.125 -#  endif
 252.126 -#else
 252.127 -        flags += 1L << 24;
 252.128 -#  ifdef NO_snprintf
 252.129 -        flags += 1L << 25;
 252.130 -#    ifdef HAS_sprintf_void
 252.131 -        flags += 1L << 26;
 252.132 -#    endif
 252.133 -#  else
 252.134 -#    ifdef HAS_snprintf_void
 252.135 -        flags += 1L << 26;
 252.136 -#    endif
 252.137 -#  endif
 252.138 -#endif
 252.139 -    return flags;
 252.140 -}
 252.141 -
 252.142 -#ifdef DEBUG
 252.143 -
 252.144 -#  ifndef verbose
 252.145 -#    define verbose 0
 252.146 -#  endif
 252.147 -int z_verbose = verbose;
 252.148 -
 252.149 -void z_error (m)
 252.150 -    char *m;
 252.151 -{
 252.152 -    fprintf(stderr, "%s\n", m);
 252.153 -    exit(1);
 252.154 -}
 252.155 -#endif
 252.156 -
 252.157 -/* exported to allow conversion of error code to string for compress() and
 252.158 - * uncompress()
 252.159 - */
 252.160 -const char * ZEXPORT zError(err)
 252.161 -    int err;
 252.162 -{
 252.163 -    return ERR_MSG(err);
 252.164 -}
 252.165 -
 252.166 -#if defined(_WIN32_WCE)
 252.167 -    /* The Microsoft C Run-Time Library for Windows CE doesn't have
 252.168 -     * errno.  We define it as a global variable to simplify porting.
 252.169 -     * Its value is always 0 and should not be used.
 252.170 -     */
 252.171 -    int errno = 0;
 252.172 -#endif
 252.173 -
 252.174 -#ifndef HAVE_MEMCPY
 252.175 -
 252.176 -void zmemcpy(dest, source, len)
 252.177 -    Bytef* dest;
 252.178 -    const Bytef* source;
 252.179 -    uInt  len;
 252.180 -{
 252.181 -    if (len == 0) return;
 252.182 -    do {
 252.183 -        *dest++ = *source++; /* ??? to be unrolled */
 252.184 -    } while (--len != 0);
 252.185 -}
 252.186 -
 252.187 -int zmemcmp(s1, s2, len)
 252.188 -    const Bytef* s1;
 252.189 -    const Bytef* s2;
 252.190 -    uInt  len;
 252.191 -{
 252.192 -    uInt j;
 252.193 -
 252.194 -    for (j = 0; j < len; j++) {
 252.195 -        if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
 252.196 -    }
 252.197 -    return 0;
 252.198 -}
 252.199 -
 252.200 -void zmemzero(dest, len)
 252.201 -    Bytef* dest;
 252.202 -    uInt  len;
 252.203 -{
 252.204 -    if (len == 0) return;
 252.205 -    do {
 252.206 -        *dest++ = 0;  /* ??? to be unrolled */
 252.207 -    } while (--len != 0);
 252.208 -}
 252.209 -#endif
 252.210 -
 252.211 -
 252.212 -#ifdef SYS16BIT
 252.213 -
 252.214 -#ifdef __TURBOC__
 252.215 -/* Turbo C in 16-bit mode */
 252.216 -
 252.217 -#  define MY_ZCALLOC
 252.218 -
 252.219 -/* Turbo C malloc() does not allow dynamic allocation of 64K bytes
 252.220 - * and farmalloc(64K) returns a pointer with an offset of 8, so we
 252.221 - * must fix the pointer. Warning: the pointer must be put back to its
 252.222 - * original form in order to free it, use zcfree().
 252.223 - */
 252.224 -
 252.225 -#define MAX_PTR 10
 252.226 -/* 10*64K = 640K */
 252.227 -
 252.228 -local int next_ptr = 0;
 252.229 -
 252.230 -typedef struct ptr_table_s {
 252.231 -    voidpf org_ptr;
 252.232 -    voidpf new_ptr;
 252.233 -} ptr_table;
 252.234 -
 252.235 -local ptr_table table[MAX_PTR];
 252.236 -/* This table is used to remember the original form of pointers
 252.237 - * to large buffers (64K). Such pointers are normalized with a zero offset.
 252.238 - * Since MSDOS is not a preemptive multitasking OS, this table is not
 252.239 - * protected from concurrent access. This hack doesn't work anyway on
 252.240 - * a protected system like OS/2. Use Microsoft C instead.
 252.241 - */
 252.242 -
 252.243 -voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
 252.244 -{
 252.245 -    voidpf buf = opaque; /* just to make some compilers happy */
 252.246 -    ulg bsize = (ulg)items*size;
 252.247 -
 252.248 -    /* If we allocate less than 65520 bytes, we assume that farmalloc
 252.249 -     * will return a usable pointer which doesn't have to be normalized.
 252.250 -     */
 252.251 -    if (bsize < 65520L) {
 252.252 -        buf = farmalloc(bsize);
 252.253 -        if (*(ush*)&buf != 0) return buf;
 252.254 -    } else {
 252.255 -        buf = farmalloc(bsize + 16L);
 252.256 -    }
 252.257 -    if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
 252.258 -    table[next_ptr].org_ptr = buf;
 252.259 -
 252.260 -    /* Normalize the pointer to seg:0 */
 252.261 -    *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
 252.262 -    *(ush*)&buf = 0;
 252.263 -    table[next_ptr++].new_ptr = buf;
 252.264 -    return buf;
 252.265 -}
 252.266 -
 252.267 -void  zcfree (voidpf opaque, voidpf ptr)
 252.268 -{
 252.269 -    int n;
 252.270 -    if (*(ush*)&ptr != 0) { /* object < 64K */
 252.271 -        farfree(ptr);
 252.272 -        return;
 252.273 -    }
 252.274 -    /* Find the original pointer */
 252.275 -    for (n = 0; n < next_ptr; n++) {
 252.276 -        if (ptr != table[n].new_ptr) continue;
 252.277 -
 252.278 -        farfree(table[n].org_ptr);
 252.279 -        while (++n < next_ptr) {
 252.280 -            table[n-1] = table[n];
 252.281 -        }
 252.282 -        next_ptr--;
 252.283 -        return;
 252.284 -    }
 252.285 -    ptr = opaque; /* just to make some compilers happy */
 252.286 -    Assert(0, "zcfree: ptr not found");
 252.287 -}
 252.288 -
 252.289 -#endif /* __TURBOC__ */
 252.290 -
 252.291 -
 252.292 -#ifdef M_I86
 252.293 -/* Microsoft C in 16-bit mode */
 252.294 -
 252.295 -#  define MY_ZCALLOC
 252.296 -
 252.297 -#if (!defined(_MSC_VER) || (_MSC_VER <= 600))
 252.298 -#  define _halloc  halloc
 252.299 -#  define _hfree   hfree
 252.300 -#endif
 252.301 -
 252.302 -voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
 252.303 -{
 252.304 -    if (opaque) opaque = 0; /* to make compiler happy */
 252.305 -    return _halloc((long)items, size);
 252.306 -}
 252.307 -
 252.308 -void  zcfree (voidpf opaque, voidpf ptr)
 252.309 -{
 252.310 -    if (opaque) opaque = 0; /* to make compiler happy */
 252.311 -    _hfree(ptr);
 252.312 -}
 252.313 -
 252.314 -#endif /* M_I86 */
 252.315 -
 252.316 -#endif /* SYS16BIT */
 252.317 -
 252.318 -
 252.319 -#ifndef MY_ZCALLOC /* Any system without a special alloc function */
 252.320 -
 252.321 -#ifndef STDC
 252.322 -extern voidp  malloc OF((uInt size));
 252.323 -extern voidp  calloc OF((uInt items, uInt size));
 252.324 -extern void   free   OF((voidpf ptr));
 252.325 -#endif
 252.326 -
 252.327 -voidpf zcalloc (opaque, items, size)
 252.328 -    voidpf opaque;
 252.329 -    unsigned items;
 252.330 -    unsigned size;
 252.331 -{
 252.332 -    if (opaque) items += size - size; /* make compiler happy */
 252.333 -    return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
 252.334 -                              (voidpf)calloc(items, size);
 252.335 -}
 252.336 -
 252.337 -void  zcfree (opaque, ptr)
 252.338 -    voidpf opaque;
 252.339 -    voidpf ptr;
 252.340 -{
 252.341 -    free(ptr);
 252.342 -    if (opaque) return; /* make compiler happy */
 252.343 -}
 252.344 -
 252.345 -#endif /* MY_ZCALLOC */
   253.1 --- a/src/share/native/java/util/zip/zlib-1.2.3/zutil.h	Tue Dec 06 16:31:58 2011 -0800
   253.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   253.3 @@ -1,294 +0,0 @@
   253.4 -/*
   253.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   253.6 - *
   253.7 - * This code is free software; you can redistribute it and/or modify it
   253.8 - * under the terms of the GNU General Public License version 2 only, as
   253.9 - * published by the Free Software Foundation.  Oracle designates this
  253.10 - * particular file as subject to the "Classpath" exception as provided
  253.11 - * by Oracle in the LICENSE file that accompanied this code.
  253.12 - *
  253.13 - * This code is distributed in the hope that it will be useful, but WITHOUT
  253.14 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  253.15 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  253.16 - * version 2 for more details (a copy is included in the LICENSE file that
  253.17 - * accompanied this code).
  253.18 - *
  253.19 - * You should have received a copy of the GNU General Public License version
  253.20 - * 2 along with this work; if not, write to the Free Software Foundation,
  253.21 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  253.22 - *
  253.23 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  253.24 - * or visit www.oracle.com if you need additional information or have any
  253.25 - * questions.
  253.26 - */
  253.27 -
  253.28 -/* zutil.h -- internal interface and configuration of the compression library
  253.29 - * Copyright (C) 1995-2005 Jean-loup Gailly.
  253.30 - * For conditions of distribution and use, see copyright notice in zlib.h
  253.31 - */
  253.32 -
  253.33 -/* WARNING: this file should *not* be used by applications. It is
  253.34 -   part of the implementation of the compression library and is
  253.35 -   subject to change. Applications should only use zlib.h.
  253.36 - */
  253.37 -
  253.38 -/* @(#) $Id$ */
  253.39 -
  253.40 -#ifndef ZUTIL_H
  253.41 -#define ZUTIL_H
  253.42 -
  253.43 -#define ZLIB_INTERNAL
  253.44 -#include "zlib.h"
  253.45 -
  253.46 -#ifdef STDC
  253.47 -#  ifndef _WIN32_WCE
  253.48 -#    include <stddef.h>
  253.49 -#  endif
  253.50 -#  include <string.h>
  253.51 -#  include <stdlib.h>
  253.52 -#endif
  253.53 -#ifdef NO_ERRNO_H
  253.54 -#   ifdef _WIN32_WCE
  253.55 -      /* The Microsoft C Run-Time Library for Windows CE doesn't have
  253.56 -       * errno.  We define it as a global variable to simplify porting.
  253.57 -       * Its value is always 0 and should not be used.  We rename it to
  253.58 -       * avoid conflict with other libraries that use the same workaround.
  253.59 -       */
  253.60 -#     define errno z_errno
  253.61 -#   endif
  253.62 -    extern int errno;
  253.63 -#else
  253.64 -#  ifndef _WIN32_WCE
  253.65 -#    include <errno.h>
  253.66 -#  endif
  253.67 -#endif
  253.68 -
  253.69 -#ifndef local
  253.70 -#  define local static
  253.71 -#endif
  253.72 -/* compile with -Dlocal if your debugger can't find static symbols */
  253.73 -
  253.74 -typedef unsigned char  uch;
  253.75 -typedef uch FAR uchf;
  253.76 -typedef unsigned short ush;
  253.77 -typedef ush FAR ushf;
  253.78 -typedef unsigned long  ulg;
  253.79 -
  253.80 -extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
  253.81 -/* (size given to avoid silly warnings with Visual C++) */
  253.82 -
  253.83 -#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
  253.84 -
  253.85 -#define ERR_RETURN(strm,err) \
  253.86 -  return (strm->msg = (char*)ERR_MSG(err), (err))
  253.87 -/* To be used only when the state is known to be valid */
  253.88 -
  253.89 -        /* common constants */
  253.90 -
  253.91 -#ifndef DEF_WBITS
  253.92 -#  define DEF_WBITS MAX_WBITS
  253.93 -#endif
  253.94 -/* default windowBits for decompression. MAX_WBITS is for compression only */
  253.95 -
  253.96 -#if MAX_MEM_LEVEL >= 8
  253.97 -#  define DEF_MEM_LEVEL 8
  253.98 -#else
  253.99 -#  define DEF_MEM_LEVEL  MAX_MEM_LEVEL
 253.100 -#endif
 253.101 -/* default memLevel */
 253.102 -
 253.103 -#define STORED_BLOCK 0
 253.104 -#define STATIC_TREES 1
 253.105 -#define DYN_TREES    2
 253.106 -/* The three kinds of block type */
 253.107 -
 253.108 -#define MIN_MATCH  3
 253.109 -#define MAX_MATCH  258
 253.110 -/* The minimum and maximum match lengths */
 253.111 -
 253.112 -#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
 253.113 -
 253.114 -        /* target dependencies */
 253.115 -
 253.116 -#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
 253.117 -#  define OS_CODE  0x00
 253.118 -#  if defined(__TURBOC__) || defined(__BORLANDC__)
 253.119 -#    if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
 253.120 -       /* Allow compilation with ANSI keywords only enabled */
 253.121 -       void _Cdecl farfree( void *block );
 253.122 -       void *_Cdecl farmalloc( unsigned long nbytes );
 253.123 -#    else
 253.124 -#      include <alloc.h>
 253.125 -#    endif
 253.126 -#  else /* MSC or DJGPP */
 253.127 -#    include <malloc.h>
 253.128 -#  endif
 253.129 -#endif
 253.130 -
 253.131 -#ifdef AMIGA
 253.132 -#  define OS_CODE  0x01
 253.133 -#endif
 253.134 -
 253.135 -#if defined(VAXC) || defined(VMS)
 253.136 -#  define OS_CODE  0x02
 253.137 -#  define F_OPEN(name, mode) \
 253.138 -     fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
 253.139 -#endif
 253.140 -
 253.141 -#if defined(ATARI) || defined(atarist)
 253.142 -#  define OS_CODE  0x05
 253.143 -#endif
 253.144 -
 253.145 -#ifdef OS2
 253.146 -#  define OS_CODE  0x06
 253.147 -#  ifdef M_I86
 253.148 -     #include <malloc.h>
 253.149 -#  endif
 253.150 -#endif
 253.151 -
 253.152 -#if defined(MACOS) || defined(TARGET_OS_MAC)
 253.153 -#  define OS_CODE  0x07
 253.154 -#  if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
 253.155 -#    include <unix.h> /* for fdopen */
 253.156 -#  else
 253.157 -#    ifndef fdopen
 253.158 -#      define fdopen(fd,mode) NULL /* No fdopen() */
 253.159 -#    endif
 253.160 -#  endif
 253.161 -#endif
 253.162 -
 253.163 -#ifdef TOPS20
 253.164 -#  define OS_CODE  0x0a
 253.165 -#endif
 253.166 -
 253.167 -#ifdef WIN32
 253.168 -#  ifndef __CYGWIN__  /* Cygwin is Unix, not Win32 */
 253.169 -#    define OS_CODE  0x0b
 253.170 -#  endif
 253.171 -#endif
 253.172 -
 253.173 -#ifdef __50SERIES /* Prime/PRIMOS */
 253.174 -#  define OS_CODE  0x0f
 253.175 -#endif
 253.176 -
 253.177 -#if defined(_BEOS_) || defined(RISCOS)
 253.178 -#  define fdopen(fd,mode) NULL /* No fdopen() */
 253.179 -#endif
 253.180 -
 253.181 -#if (defined(_MSC_VER) && (_MSC_VER > 600))
 253.182 -#  if defined(_WIN32_WCE)
 253.183 -#    define fdopen(fd,mode) NULL /* No fdopen() */
 253.184 -#    ifndef _PTRDIFF_T_DEFINED
 253.185 -       typedef int ptrdiff_t;
 253.186 -#      define _PTRDIFF_T_DEFINED
 253.187 -#    endif
 253.188 -#  else
 253.189 -#    define fdopen(fd,type)  _fdopen(fd,type)
 253.190 -#  endif
 253.191 -#endif
 253.192 -
 253.193 -        /* common defaults */
 253.194 -
 253.195 -#ifndef OS_CODE
 253.196 -#  define OS_CODE  0x03  /* assume Unix */
 253.197 -#endif
 253.198 -
 253.199 -#ifndef F_OPEN
 253.200 -#  define F_OPEN(name, mode) fopen((name), (mode))
 253.201 -#endif
 253.202 -
 253.203 -         /* functions */
 253.204 -
 253.205 -#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
 253.206 -#  ifndef HAVE_VSNPRINTF
 253.207 -#    define HAVE_VSNPRINTF
 253.208 -#  endif
 253.209 -#endif
 253.210 -#if defined(__CYGWIN__)
 253.211 -#  ifndef HAVE_VSNPRINTF
 253.212 -#    define HAVE_VSNPRINTF
 253.213 -#  endif
 253.214 -#endif
 253.215 -#ifndef HAVE_VSNPRINTF
 253.216 -#  ifdef MSDOS
 253.217 -     /* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
 253.218 -        but for now we just assume it doesn't. */
 253.219 -#    define NO_vsnprintf
 253.220 -#  endif
 253.221 -#  ifdef __TURBOC__
 253.222 -#    define NO_vsnprintf
 253.223 -#  endif
 253.224 -#  ifdef WIN32
 253.225 -     /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
 253.226 -#    if !defined(vsnprintf) && !defined(NO_vsnprintf) && (!defined(_MSC_VER) || (_MSC_VER < 1500))
 253.227 -       /* Only needed before Visual Studio 2008 */
 253.228 -#      define vsnprintf _vsnprintf
 253.229 -#    endif
 253.230 -#  endif
 253.231 -#  ifdef __SASC
 253.232 -#    define NO_vsnprintf
 253.233 -#  endif
 253.234 -#endif
 253.235 -#ifdef VMS
 253.236 -#  define NO_vsnprintf
 253.237 -#endif
 253.238 -
 253.239 -#if defined(pyr)
 253.240 -#  define NO_MEMCPY
 253.241 -#endif
 253.242 -#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
 253.243 - /* Use our own functions for small and medium model with MSC <= 5.0.
 253.244 -  * You may have to use the same strategy for Borland C (untested).
 253.245 -  * The __SC__ check is for Symantec.
 253.246 -  */
 253.247 -#  define NO_MEMCPY
 253.248 -#endif
 253.249 -#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
 253.250 -#  define HAVE_MEMCPY
 253.251 -#endif
 253.252 -#ifdef HAVE_MEMCPY
 253.253 -#  ifdef SMALL_MEDIUM /* MSDOS small or medium model */
 253.254 -#    define zmemcpy _fmemcpy
 253.255 -#    define zmemcmp _fmemcmp
 253.256 -#    define zmemzero(dest, len) _fmemset(dest, 0, len)
 253.257 -#  else
 253.258 -#    define zmemcpy memcpy
 253.259 -#    define zmemcmp memcmp
 253.260 -#    define zmemzero(dest, len) memset(dest, 0, len)
 253.261 -#  endif
 253.262 -#else
 253.263 -   extern void zmemcpy  OF((Bytef* dest, const Bytef* source, uInt len));
 253.264 -   extern int  zmemcmp  OF((const Bytef* s1, const Bytef* s2, uInt len));
 253.265 -   extern void zmemzero OF((Bytef* dest, uInt len));
 253.266 -#endif
 253.267 -
 253.268 -/* Diagnostic functions */
 253.269 -#ifdef DEBUG
 253.270 -#  include <stdio.h>
 253.271 -   extern int z_verbose;
 253.272 -   extern void z_error    OF((char *m));
 253.273 -#  define Assert(cond,msg) {if(!(cond)) z_error(msg);}
 253.274 -#  define Trace(x) {if (z_verbose>=0) fprintf x ;}
 253.275 -#  define Tracev(x) {if (z_verbose>0) fprintf x ;}
 253.276 -#  define Tracevv(x) {if (z_verbose>1) fprintf x ;}
 253.277 -#  define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
 253.278 -#  define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
 253.279 -#else
 253.280 -#  define Assert(cond,msg)
 253.281 -#  define Trace(x)
 253.282 -#  define Tracev(x)
 253.283 -#  define Tracevv(x)
 253.284 -#  define Tracec(c,x)
 253.285 -#  define Tracecv(c,x)
 253.286 -#endif
 253.287 -
 253.288 -
 253.289 -voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
 253.290 -void   zcfree  OF((voidpf opaque, voidpf ptr));
 253.291 -
 253.292 -#define ZALLOC(strm, items, size) \
 253.293 -           (*((strm)->zalloc))((strm)->opaque, (items), (size))
 253.294 -#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
 253.295 -#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
 253.296 -
 253.297 -#endif /* ZUTIL_H */
   254.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   254.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/ChangeLog	Mon Dec 19 10:06:23 2011 -0800
   254.3 @@ -0,0 +1,1208 @@
   254.4 +
   254.5 +                ChangeLog file for zlib
   254.6 +
   254.7 +Changes in 1.2.5 (19 Apr 2010)
   254.8 +- Disable visibility attribute in win32/Makefile.gcc [Bar-Lev]
   254.9 +- Default to libdir as sharedlibdir in configure [Nieder]
  254.10 +- Update copyright dates on modified source files
  254.11 +- Update trees.c to be able to generate modified trees.h
  254.12 +- Exit configure for MinGW, suggesting win32/Makefile.gcc
  254.13 +
  254.14 +Changes in 1.2.4.5 (18 Apr 2010)
  254.15 +- Set sharedlibdir in configure [Torok]
  254.16 +- Set LDFLAGS in Makefile.in [Bar-Lev]
  254.17 +- Avoid mkdir objs race condition in Makefile.in [Bowler]
  254.18 +- Add ZLIB_INTERNAL in front of internal inter-module functions and arrays
  254.19 +- Define ZLIB_INTERNAL to hide internal functions and arrays for GNU C
  254.20 +- Don't use hidden attribute when it is a warning generator (e.g. Solaris)
  254.21 +
  254.22 +Changes in 1.2.4.4 (18 Apr 2010)
  254.23 +- Fix CROSS_PREFIX executable testing, CHOST extract, mingw* [Torok]
  254.24 +- Undefine _LARGEFILE64_SOURCE in zconf.h if it is zero, but not if empty
  254.25 +- Try to use bash or ksh regardless of functionality of /bin/sh
  254.26 +- Fix configure incompatibility with NetBSD sh
  254.27 +- Remove attempt to run under bash or ksh since have better NetBSD fix
  254.28 +- Fix win32/Makefile.gcc for MinGW [Bar-Lev]
  254.29 +- Add diagnostic messages when using CROSS_PREFIX in configure
  254.30 +- Added --sharedlibdir option to configure [Weigelt]
  254.31 +- Use hidden visibility attribute when available [Frysinger]
  254.32 +
  254.33 +Changes in 1.2.4.3 (10 Apr 2010)
  254.34 +- Only use CROSS_PREFIX in configure for ar and ranlib if they exist
  254.35 +- Use CROSS_PREFIX for nm [Bar-Lev]
  254.36 +- Assume _LARGEFILE64_SOURCE defined is equivalent to true
  254.37 +- Avoid use of undefined symbols in #if with && and ||
  254.38 +- Make *64 prototypes in gzguts.h consistent with functions
  254.39 +- Add -shared load option for MinGW in configure [Bowler]
  254.40 +- Move z_off64_t to public interface, use instead of off64_t
  254.41 +- Remove ! from shell test in configure (not portable to Solaris)
  254.42 +- Change +0 macro tests to -0 for possibly increased portability
  254.43 +
  254.44 +Changes in 1.2.4.2 (9 Apr 2010)
  254.45 +- Add consistent carriage returns to readme.txt's in masmx86 and masmx64
  254.46 +- Really provide prototypes for *64 functions when building without LFS
  254.47 +- Only define unlink() in minigzip.c if unistd.h not included
  254.48 +- Update README to point to contrib/vstudio project files
  254.49 +- Move projects/vc6 to old/ and remove projects/
  254.50 +- Include stdlib.h in minigzip.c for setmode() definition under WinCE
  254.51 +- Clean up assembler builds in win32/Makefile.msc [Rowe]
  254.52 +- Include sys/types.h for Microsoft for off_t definition
  254.53 +- Fix memory leak on error in gz_open()
  254.54 +- Symbolize nm as $NM in configure [Weigelt]
  254.55 +- Use TEST_LDSHARED instead of LDSHARED to link test programs [Weigelt]
  254.56 +- Add +0 to _FILE_OFFSET_BITS and _LFS64_LARGEFILE in case not defined
  254.57 +- Fix bug in gzeof() to take into account unused input data
  254.58 +- Avoid initialization of structures with variables in puff.c
  254.59 +- Updated win32/README-WIN32.txt [Rowe]
  254.60 +
  254.61 +Changes in 1.2.4.1 (28 Mar 2010)
  254.62 +- Remove the use of [a-z] constructs for sed in configure [gentoo 310225]
  254.63 +- Remove $(SHAREDLIB) from LIBS in Makefile.in [Creech]
  254.64 +- Restore "for debugging" comment on sprintf() in gzlib.c
  254.65 +- Remove fdopen for MVS from gzguts.h
  254.66 +- Put new README-WIN32.txt in win32 [Rowe]
  254.67 +- Add check for shell to configure and invoke another shell if needed
  254.68 +- Fix big fat stinking bug in gzseek() on uncompressed files
  254.69 +- Remove vestigial F_OPEN64 define in zutil.h
  254.70 +- Set and check the value of _LARGEFILE_SOURCE and _LARGEFILE64_SOURCE
  254.71 +- Avoid errors on non-LFS systems when applications define LFS macros
  254.72 +- Set EXE to ".exe" in configure for MINGW [Kahle]
  254.73 +- Match crc32() in crc32.c exactly to the prototype in zlib.h [Sherrill]
  254.74 +- Add prefix for cross-compilation in win32/makefile.gcc [Bar-Lev]
  254.75 +- Add DLL install in win32/makefile.gcc [Bar-Lev]
  254.76 +- Allow Linux* or linux* from uname in configure [Bar-Lev]
  254.77 +- Allow ldconfig to be redefined in configure and Makefile.in [Bar-Lev]
  254.78 +- Add cross-compilation prefixes to configure [Bar-Lev]
  254.79 +- Match type exactly in gz_load() invocation in gzread.c
  254.80 +- Match type exactly of zcalloc() in zutil.c to zlib.h alloc_func
  254.81 +- Provide prototypes for *64 functions when building zlib without LFS
  254.82 +- Don't use -lc when linking shared library on MinGW
  254.83 +- Remove errno.h check in configure and vestigial errno code in zutil.h
  254.84 +
  254.85 +Changes in 1.2.4 (14 Mar 2010)
  254.86 +- Fix VER3 extraction in configure for no fourth subversion
  254.87 +- Update zlib.3, add docs to Makefile.in to make .pdf out of it
  254.88 +- Add zlib.3.pdf to distribution
  254.89 +- Don't set error code in gzerror() if passed pointer is NULL
  254.90 +- Apply destination directory fixes to CMakeLists.txt [Lowman]
  254.91 +- Move #cmakedefine's to a new zconf.in.cmakein
  254.92 +- Restore zconf.h for builds that don't use configure or cmake
  254.93 +- Add distclean to dummy Makefile for convenience
  254.94 +- Update and improve INDEX, README, and FAQ
  254.95 +- Update CMakeLists.txt for the return of zconf.h [Lowman]
  254.96 +- Update contrib/vstudio/vc9 and vc10 [Vollant]
  254.97 +- Change libz.dll.a back to libzdll.a in win32/Makefile.gcc
  254.98 +- Apply license and readme changes to contrib/asm686 [Raiter]
  254.99 +- Check file name lengths and add -c option in minigzip.c [Li]
 254.100 +- Update contrib/amd64 and contrib/masmx86/ [Vollant]
 254.101 +- Avoid use of "eof" parameter in trees.c to not shadow library variable
 254.102 +- Update make_vms.com for removal of zlibdefs.h [Zinser]
 254.103 +- Update assembler code and vstudio projects in contrib [Vollant]
 254.104 +- Remove outdated assembler code contrib/masm686 and contrib/asm586
 254.105 +- Remove old vc7 and vc8 from contrib/vstudio
 254.106 +- Update win32/Makefile.msc, add ZLIB_VER_SUBREVISION [Rowe]
 254.107 +- Fix memory leaks in gzclose_r() and gzclose_w(), file leak in gz_open()
 254.108 +- Add contrib/gcc_gvmat64 for longest_match and inflate_fast [Vollant]
 254.109 +- Remove *64 functions from win32/zlib.def (they're not 64-bit yet)
 254.110 +- Fix bug in void-returning vsprintf() case in gzwrite.c
 254.111 +- Fix name change from inflate.h in contrib/inflate86/inffas86.c
 254.112 +- Check if temporary file exists before removing in make_vms.com [Zinser]
 254.113 +- Fix make install and uninstall for --static option
 254.114 +- Fix usage of _MSC_VER in gzguts.h and zutil.h [Truta]
 254.115 +- Update readme.txt in contrib/masmx64 and masmx86 to assemble
 254.116 +
 254.117 +Changes in 1.2.3.9 (21 Feb 2010)
 254.118 +- Expunge gzio.c
 254.119 +- Move as400 build information to old
 254.120 +- Fix updates in contrib/minizip and contrib/vstudio
 254.121 +- Add const to vsnprintf test in configure to avoid warnings [Weigelt]
 254.122 +- Delete zconf.h (made by configure) [Weigelt]
 254.123 +- Change zconf.in.h to zconf.h.in per convention [Weigelt]
 254.124 +- Check for NULL buf in gzgets()
 254.125 +- Return empty string for gzgets() with len == 1 (like fgets())
 254.126 +- Fix description of gzgets() in zlib.h for end-of-file, NULL return
 254.127 +- Update minizip to 1.1 [Vollant]
 254.128 +- Avoid MSVC loss of data warnings in gzread.c, gzwrite.c
 254.129 +- Note in zlib.h that gzerror() should be used to distinguish from EOF
 254.130 +- Remove use of snprintf() from gzlib.c
 254.131 +- Fix bug in gzseek()
 254.132 +- Update contrib/vstudio, adding vc9 and vc10 [Kuno, Vollant]
 254.133 +- Fix zconf.h generation in CMakeLists.txt [Lowman]
 254.134 +- Improve comments in zconf.h where modified by configure
 254.135 +
 254.136 +Changes in 1.2.3.8 (13 Feb 2010)
 254.137 +- Clean up text files (tabs, trailing whitespace, etc.) [Oberhumer]
 254.138 +- Use z_off64_t in gz_zero() and gz_skip() to match state->skip
 254.139 +- Avoid comparison problem when sizeof(int) == sizeof(z_off64_t)
 254.140 +- Revert to Makefile.in from 1.2.3.6 (live with the clutter)
 254.141 +- Fix missing error return in gzflush(), add zlib.h note
 254.142 +- Add *64 functions to zlib.map [Levin]
 254.143 +- Fix signed/unsigned comparison in gz_comp()
 254.144 +- Use SFLAGS when testing shared linking in configure
 254.145 +- Add --64 option to ./configure to use -m64 with gcc
 254.146 +- Fix ./configure --help to correctly name options
 254.147 +- Have make fail if a test fails [Levin]
 254.148 +- Avoid buffer overrun in contrib/masmx64/gvmat64.asm [Simpson]
 254.149 +- Remove assembler object files from contrib
 254.150 +
 254.151 +Changes in 1.2.3.7 (24 Jan 2010)
 254.152 +- Always gzopen() with O_LARGEFILE if available
 254.153 +- Fix gzdirect() to work immediately after gzopen() or gzdopen()
 254.154 +- Make gzdirect() more precise when the state changes while reading
 254.155 +- Improve zlib.h documentation in many places
 254.156 +- Catch memory allocation failure in gz_open()
 254.157 +- Complete close operation if seek forward in gzclose_w() fails
 254.158 +- Return Z_ERRNO from gzclose_r() if close() fails
 254.159 +- Return Z_STREAM_ERROR instead of EOF for gzclose() being passed NULL
 254.160 +- Return zero for gzwrite() errors to match zlib.h description
 254.161 +- Return -1 on gzputs() error to match zlib.h description
 254.162 +- Add zconf.in.h to allow recovery from configure modification [Weigelt]
 254.163 +- Fix static library permissions in Makefile.in [Weigelt]
 254.164 +- Avoid warnings in configure tests that hide functionality [Weigelt]
 254.165 +- Add *BSD and DragonFly to Linux case in configure [gentoo 123571]
 254.166 +- Change libzdll.a to libz.dll.a in win32/Makefile.gcc [gentoo 288212]
 254.167 +- Avoid access of uninitialized data for first inflateReset2 call [Gomes]
 254.168 +- Keep object files in subdirectories to reduce the clutter somewhat
 254.169 +- Remove default Makefile and zlibdefs.h, add dummy Makefile
 254.170 +- Add new external functions to Z_PREFIX, remove duplicates, z_z_ -> z_
 254.171 +- Remove zlibdefs.h completely -- modify zconf.h instead
 254.172 +
 254.173 +Changes in 1.2.3.6 (17 Jan 2010)
 254.174 +- Avoid void * arithmetic in gzread.c and gzwrite.c
 254.175 +- Make compilers happier with const char * for gz_error message
 254.176 +- Avoid unused parameter warning in inflate.c
 254.177 +- Avoid signed-unsigned comparison warning in inflate.c
 254.178 +- Indent #pragma's for traditional C
 254.179 +- Fix usage of strwinerror() in glib.c, change to gz_strwinerror()
 254.180 +- Correct email address in configure for system options
 254.181 +- Update make_vms.com and add make_vms.com to contrib/minizip [Zinser]
 254.182 +- Update zlib.map [Brown]
 254.183 +- Fix Makefile.in for Solaris 10 make of example64 and minizip64 [Torok]
 254.184 +- Apply various fixes to CMakeLists.txt [Lowman]
 254.185 +- Add checks on len in gzread() and gzwrite()
 254.186 +- Add error message for no more room for gzungetc()
 254.187 +- Remove zlib version check in gzwrite()
 254.188 +- Defer compression of gzprintf() result until need to
 254.189 +- Use snprintf() in gzdopen() if available
 254.190 +- Remove USE_MMAP configuration determination (only used by minigzip)
 254.191 +- Remove examples/pigz.c (available separately)
 254.192 +- Update examples/gun.c to 1.6
 254.193 +
 254.194 +Changes in 1.2.3.5 (8 Jan 2010)
 254.195 +- Add space after #if in zutil.h for some compilers
 254.196 +- Fix relatively harmless bug in deflate_fast() [Exarevsky]
 254.197 +- Fix same problem in deflate_slow()
 254.198 +- Add $(SHAREDLIBV) to LIBS in Makefile.in [Brown]
 254.199 +- Add deflate_rle() for faster Z_RLE strategy run-length encoding
 254.200 +- Add deflate_huff() for faster Z_HUFFMAN_ONLY encoding
 254.201 +- Change name of "write" variable in inffast.c to avoid library collisions
 254.202 +- Fix premature EOF from gzread() in gzio.c [Brown]
 254.203 +- Use zlib header window size if windowBits is 0 in inflateInit2()
 254.204 +- Remove compressBound() call in deflate.c to avoid linking compress.o
 254.205 +- Replace use of errno in gz* with functions, support WinCE [Alves]
 254.206 +- Provide alternative to perror() in minigzip.c for WinCE [Alves]
 254.207 +- Don't use _vsnprintf on later versions of MSVC [Lowman]
 254.208 +- Add CMake build script and input file [Lowman]
 254.209 +- Update contrib/minizip to 1.1 [Svensson, Vollant]
 254.210 +- Moved nintendods directory from contrib to .
 254.211 +- Replace gzio.c with a new set of routines with the same functionality
 254.212 +- Add gzbuffer(), gzoffset(), gzclose_r(), gzclose_w() as part of above
 254.213 +- Update contrib/minizip to 1.1b
 254.214 +- Change gzeof() to return 0 on error instead of -1 to agree with zlib.h
 254.215 +
 254.216 +Changes in 1.2.3.4 (21 Dec 2009)
 254.217 +- Use old school .SUFFIXES in Makefile.in for FreeBSD compatibility
 254.218 +- Update comments in configure and Makefile.in for default --shared
 254.219 +- Fix test -z's in configure [Marquess]
 254.220 +- Build examplesh and minigzipsh when not testing
 254.221 +- Change NULL's to Z_NULL's in deflate.c and in comments in zlib.h
 254.222 +- Import LDFLAGS from the environment in configure
 254.223 +- Fix configure to populate SFLAGS with discovered CFLAGS options
 254.224 +- Adapt make_vms.com to the new Makefile.in [Zinser]
 254.225 +- Add zlib2ansi script for C++ compilation [Marquess]
 254.226 +- Add _FILE_OFFSET_BITS=64 test to make test (when applicable)
 254.227 +- Add AMD64 assembler code for longest match to contrib [Teterin]
 254.228 +- Include options from $SFLAGS when doing $LDSHARED
 254.229 +- Simplify 64-bit file support by introducing z_off64_t type
 254.230 +- Make shared object files in objs directory to work around old Sun cc
 254.231 +- Use only three-part version number for Darwin shared compiles
 254.232 +- Add rc option to ar in Makefile.in for when ./configure not run
 254.233 +- Add -WI,-rpath,. to LDFLAGS for OSF 1 V4*
 254.234 +- Set LD_LIBRARYN32_PATH for SGI IRIX shared compile
 254.235 +- Protect against _FILE_OFFSET_BITS being defined when compiling zlib
 254.236 +- Rename Makefile.in targets allstatic to static and allshared to shared
 254.237 +- Fix static and shared Makefile.in targets to be independent
 254.238 +- Correct error return bug in gz_open() by setting state [Brown]
 254.239 +- Put spaces before ;;'s in configure for better sh compatibility
 254.240 +- Add pigz.c (parallel implementation of gzip) to examples/
 254.241 +- Correct constant in crc32.c to UL [Leventhal]
 254.242 +- Reject negative lengths in crc32_combine()
 254.243 +- Add inflateReset2() function to work like inflateEnd()/inflateInit2()
 254.244 +- Include sys/types.h for _LARGEFILE64_SOURCE [Brown]
 254.245 +- Correct typo in doc/algorithm.txt [Janik]
 254.246 +- Fix bug in adler32_combine() [Zhu]
 254.247 +- Catch missing-end-of-block-code error in all inflates and in puff
 254.248 +    Assures that random input to inflate eventually results in an error
 254.249 +- Added enough.c (calculation of ENOUGH for inftrees.h) to examples/
 254.250 +- Update ENOUGH and its usage to reflect discovered bounds
 254.251 +- Fix gzerror() error report on empty input file [Brown]
 254.252 +- Add ush casts in trees.c to avoid pedantic runtime errors
 254.253 +- Fix typo in zlib.h uncompress() description [Reiss]
 254.254 +- Correct inflate() comments with regard to automatic header detection
 254.255 +- Remove deprecation comment on Z_PARTIAL_FLUSH (it stays)
 254.256 +- Put new version of gzlog (2.0) in examples with interruption recovery
 254.257 +- Add puff compile option to permit invalid distance-too-far streams
 254.258 +- Add puff TEST command options, ability to read piped input
 254.259 +- Prototype the *64 functions in zlib.h when _FILE_OFFSET_BITS == 64, but
 254.260 +  _LARGEFILE64_SOURCE not defined
 254.261 +- Fix Z_FULL_FLUSH to truly erase the past by resetting s->strstart
 254.262 +- Fix deflateSetDictionary() to use all 32K for output consistency
 254.263 +- Remove extraneous #define MIN_LOOKAHEAD in deflate.c (in deflate.h)
 254.264 +- Clear bytes after deflate lookahead to avoid use of uninitialized data
 254.265 +- Change a limit in inftrees.c to be more transparent to Coverity Prevent
 254.266 +- Update win32/zlib.def with exported symbols from zlib.h
 254.267 +- Correct spelling error in zlib.h [Willem]
 254.268 +- Allow Z_BLOCK for deflate() to force a new block
 254.269 +- Allow negative bits in inflatePrime() to delete existing bit buffer
 254.270 +- Add Z_TREES flush option to inflate() to return at end of trees
 254.271 +- Add inflateMark() to return current state information for random access
 254.272 +- Add Makefile for NintendoDS to contrib [Costa]
 254.273 +- Add -w in configure compile tests to avoid spurious warnings [Beucler]
 254.274 +- Fix typos in zlib.h comments for deflateSetDictionary()
 254.275 +- Fix EOF detection in transparent gzread() [Maier]
 254.276 +
 254.277 +Changes in 1.2.3.3 (2 October 2006)
 254.278 +- Make --shared the default for configure, add a --static option
 254.279 +- Add compile option to permit invalid distance-too-far streams
 254.280 +- Add inflateUndermine() function which is required to enable above
 254.281 +- Remove use of "this" variable name for C++ compatibility [Marquess]
 254.282 +- Add testing of shared library in make test, if shared library built
 254.283 +- Use ftello() and fseeko() if available instead of ftell() and fseek()
 254.284 +- Provide two versions of all functions that use the z_off_t type for
 254.285 +  binary compatibility -- a normal version and a 64-bit offset version,
 254.286 +  per the Large File Support Extension when _LARGEFILE64_SOURCE is
 254.287 +  defined; use the 64-bit versions by default when _FILE_OFFSET_BITS
 254.288 +  is defined to be 64
 254.289 +- Add a --uname= option to configure to perhaps help with cross-compiling
 254.290 +
 254.291 +Changes in 1.2.3.2 (3 September 2006)
 254.292 +- Turn off silly Borland warnings [Hay]
 254.293 +- Use off64_t and define _LARGEFILE64_SOURCE when present
 254.294 +- Fix missing dependency on inffixed.h in Makefile.in
 254.295 +- Rig configure --shared to build both shared and static [Teredesai, Truta]
 254.296 +- Remove zconf.in.h and instead create a new zlibdefs.h file
 254.297 +- Fix contrib/minizip/unzip.c non-encrypted after encrypted [Vollant]
 254.298 +- Add treebuild.xml (see http://treebuild.metux.de/) [Weigelt]
 254.299 +
 254.300 +Changes in 1.2.3.1 (16 August 2006)
 254.301 +- Add watcom directory with OpenWatcom make files [Daniel]
 254.302 +- Remove #undef of FAR in zconf.in.h for MVS [Fedtke]
 254.303 +- Update make_vms.com [Zinser]
 254.304 +- Use -fPIC for shared build in configure [Teredesai, Nicholson]
 254.305 +- Use only major version number for libz.so on IRIX and OSF1 [Reinholdtsen]
 254.306 +- Use fdopen() (not _fdopen()) for Interix in zutil.h [BŠck]
 254.307 +- Add some FAQ entries about the contrib directory
 254.308 +- Update the MVS question in the FAQ
 254.309 +- Avoid extraneous reads after EOF in gzio.c [Brown]
 254.310 +- Correct spelling of "successfully" in gzio.c [Randers-Pehrson]
 254.311 +- Add comments to zlib.h about gzerror() usage [Brown]
 254.312 +- Set extra flags in gzip header in gzopen() like deflate() does
 254.313 +- Make configure options more compatible with double-dash conventions
 254.314 +  [Weigelt]
 254.315 +- Clean up compilation under Solaris SunStudio cc [Rowe, Reinholdtsen]
 254.316 +- Fix uninstall target in Makefile.in [Truta]
 254.317 +- Add pkgconfig support [Weigelt]
 254.318 +- Use $(DESTDIR) macro in Makefile.in [Reinholdtsen, Weigelt]
 254.319 +- Replace set_data_type() with a more accurate detect_data_type() in
 254.320 +  trees.c, according to the txtvsbin.txt document [Truta]
 254.321 +- Swap the order of #include <stdio.h> and #include "zlib.h" in
 254.322 +  gzio.c, example.c and minigzip.c [Truta]
 254.323 +- Shut up annoying VS2005 warnings about standard C deprecation [Rowe,
 254.324 +  Truta] (where?)
 254.325 +- Fix target "clean" from win32/Makefile.bor [Truta]
 254.326 +- Create .pdb and .manifest files in win32/makefile.msc [Ziegler, Rowe]
 254.327 +- Update zlib www home address in win32/DLL_FAQ.txt [Truta]
 254.328 +- Update contrib/masmx86/inffas32.asm for VS2005 [Vollant, Van Wassenhove]
 254.329 +- Enable browse info in the "Debug" and "ASM Debug" configurations in
 254.330 +  the Visual C++ 6 project, and set (non-ASM) "Debug" as default [Truta]
 254.331 +- Add pkgconfig support [Weigelt]
 254.332 +- Add ZLIB_VER_MAJOR, ZLIB_VER_MINOR and ZLIB_VER_REVISION in zlib.h,
 254.333 +  for use in win32/zlib1.rc [Polushin, Rowe, Truta]
 254.334 +- Add a document that explains the new text detection scheme to
 254.335 +  doc/txtvsbin.txt [Truta]
 254.336 +- Add rfc1950.txt, rfc1951.txt and rfc1952.txt to doc/ [Truta]
 254.337 +- Move algorithm.txt into doc/ [Truta]
 254.338 +- Synchronize FAQ with website
 254.339 +- Fix compressBound(), was low for some pathological cases [Fearnley]
 254.340 +- Take into account wrapper variations in deflateBound()
 254.341 +- Set examples/zpipe.c input and output to binary mode for Windows
 254.342 +- Update examples/zlib_how.html with new zpipe.c (also web site)
 254.343 +- Fix some warnings in examples/gzlog.c and examples/zran.c (it seems
 254.344 +  that gcc became pickier in 4.0)
 254.345 +- Add zlib.map for Linux: "All symbols from zlib-1.1.4 remain
 254.346 +  un-versioned, the patch adds versioning only for symbols introduced in
 254.347 +  zlib-1.2.0 or later.  It also declares as local those symbols which are
 254.348 +  not designed to be exported." [Levin]
 254.349 +- Update Z_PREFIX list in zconf.in.h, add --zprefix option to configure
 254.350 +- Do not initialize global static by default in trees.c, add a response
 254.351 +  NO_INIT_GLOBAL_POINTERS to initialize them if needed [Marquess]
 254.352 +- Don't use strerror() in gzio.c under WinCE [Yakimov]
 254.353 +- Don't use errno.h in zutil.h under WinCE [Yakimov]
 254.354 +- Move arguments for AR to its usage to allow replacing ar [Marot]
 254.355 +- Add HAVE_VISIBILITY_PRAGMA in zconf.in.h for Mozilla [Randers-Pehrson]
 254.356 +- Improve inflateInit() and inflateInit2() documentation
 254.357 +- Fix structure size comment in inflate.h
 254.358 +- Change configure help option from --h* to --help [Santos]
 254.359 +
 254.360 +Changes in 1.2.3 (18 July 2005)
 254.361 +- Apply security vulnerability fixes to contrib/infback9 as well
 254.362 +- Clean up some text files (carriage returns, trailing space)
 254.363 +- Update testzlib, vstudio, masmx64, and masmx86 in contrib [Vollant]
 254.364 +
 254.365 +Changes in 1.2.2.4 (11 July 2005)
 254.366 +- Add inflatePrime() function for starting inflation at bit boundary
 254.367 +- Avoid some Visual C warnings in deflate.c
 254.368 +- Avoid more silly Visual C warnings in inflate.c and inftrees.c for 64-bit
 254.369 +  compile
 254.370 +- Fix some spelling errors in comments [Betts]
 254.371 +- Correct inflateInit2() error return documentation in zlib.h
 254.372 +- Add zran.c example of compressed data random access to examples
 254.373 +  directory, shows use of inflatePrime()
 254.374 +- Fix cast for assignments to strm->state in inflate.c and infback.c
 254.375 +- Fix zlibCompileFlags() in zutil.c to use 1L for long shifts [Oberhumer]
 254.376 +- Move declarations of gf2 functions to right place in crc32.c [Oberhumer]
 254.377 +- Add cast in trees.c t avoid a warning [Oberhumer]
 254.378 +- Avoid some warnings in fitblk.c, gun.c, gzjoin.c in examples [Oberhumer]
 254.379 +- Update make_vms.com [Zinser]
 254.380 +- Initialize state->write in inflateReset() since copied in inflate_fast()
 254.381 +- Be more strict on incomplete code sets in inflate_table() and increase
 254.382 +  ENOUGH and MAXD -- this repairs a possible security vulnerability for
 254.383 +  invalid inflate input.  Thanks to Tavis Ormandy and Markus Oberhumer for
 254.384 +  discovering the vulnerability and providing test cases.
 254.385 +- Add ia64 support to configure for HP-UX [Smith]
 254.386 +- Add error return to gzread() for format or i/o error [Levin]
 254.387 +- Use malloc.h for OS/2 [Necasek]
 254.388 +
 254.389 +Changes in 1.2.2.3 (27 May 2005)
 254.390 +- Replace 1U constants in inflate.c and inftrees.c for 64-bit compile
 254.391 +- Typecast fread() return values in gzio.c [Vollant]
 254.392 +- Remove trailing space in minigzip.c outmode (VC++ can't deal with it)
 254.393 +- Fix crc check bug in gzread() after gzungetc() [Heiner]
 254.394 +- Add the deflateTune() function to adjust internal compression parameters
 254.395 +- Add a fast gzip decompressor, gun.c, to examples (use of inflateBack)
 254.396 +- Remove an incorrect assertion in examples/zpipe.c
 254.397 +- Add C++ wrapper in infback9.h [Donais]
 254.398 +- Fix bug in inflateCopy() when decoding fixed codes
 254.399 +- Note in zlib.h how much deflateSetDictionary() actually uses
 254.400 +- Remove USE_DICT_HEAD in deflate.c (would mess up inflate if used)
 254.401 +- Add _WIN32_WCE to define WIN32 in zconf.in.h [Spencer]
 254.402 +- Don't include stderr.h or errno.h for _WIN32_WCE in zutil.h [Spencer]
 254.403 +- Add gzdirect() function to indicate transparent reads
 254.404 +- Update contrib/minizip [Vollant]
 254.405 +- Fix compilation of deflate.c when both ASMV and FASTEST [Oberhumer]
 254.406 +- Add casts in crc32.c to avoid warnings [Oberhumer]
 254.407 +- Add contrib/masmx64 [Vollant]
 254.408 +- Update contrib/asm586, asm686, masmx86, testzlib, vstudio [Vollant]
 254.409 +
 254.410 +Changes in 1.2.2.2 (30 December 2004)
 254.411 +- Replace structure assignments in deflate.c and inflate.c with zmemcpy to
 254.412 +  avoid implicit memcpy calls (portability for no-library compilation)
 254.413 +- Increase sprintf() buffer size in gzdopen() to allow for large numbers
 254.414 +- Add INFLATE_STRICT to check distances against zlib header
 254.415 +- Improve WinCE errno handling and comments [Chang]
 254.416 +- Remove comment about no gzip header processing in FAQ
 254.417 +- Add Z_FIXED strategy option to deflateInit2() to force fixed trees
 254.418 +- Add updated make_vms.com [Coghlan], update README
 254.419 +- Create a new "examples" directory, move gzappend.c there, add zpipe.c,
 254.420 +  fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html.
 254.421 +- Add FAQ entry and comments in deflate.c on uninitialized memory access
 254.422 +- Add Solaris 9 make options in configure [Gilbert]
 254.423 +- Allow strerror() usage in gzio.c for STDC
 254.424 +- Fix DecompressBuf in contrib/delphi/ZLib.pas [ManChesTer]
 254.425 +- Update contrib/masmx86/inffas32.asm and gvmat32.asm [Vollant]
 254.426 +- Use z_off_t for adler32_combine() and crc32_combine() lengths
 254.427 +- Make adler32() much faster for small len
 254.428 +- Use OS_CODE in deflate() default gzip header
 254.429 +
 254.430 +Changes in 1.2.2.1 (31 October 2004)
 254.431 +- Allow inflateSetDictionary() call for raw inflate
 254.432 +- Fix inflate header crc check bug for file names and comments
 254.433 +- Add deflateSetHeader() and gz_header structure for custom gzip headers
 254.434 +- Add inflateGetheader() to retrieve gzip headers
 254.435 +- Add crc32_combine() and adler32_combine() functions
 254.436 +- Add alloc_func, free_func, in_func, out_func to Z_PREFIX list
 254.437 +- Use zstreamp consistently in zlib.h (inflate_back functions)
 254.438 +- Remove GUNZIP condition from definition of inflate_mode in inflate.h
 254.439 +  and in contrib/inflate86/inffast.S [Truta, Anderson]
 254.440 +- Add support for AMD64 in contrib/inflate86/inffas86.c [Anderson]
 254.441 +- Update projects/README.projects and projects/visualc6 [Truta]
 254.442 +- Update win32/DLL_FAQ.txt [Truta]
 254.443 +- Avoid warning under NO_GZCOMPRESS in gzio.c; fix typo [Truta]
 254.444 +- Deprecate Z_ASCII; use Z_TEXT instead [Truta]
 254.445 +- Use a new algorithm for setting strm->data_type in trees.c [Truta]
 254.446 +- Do not define an exit() prototype in zutil.c unless DEBUG defined
 254.447 +- Remove prototype of exit() from zutil.c, example.c, minigzip.c [Truta]
 254.448 +- Add comment in zlib.h for Z_NO_FLUSH parameter to deflate()
 254.449 +- Fix Darwin build version identification [Peterson]
 254.450 +
 254.451 +Changes in 1.2.2 (3 October 2004)
 254.452 +- Update zlib.h comments on gzip in-memory processing
 254.453 +- Set adler to 1 in inflateReset() to support Java test suite [Walles]
 254.454 +- Add contrib/dotzlib [Ravn]
 254.455 +- Update win32/DLL_FAQ.txt [Truta]
 254.456 +- Update contrib/minizip [Vollant]
 254.457 +- Move contrib/visual-basic.txt to old/ [Truta]
 254.458 +- Fix assembler builds in projects/visualc6/ [Truta]
 254.459 +
 254.460 +Changes in 1.2.1.2 (9 September 2004)
 254.461 +- Update INDEX file
 254.462 +- Fix trees.c to update strm->data_type (no one ever noticed!)
 254.463 +- Fix bug in error case in inflate.c, infback.c, and infback9.c [Brown]
 254.464 +- Add "volatile" to crc table flag declaration (for DYNAMIC_CRC_TABLE)
 254.465 +- Add limited multitasking protection to DYNAMIC_CRC_TABLE
 254.466 +- Add NO_vsnprintf for VMS in zutil.h [Mozilla]
 254.467 +- Don't declare strerror() under VMS [Mozilla]
 254.468 +- Add comment to DYNAMIC_CRC_TABLE to use get_crc_table() to initialize
 254.469 +- Update contrib/ada [Anisimkov]
 254.470 +- Update contrib/minizip [Vollant]
 254.471 +- Fix configure to not hardcode directories for Darwin [Peterson]
 254.472 +- Fix gzio.c to not return error on empty files [Brown]
 254.473 +- Fix indentation; update version in contrib/delphi/ZLib.pas and
 254.474 +  contrib/pascal/zlibpas.pas [Truta]
 254.475 +- Update mkasm.bat in contrib/masmx86 [Truta]
 254.476 +- Update contrib/untgz [Truta]
 254.477 +- Add projects/README.projects [Truta]
 254.478 +- Add project for MS Visual C++ 6.0 in projects/visualc6 [Cadieux, Truta]
 254.479 +- Update win32/DLL_FAQ.txt [Truta]
 254.480 +- Update list of Z_PREFIX symbols in zconf.h [Randers-Pehrson, Truta]
 254.481 +- Remove an unnecessary assignment to curr in inftrees.c [Truta]
 254.482 +- Add OS/2 to exe builds in configure [Poltorak]
 254.483 +- Remove err dummy parameter in zlib.h [Kientzle]
 254.484 +
 254.485 +Changes in 1.2.1.1 (9 January 2004)
 254.486 +- Update email address in README
 254.487 +- Several FAQ updates
 254.488 +- Fix a big fat bug in inftrees.c that prevented decoding valid
 254.489 +  dynamic blocks with only literals and no distance codes --
 254.490 +  Thanks to "Hot Emu" for the bug report and sample file
 254.491 +- Add a note to puff.c on no distance codes case.
 254.492 +
 254.493 +Changes in 1.2.1 (17 November 2003)
 254.494 +- Remove a tab in contrib/gzappend/gzappend.c
 254.495 +- Update some interfaces in contrib for new zlib functions
 254.496 +- Update zlib version number in some contrib entries
 254.497 +- Add Windows CE definition for ptrdiff_t in zutil.h [Mai, Truta]
 254.498 +- Support shared libraries on Hurd and KFreeBSD [Brown]
 254.499 +- Fix error in NO_DIVIDE option of adler32.c
 254.500 +
 254.501 +Changes in 1.2.0.8 (4 November 2003)
 254.502 +- Update version in contrib/delphi/ZLib.pas and contrib/pascal/zlibpas.pas
 254.503 +- Add experimental NO_DIVIDE #define in adler32.c
 254.504 +    - Possibly faster on some processors (let me know if it is)
 254.505 +- Correct Z_BLOCK to not return on first inflate call if no wrap
 254.506 +- Fix strm->data_type on inflate() return to correctly indicate EOB
 254.507 +- Add deflatePrime() function for appending in the middle of a byte
 254.508 +- Add contrib/gzappend for an example of appending to a stream
 254.509 +- Update win32/DLL_FAQ.txt [Truta]
 254.510 +- Delete Turbo C comment in README [Truta]
 254.511 +- Improve some indentation in zconf.h [Truta]
 254.512 +- Fix infinite loop on bad input in configure script [Church]
 254.513 +- Fix gzeof() for concatenated gzip files [Johnson]
 254.514 +- Add example to contrib/visual-basic.txt [Michael B.]
 254.515 +- Add -p to mkdir's in Makefile.in [vda]
 254.516 +- Fix configure to properly detect presence or lack of printf functions
 254.517 +- Add AS400 support [Monnerat]
 254.518 +- Add a little Cygwin support [Wilson]
 254.519 +
 254.520 +Changes in 1.2.0.7 (21 September 2003)
 254.521 +- Correct some debug formats in contrib/infback9
 254.522 +- Cast a type in a debug statement in trees.c
 254.523 +- Change search and replace delimiter in configure from % to # [Beebe]
 254.524 +- Update contrib/untgz to 0.2 with various fixes [Truta]
 254.525 +- Add build support for Amiga [Nikl]
 254.526 +- Remove some directories in old that have been updated to 1.2
 254.527 +- Add dylib building for Mac OS X in configure and Makefile.in
 254.528 +- Remove old distribution stuff from Makefile
 254.529 +- Update README to point to DLL_FAQ.txt, and add comment on Mac OS X
 254.530 +- Update links in README
 254.531 +
 254.532 +Changes in 1.2.0.6 (13 September 2003)
 254.533 +- Minor FAQ updates
 254.534 +- Update contrib/minizip to 1.00 [Vollant]
 254.535 +- Remove test of gz functions in example.c when GZ_COMPRESS defined [Truta]
 254.536 +- Update POSTINC comment for 68060 [Nikl]
 254.537 +- Add contrib/infback9 with deflate64 decoding (unsupported)
 254.538 +- For MVS define NO_vsnprintf and undefine FAR [van Burik]
 254.539 +- Add pragma for fdopen on MVS [van Burik]
 254.540 +
 254.541 +Changes in 1.2.0.5 (8 September 2003)
 254.542 +- Add OF to inflateBackEnd() declaration in zlib.h
 254.543 +- Remember start when using gzdopen in the middle of a file
 254.544 +- Use internal off_t counters in gz* functions to properly handle seeks
 254.545 +- Perform more rigorous check for distance-too-far in inffast.c
 254.546 +- Add Z_BLOCK flush option to return from inflate at block boundary
 254.547 +- Set strm->data_type on return from inflate
 254.548 +    - Indicate bits unused, if at block boundary, and if in last block
 254.549 +- Replace size_t with ptrdiff_t in crc32.c, and check for correct size
 254.550 +- Add condition so old NO_DEFLATE define still works for compatibility
 254.551 +- FAQ update regarding the Windows DLL [Truta]
 254.552 +- INDEX update: add qnx entry, remove aix entry [Truta]
 254.553 +- Install zlib.3 into mandir [Wilson]
 254.554 +- Move contrib/zlib_dll_FAQ.txt to win32/DLL_FAQ.txt; update [Truta]
 254.555 +- Adapt the zlib interface to the new DLL convention guidelines [Truta]
 254.556 +- Introduce ZLIB_WINAPI macro to allow the export of functions using
 254.557 +  the WINAPI calling convention, for Visual Basic [Vollant, Truta]
 254.558 +- Update msdos and win32 scripts and makefiles [Truta]
 254.559 +- Export symbols by name, not by ordinal, in win32/zlib.def [Truta]
 254.560 +- Add contrib/ada [Anisimkov]
 254.561 +- Move asm files from contrib/vstudio/vc70_32 to contrib/asm386 [Truta]
 254.562 +- Rename contrib/asm386 to contrib/masmx86 [Truta, Vollant]
 254.563 +- Add contrib/masm686 [Truta]
 254.564 +- Fix offsets in contrib/inflate86 and contrib/masmx86/inffas32.asm
 254.565 +  [Truta, Vollant]
 254.566 +- Update contrib/delphi; rename to contrib/pascal; add example [Truta]
 254.567 +- Remove contrib/delphi2; add a new contrib/delphi [Truta]
 254.568 +- Avoid inclusion of the nonstandard <memory.h> in contrib/iostream,
 254.569 +  and fix some method prototypes [Truta]
 254.570 +- Fix the ZCR_SEED2 constant to avoid warnings in contrib/minizip
 254.571 +  [Truta]
 254.572 +- Avoid the use of backslash (\) in contrib/minizip [Vollant]
 254.573 +- Fix file time handling in contrib/untgz; update makefiles [Truta]
 254.574 +- Update contrib/vstudio/vc70_32 to comply with the new DLL guidelines
 254.575 +  [Vollant]
 254.576 +- Remove contrib/vstudio/vc15_16 [Vollant]
 254.577 +- Rename contrib/vstudio/vc70_32 to contrib/vstudio/vc7 [Truta]
 254.578 +- Update README.contrib [Truta]
 254.579 +- Invert the assignment order of match_head and s->prev[...] in
 254.580 +  INSERT_STRING [Truta]
 254.581 +- Compare TOO_FAR with 32767 instead of 32768, to avoid 16-bit warnings
 254.582 +  [Truta]
 254.583 +- Compare function pointers with 0, not with NULL or Z_NULL [Truta]
 254.584 +- Fix prototype of syncsearch in inflate.c [Truta]
 254.585 +- Introduce ASMINF macro to be enabled when using an ASM implementation
 254.586 +  of inflate_fast [Truta]
 254.587 +- Change NO_DEFLATE to NO_GZCOMPRESS [Truta]
 254.588 +- Modify test_gzio in example.c to take a single file name as a
 254.589 +  parameter [Truta]
 254.590 +- Exit the example.c program if gzopen fails [Truta]
 254.591 +- Add type casts around strlen in example.c [Truta]
 254.592 +- Remove casting to sizeof in minigzip.c; give a proper type
 254.593 +  to the variable compared with SUFFIX_LEN [Truta]
 254.594 +- Update definitions of STDC and STDC99 in zconf.h [Truta]
 254.595 +- Synchronize zconf.h with the new Windows DLL interface [Truta]
 254.596 +- Use SYS16BIT instead of __32BIT__ to distinguish between
 254.597 +  16- and 32-bit platforms [Truta]
 254.598 +- Use far memory allocators in small 16-bit memory models for
 254.599 +  Turbo C [Truta]
 254.600 +- Add info about the use of ASMV, ASMINF and ZLIB_WINAPI in
 254.601 +  zlibCompileFlags [Truta]
 254.602 +- Cygwin has vsnprintf [Wilson]
 254.603 +- In Windows16, OS_CODE is 0, as in MSDOS [Truta]
 254.604 +- In Cygwin, OS_CODE is 3 (Unix), not 11 (Windows32) [Wilson]
 254.605 +
 254.606 +Changes in 1.2.0.4 (10 August 2003)
 254.607 +- Minor FAQ updates
 254.608 +- Be more strict when checking inflateInit2's windowBits parameter
 254.609 +- Change NO_GUNZIP compile option to NO_GZIP to cover deflate as well
 254.610 +- Add gzip wrapper option to deflateInit2 using windowBits
 254.611 +- Add updated QNX rule in configure and qnx directory [Bonnefoy]
 254.612 +- Make inflate distance-too-far checks more rigorous
 254.613 +- Clean up FAR usage in inflate
 254.614 +- Add casting to sizeof() in gzio.c and minigzip.c
 254.615 +
 254.616 +Changes in 1.2.0.3 (19 July 2003)
 254.617 +- Fix silly error in gzungetc() implementation [Vollant]
 254.618 +- Update contrib/minizip and contrib/vstudio [Vollant]
 254.619 +- Fix printf format in example.c
 254.620 +- Correct cdecl support in zconf.in.h [Anisimkov]
 254.621 +- Minor FAQ updates
 254.622 +
 254.623 +Changes in 1.2.0.2 (13 July 2003)
 254.624 +- Add ZLIB_VERNUM in zlib.h for numerical preprocessor comparisons
 254.625 +- Attempt to avoid warnings in crc32.c for pointer-int conversion
 254.626 +- Add AIX to configure, remove aix directory [Bakker]
 254.627 +- Add some casts to minigzip.c
 254.628 +- Improve checking after insecure sprintf() or vsprintf() calls
 254.629 +- Remove #elif's from crc32.c
 254.630 +- Change leave label to inf_leave in inflate.c and infback.c to avoid
 254.631 +  library conflicts
 254.632 +- Remove inflate gzip decoding by default--only enable gzip decoding by
 254.633 +  special request for stricter backward compatibility
 254.634 +- Add zlibCompileFlags() function to return compilation information
 254.635 +- More typecasting in deflate.c to avoid warnings
 254.636 +- Remove leading underscore from _Capital #defines [Truta]
 254.637 +- Fix configure to link shared library when testing
 254.638 +- Add some Windows CE target adjustments [Mai]
 254.639 +- Remove #define ZLIB_DLL in zconf.h [Vollant]
 254.640 +- Add zlib.3 [Rodgers]
 254.641 +- Update RFC URL in deflate.c and algorithm.txt [Mai]
 254.642 +- Add zlib_dll_FAQ.txt to contrib [Truta]
 254.643 +- Add UL to some constants [Truta]
 254.644 +- Update minizip and vstudio [Vollant]
 254.645 +- Remove vestigial NEED_DUMMY_RETURN from zconf.in.h
 254.646 +- Expand use of NO_DUMMY_DECL to avoid all dummy structures
 254.647 +- Added iostream3 to contrib [Schwardt]
 254.648 +- Replace rewind() with fseek() for WinCE [Truta]
 254.649 +- Improve setting of zlib format compression level flags
 254.650 +    - Report 0 for huffman and rle strategies and for level == 0 or 1
 254.651 +    - Report 2 only for level == 6
 254.652 +- Only deal with 64K limit when necessary at compile time [Truta]
 254.653 +- Allow TOO_FAR check to be turned off at compile time [Truta]
 254.654 +- Add gzclearerr() function [Souza]
 254.655 +- Add gzungetc() function
 254.656 +
 254.657 +Changes in 1.2.0.1 (17 March 2003)
 254.658 +- Add Z_RLE strategy for run-length encoding [Truta]
 254.659 +    - When Z_RLE requested, restrict matches to distance one
 254.660 +    - Update zlib.h, minigzip.c, gzopen(), gzdopen() for Z_RLE
 254.661 +- Correct FASTEST compilation to allow level == 0
 254.662 +- Clean up what gets compiled for FASTEST
 254.663 +- Incorporate changes to zconf.in.h [Vollant]
 254.664 +    - Refine detection of Turbo C need for dummy returns
 254.665 +    - Refine ZLIB_DLL compilation
 254.666 +    - Include additional header file on VMS for off_t typedef
 254.667 +- Try to use _vsnprintf where it supplants vsprintf [Vollant]
 254.668 +- Add some casts in inffast.c
 254.669 +- Enchance comments in zlib.h on what happens if gzprintf() tries to
 254.670 +  write more than 4095 bytes before compression
 254.671 +- Remove unused state from inflateBackEnd()
 254.672 +- Remove exit(0) from minigzip.c, example.c
 254.673 +- Get rid of all those darn tabs
 254.674 +- Add "check" target to Makefile.in that does the same thing as "test"
 254.675 +- Add "mostlyclean" and "maintainer-clean" targets to Makefile.in
 254.676 +- Update contrib/inflate86 [Anderson]
 254.677 +- Update contrib/testzlib, contrib/vstudio, contrib/minizip [Vollant]
 254.678 +- Add msdos and win32 directories with makefiles [Truta]
 254.679 +- More additions and improvements to the FAQ
 254.680 +
 254.681 +Changes in 1.2.0 (9 March 2003)
 254.682 +- New and improved inflate code
 254.683 +    - About 20% faster
 254.684 +    - Does not allocate 32K window unless and until needed
 254.685 +    - Automatically detects and decompresses gzip streams
 254.686 +    - Raw inflate no longer needs an extra dummy byte at end
 254.687 +    - Added inflateBack functions using a callback interface--even faster
 254.688 +      than inflate, useful for file utilities (gzip, zip)
 254.689 +    - Added inflateCopy() function to record state for random access on
 254.690 +      externally generated deflate streams (e.g. in gzip files)
 254.691 +    - More readable code (I hope)
 254.692 +- New and improved crc32()
 254.693 +    - About 50% faster, thanks to suggestions from Rodney Brown
 254.694 +- Add deflateBound() and compressBound() functions
 254.695 +- Fix memory leak in deflateInit2()
 254.696 +- Permit setting dictionary for raw deflate (for parallel deflate)
 254.697 +- Fix const declaration for gzwrite()
 254.698 +- Check for some malloc() failures in gzio.c
 254.699 +- Fix bug in gzopen() on single-byte file 0x1f
 254.700 +- Fix bug in gzread() on concatenated file with 0x1f at end of buffer
 254.701 +  and next buffer doesn't start with 0x8b
 254.702 +- Fix uncompress() to return Z_DATA_ERROR on truncated input
 254.703 +- Free memory at end of example.c
 254.704 +- Remove MAX #define in trees.c (conflicted with some libraries)
 254.705 +- Fix static const's in deflate.c, gzio.c, and zutil.[ch]
 254.706 +- Declare malloc() and free() in gzio.c if STDC not defined
 254.707 +- Use malloc() instead of calloc() in zutil.c if int big enough
 254.708 +- Define STDC for AIX
 254.709 +- Add aix/ with approach for compiling shared library on AIX
 254.710 +- Add HP-UX support for shared libraries in configure
 254.711 +- Add OpenUNIX support for shared libraries in configure
 254.712 +- Use $cc instead of gcc to build shared library
 254.713 +- Make prefix directory if needed when installing
 254.714 +- Correct Macintosh avoidance of typedef Byte in zconf.h
 254.715 +- Correct Turbo C memory allocation when under Linux
 254.716 +- Use libz.a instead of -lz in Makefile (assure use of compiled library)
 254.717 +- Update configure to check for snprintf or vsnprintf functions and their
 254.718 +  return value, warn during make if using an insecure function
 254.719 +- Fix configure problem with compile-time knowledge of HAVE_UNISTD_H that
 254.720 +  is lost when library is used--resolution is to build new zconf.h
 254.721 +- Documentation improvements (in zlib.h):
 254.722 +    - Document raw deflate and inflate
 254.723 +    - Update RFCs URL
 254.724 +    - Point out that zlib and gzip formats are different
 254.725 +    - Note that Z_BUF_ERROR is not fatal
 254.726 +    - Document string limit for gzprintf() and possible buffer overflow
 254.727 +    - Note requirement on avail_out when flushing
 254.728 +    - Note permitted values of flush parameter of inflate()
 254.729 +- Add some FAQs (and even answers) to the FAQ
 254.730 +- Add contrib/inflate86/ for x86 faster inflate
 254.731 +- Add contrib/blast/ for PKWare Data Compression Library decompression
 254.732 +- Add contrib/puff/ simple inflate for deflate format description
 254.733 +
 254.734 +Changes in 1.1.4 (11 March 2002)
 254.735 +- ZFREE was repeated on same allocation on some error conditions.
 254.736 +  This creates a security problem described in
 254.737 +  http://www.zlib.org/advisory-2002-03-11.txt
 254.738 +- Returned incorrect error (Z_MEM_ERROR) on some invalid data
 254.739 +- Avoid accesses before window for invalid distances with inflate window
 254.740 +  less than 32K.
 254.741 +- force windowBits > 8 to avoid a bug in the encoder for a window size
 254.742 +  of 256 bytes. (A complete fix will be available in 1.1.5).
 254.743 +
 254.744 +Changes in 1.1.3 (9 July 1998)
 254.745 +- fix "an inflate input buffer bug that shows up on rare but persistent
 254.746 +  occasions" (Mark)
 254.747 +- fix gzread and gztell for concatenated .gz files (Didier Le Botlan)
 254.748 +- fix gzseek(..., SEEK_SET) in write mode
 254.749 +- fix crc check after a gzeek (Frank Faubert)
 254.750 +- fix miniunzip when the last entry in a zip file is itself a zip file
 254.751 +  (J Lillge)
 254.752 +- add contrib/asm586 and contrib/asm686 (Brian Raiter)
 254.753 +  See http://www.muppetlabs.com/~breadbox/software/assembly.html
 254.754 +- add support for Delphi 3 in contrib/delphi (Bob Dellaca)
 254.755 +- add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti)
 254.756 +- do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren)
 254.757 +- use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks)
 254.758 +- added a FAQ file
 254.759 +
 254.760 +- Support gzdopen on Mac with Metrowerks (Jason Linhart)
 254.761 +- Do not redefine Byte on Mac (Brad Pettit & Jason Linhart)
 254.762 +- define SEEK_END too if SEEK_SET is not defined (Albert Chin-A-Young)
 254.763 +- avoid some warnings with Borland C (Tom Tanner)
 254.764 +- fix a problem in contrib/minizip/zip.c for 16-bit MSDOS (Gilles Vollant)
 254.765 +- emulate utime() for WIN32 in contrib/untgz  (Gilles Vollant)
 254.766 +- allow several arguments to configure (Tim Mooney, Frodo Looijaard)
 254.767 +- use libdir and includedir in Makefile.in (Tim Mooney)
 254.768 +- support shared libraries on OSF1 V4 (Tim Mooney)
 254.769 +- remove so_locations in "make clean"  (Tim Mooney)
 254.770 +- fix maketree.c compilation error (Glenn, Mark)
 254.771 +- Python interface to zlib now in Python 1.5 (Jeremy Hylton)
 254.772 +- new Makefile.riscos (Rich Walker)
 254.773 +- initialize static descriptors in trees.c for embedded targets (Nick Smith)
 254.774 +- use "foo-gz" in example.c for RISCOS and VMS (Nick Smith)
 254.775 +- add the OS/2 files in Makefile.in too (Andrew Zabolotny)
 254.776 +- fix fdopen and halloc macros for Microsoft C 6.0 (Tom Lane)
 254.777 +- fix maketree.c to allow clean compilation of inffixed.h (Mark)
 254.778 +- fix parameter check in deflateCopy (Gunther Nikl)
 254.779 +- cleanup trees.c, use compressed_len only in debug mode (Christian Spieler)
 254.780 +- Many portability patches by Christian Spieler:
 254.781 +  . zutil.c, zutil.h: added "const" for zmem*
 254.782 +  . Make_vms.com: fixed some typos
 254.783 +  . Make_vms.com: msdos/Makefile.*: removed zutil.h from some dependency lists
 254.784 +  . msdos/Makefile.msc: remove "default rtl link library" info from obj files
 254.785 +  . msdos/Makefile.*: use model-dependent name for the built zlib library
 254.786 +  . msdos/Makefile.emx, nt/Makefile.emx, nt/Makefile.gcc:
 254.787 +     new makefiles, for emx (DOS/OS2), emx&rsxnt and mingw32 (Windows 9x / NT)
 254.788 +- use define instead of typedef for Bytef also for MSC small/medium (Tom Lane)
 254.789 +- replace __far with _far for better portability (Christian Spieler, Tom Lane)
 254.790 +- fix test for errno.h in configure (Tim Newsham)
 254.791 +
 254.792 +Changes in 1.1.2 (19 March 98)
 254.793 +- added contrib/minzip, mini zip and unzip based on zlib (Gilles Vollant)
 254.794 +  See http://www.winimage.com/zLibDll/unzip.html
 254.795 +- preinitialize the inflate tables for fixed codes, to make the code
 254.796 +  completely thread safe (Mark)
 254.797 +- some simplifications and slight speed-up to the inflate code (Mark)
 254.798 +- fix gzeof on non-compressed files (Allan Schrum)
 254.799 +- add -std1 option in configure for OSF1 to fix gzprintf (Martin Mokrejs)
 254.800 +- use default value of 4K for Z_BUFSIZE for 16-bit MSDOS (Tim Wegner + Glenn)
 254.801 +- added os2/Makefile.def and os2/zlib.def (Andrew Zabolotny)
 254.802 +- add shared lib support for UNIX_SV4.2MP (MATSUURA Takanori)
 254.803 +- do not wrap extern "C" around system includes (Tom Lane)
 254.804 +- mention zlib binding for TCL in README (Andreas Kupries)
 254.805 +- added amiga/Makefile.pup for Amiga powerUP SAS/C PPC (Andreas Kleinert)
 254.806 +- allow "make install prefix=..." even after configure (Glenn Randers-Pehrson)
 254.807 +- allow "configure --prefix $HOME" (Tim Mooney)
 254.808 +- remove warnings in example.c and gzio.c (Glenn Randers-Pehrson)
 254.809 +- move Makefile.sas to amiga/Makefile.sas
 254.810 +
 254.811 +Changes in 1.1.1 (27 Feb 98)
 254.812 +- fix macros _tr_tally_* in deflate.h for debug mode  (Glenn Randers-Pehrson)
 254.813 +- remove block truncation heuristic which had very marginal effect for zlib
 254.814 +  (smaller lit_bufsize than in gzip 1.2.4) and degraded a little the
 254.815 +  compression ratio on some files. This also allows inlining _tr_tally for
 254.816 +  matches in deflate_slow.
 254.817 +- added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier)
 254.818 +
 254.819 +Changes in 1.1.0 (24 Feb 98)
 254.820 +- do not return STREAM_END prematurely in inflate (John Bowler)
 254.821 +- revert to the zlib 1.0.8 inflate to avoid the gcc 2.8.0 bug (Jeremy Buhler)
 254.822 +- compile with -DFASTEST to get compression code optimized for speed only
 254.823 +- in minigzip, try mmap'ing the input file first (Miguel Albrecht)
 254.824 +- increase size of I/O buffers in minigzip.c and gzio.c (not a big gain
 254.825 +  on Sun but significant on HP)
 254.826 +
 254.827 +- add a pointer to experimental unzip library in README (Gilles Vollant)
 254.828 +- initialize variable gcc in configure (Chris Herborth)
 254.829 +
 254.830 +Changes in 1.0.9 (17 Feb 1998)
 254.831 +- added gzputs and gzgets functions
 254.832 +- do not clear eof flag in gzseek (Mark Diekhans)
 254.833 +- fix gzseek for files in transparent mode (Mark Diekhans)
 254.834 +- do not assume that vsprintf returns the number of bytes written (Jens Krinke)
 254.835 +- replace EXPORT with ZEXPORT to avoid conflict with other programs
 254.836 +- added compress2 in zconf.h, zlib.def, zlib.dnt
 254.837 +- new asm code from Gilles Vollant in contrib/asm386
 254.838 +- simplify the inflate code (Mark):
 254.839 + . Replace ZALLOC's in huft_build() with single ZALLOC in inflate_blocks_new()
 254.840 + . ZALLOC the length list in inflate_trees_fixed() instead of using stack
 254.841 + . ZALLOC the value area for huft_build() instead of using stack
 254.842 + . Simplify Z_FINISH check in inflate()
 254.843 +
 254.844 +- Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8
 254.845 +- in inftrees.c, avoid cc -O bug on HP (Farshid Elahi)
 254.846 +- in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with
 254.847 +  the declaration of FAR (Gilles VOllant)
 254.848 +- install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann)
 254.849 +- read_buf buf parameter of type Bytef* instead of charf*
 254.850 +- zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout)
 254.851 +- do not redeclare unlink in minigzip.c for WIN32 (John Bowler)
 254.852 +- fix check for presence of directories in "make install" (Ian Willis)
 254.853 +
 254.854 +Changes in 1.0.8 (27 Jan 1998)
 254.855 +- fixed offsets in contrib/asm386/gvmat32.asm (Gilles Vollant)
 254.856 +- fix gzgetc and gzputc for big endian systems (Markus Oberhumer)
 254.857 +- added compress2() to allow setting the compression level
 254.858 +- include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong)
 254.859 +- use constant arrays for the static trees in trees.c instead of computing
 254.860 +  them at run time (thanks to Ken Raeburn for this suggestion). To create
 254.861 +  trees.h, compile with GEN_TREES_H and run "make test".
 254.862 +- check return code of example in "make test" and display result
 254.863 +- pass minigzip command line options to file_compress
 254.864 +- simplifying code of inflateSync to avoid gcc 2.8 bug
 254.865 +
 254.866 +- support CC="gcc -Wall" in configure -s (QingLong)
 254.867 +- avoid a flush caused by ftell in gzopen for write mode (Ken Raeburn)
 254.868 +- fix test for shared library support to avoid compiler warnings
 254.869 +- zlib.lib -> zlib.dll in msdos/zlib.rc (Gilles Vollant)
 254.870 +- check for TARGET_OS_MAC in addition to MACOS (Brad Pettit)
 254.871 +- do not use fdopen for Metrowerks on Mac (Brad Pettit))
 254.872 +- add checks for gzputc and gzputc in example.c
 254.873 +- avoid warnings in gzio.c and deflate.c (Andreas Kleinert)
 254.874 +- use const for the CRC table (Ken Raeburn)
 254.875 +- fixed "make uninstall" for shared libraries
 254.876 +- use Tracev instead of Trace in infblock.c
 254.877 +- in example.c use correct compressed length for test_sync
 254.878 +- suppress +vnocompatwarnings in configure for HPUX (not always supported)
 254.879 +
 254.880 +Changes in 1.0.7 (20 Jan 1998)
 254.881 +- fix gzseek which was broken in write mode
 254.882 +- return error for gzseek to negative absolute position
 254.883 +- fix configure for Linux (Chun-Chung Chen)
 254.884 +- increase stack space for MSC (Tim Wegner)
 254.885 +- get_crc_table and inflateSyncPoint are EXPORTed (Gilles Vollant)
 254.886 +- define EXPORTVA for gzprintf (Gilles Vollant)
 254.887 +- added man page zlib.3 (Rick Rodgers)
 254.888 +- for contrib/untgz, fix makedir() and improve Makefile
 254.889 +
 254.890 +- check gzseek in write mode in example.c
 254.891 +- allocate extra buffer for seeks only if gzseek is actually called
 254.892 +- avoid signed/unsigned comparisons (Tim Wegner, Gilles Vollant)
 254.893 +- add inflateSyncPoint in zconf.h
 254.894 +- fix list of exported functions in nt/zlib.dnt and mdsos/zlib.def
 254.895 +
 254.896 +Changes in 1.0.6 (19 Jan 1998)
 254.897 +- add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and
 254.898 +  gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code)
 254.899 +- Fix a deflate bug occurring only with compression level 0 (thanks to
 254.900 +  Andy Buckler for finding this one).
 254.901 +- In minigzip, pass transparently also the first byte for .Z files.
 254.902 +- return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress()
 254.903 +- check Z_FINISH in inflate (thanks to Marc Schluper)
 254.904 +- Implement deflateCopy (thanks to Adam Costello)
 254.905 +- make static libraries by default in configure, add --shared option.
 254.906 +- move MSDOS or Windows specific files to directory msdos
 254.907 +- suppress the notion of partial flush to simplify the interface
 254.908 +  (but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4)
 254.909 +- suppress history buffer provided by application to simplify the interface
 254.910 +  (this feature was not implemented anyway in 1.0.4)
 254.911 +- next_in and avail_in must be initialized before calling inflateInit or
 254.912 +  inflateInit2
 254.913 +- add EXPORT in all exported functions (for Windows DLL)
 254.914 +- added Makefile.nt (thanks to Stephen Williams)
 254.915 +- added the unsupported "contrib" directory:
 254.916 +   contrib/asm386/ by Gilles Vollant <info@winimage.com>
 254.917 +        386 asm code replacing longest_match().
 254.918 +   contrib/iostream/ by Kevin Ruland <kevin@rodin.wustl.edu>
 254.919 +        A C++ I/O streams interface to the zlib gz* functions
 254.920 +   contrib/iostream2/  by Tyge Løvset <Tyge.Lovset@cmr.no>
 254.921 +        Another C++ I/O streams interface
 254.922 +   contrib/untgz/  by "Pedro A. Aranda Guti\irrez" <paag@tid.es>
 254.923 +        A very simple tar.gz file extractor using zlib
 254.924 +   contrib/visual-basic.txt by Carlos Rios <c_rios@sonda.cl>
 254.925 +        How to use compress(), uncompress() and the gz* functions from VB.
 254.926 +- pass params -f (filtered data), -h (huffman only), -1 to -9 (compression
 254.927 +  level) in minigzip (thanks to Tom Lane)
 254.928 +
 254.929 +- use const for rommable constants in deflate
 254.930 +- added test for gzseek and gztell in example.c
 254.931 +- add undocumented function inflateSyncPoint() (hack for Paul Mackerras)
 254.932 +- add undocumented function zError to convert error code to string
 254.933 +  (for Tim Smithers)
 254.934 +- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code.
 254.935 +- Use default memcpy for Symantec MSDOS compiler.
 254.936 +- Add EXPORT keyword for check_func (needed for Windows DLL)
 254.937 +- add current directory to LD_LIBRARY_PATH for "make test"
 254.938 +- create also a link for libz.so.1
 254.939 +- added support for FUJITSU UXP/DS (thanks to Toshiaki Nomura)
 254.940 +- use $(SHAREDLIB) instead of libz.so in Makefile.in (for HPUX)
 254.941 +- added -soname for Linux in configure (Chun-Chung Chen,
 254.942 +- assign numbers to the exported functions in zlib.def (for Windows DLL)
 254.943 +- add advice in zlib.h for best usage of deflateSetDictionary
 254.944 +- work around compiler bug on Atari (cast Z_NULL in call of s->checkfn)
 254.945 +- allow compilation with ANSI keywords only enabled for TurboC in large model
 254.946 +- avoid "versionString"[0] (Borland bug)
 254.947 +- add NEED_DUMMY_RETURN for Borland
 254.948 +- use variable z_verbose for tracing in debug mode (L. Peter Deutsch).
 254.949 +- allow compilation with CC
 254.950 +- defined STDC for OS/2 (David Charlap)
 254.951 +- limit external names to 8 chars for MVS (Thomas Lund)
 254.952 +- in minigzip.c, use static buffers only for 16-bit systems
 254.953 +- fix suffix check for "minigzip -d foo.gz"
 254.954 +- do not return an error for the 2nd of two consecutive gzflush() (Felix Lee)
 254.955 +- use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau)
 254.956 +- added makelcc.bat for lcc-win32 (Tom St Denis)
 254.957 +- in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe)
 254.958 +- Avoid expanded $Id$. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion.
 254.959 +- check for unistd.h in configure (for off_t)
 254.960 +- remove useless check parameter in inflate_blocks_free
 254.961 +- avoid useless assignment of s->check to itself in inflate_blocks_new
 254.962 +- do not flush twice in gzclose (thanks to Ken Raeburn)
 254.963 +- rename FOPEN as F_OPEN to avoid clash with /usr/include/sys/file.h
 254.964 +- use NO_ERRNO_H instead of enumeration of operating systems with errno.h
 254.965 +- work around buggy fclose on pipes for HP/UX
 254.966 +- support zlib DLL with BORLAND C++ 5.0 (thanks to Glenn Randers-Pehrson)
 254.967 +- fix configure if CC is already equal to gcc
 254.968 +
 254.969 +Changes in 1.0.5 (3 Jan 98)
 254.970 +- Fix inflate to terminate gracefully when fed corrupted or invalid data
 254.971 +- Use const for rommable constants in inflate
 254.972 +- Eliminate memory leaks on error conditions in inflate
 254.973 +- Removed some vestigial code in inflate
 254.974 +- Update web address in README
 254.975 +
 254.976 +Changes in 1.0.4 (24 Jul 96)
 254.977 +- In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF
 254.978 +  bit, so the decompressor could decompress all the correct data but went
 254.979 +  on to attempt decompressing extra garbage data. This affected minigzip too.
 254.980 +- zlibVersion and gzerror return const char* (needed for DLL)
 254.981 +- port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno)
 254.982 +- use z_error only for DEBUG (avoid problem with DLLs)
 254.983 +
 254.984 +Changes in 1.0.3 (2 Jul 96)
 254.985 +- use z_streamp instead of z_stream *, which is now a far pointer in MSDOS
 254.986 +  small and medium models; this makes the library incompatible with previous
 254.987 +  versions for these models. (No effect in large model or on other systems.)
 254.988 +- return OK instead of BUF_ERROR if previous deflate call returned with
 254.989 +  avail_out as zero but there is nothing to do
 254.990 +- added memcmp for non STDC compilers
 254.991 +- define NO_DUMMY_DECL for more Mac compilers (.h files merged incorrectly)
 254.992 +- define __32BIT__ if __386__ or i386 is defined (pb. with Watcom and SCO)
 254.993 +- better check for 16-bit mode MSC (avoids problem with Symantec)
 254.994 +
 254.995 +Changes in 1.0.2 (23 May 96)
 254.996 +- added Windows DLL support
 254.997 +- added a function zlibVersion (for the DLL support)
 254.998 +- fixed declarations using Bytef in infutil.c (pb with MSDOS medium model)
 254.999 +- Bytef is define's instead of typedef'd only for Borland C
254.1000 +- avoid reading uninitialized memory in example.c
254.1001 +- mention in README that the zlib format is now RFC1950
254.1002 +- updated Makefile.dj2
254.1003 +- added algorithm.doc
254.1004 +
254.1005 +Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion]
254.1006 +- fix array overlay in deflate.c which sometimes caused bad compressed data
254.1007 +- fix inflate bug with empty stored block
254.1008 +- fix MSDOS medium model which was broken in 0.99
254.1009 +- fix deflateParams() which could generated bad compressed data.
254.1010 +- Bytef is define'd instead of typedef'ed (work around Borland bug)
254.1011 +- added an INDEX file
254.1012 +- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32),
254.1013 +  Watcom (Makefile.wat), Amiga SAS/C (Makefile.sas)
254.1014 +- speed up adler32 for modern machines without auto-increment
254.1015 +- added -ansi for IRIX in configure
254.1016 +- static_init_done in trees.c is an int
254.1017 +- define unlink as delete for VMS
254.1018 +- fix configure for QNX
254.1019 +- add configure branch for SCO and HPUX
254.1020 +- avoid many warnings (unused variables, dead assignments, etc...)
254.1021 +- no fdopen for BeOS
254.1022 +- fix the Watcom fix for 32 bit mode (define FAR as empty)
254.1023 +- removed redefinition of Byte for MKWERKS
254.1024 +- work around an MWKERKS bug (incorrect merge of all .h files)
254.1025 +
254.1026 +Changes in 0.99 (27 Jan 96)
254.1027 +- allow preset dictionary shared between compressor and decompressor
254.1028 +- allow compression level 0 (no compression)
254.1029 +- add deflateParams in zlib.h: allow dynamic change of compression level
254.1030 +  and compression strategy.
254.1031 +- test large buffers and deflateParams in example.c
254.1032 +- add optional "configure" to build zlib as a shared library
254.1033 +- suppress Makefile.qnx, use configure instead
254.1034 +- fixed deflate for 64-bit systems (detected on Cray)
254.1035 +- fixed inflate_blocks for 64-bit systems (detected on Alpha)
254.1036 +- declare Z_DEFLATED in zlib.h (possible parameter for deflateInit2)
254.1037 +- always return Z_BUF_ERROR when deflate() has nothing to do
254.1038 +- deflateInit and inflateInit are now macros to allow version checking
254.1039 +- prefix all global functions and types with z_ with -DZ_PREFIX
254.1040 +- make falloc completely reentrant (inftrees.c)
254.1041 +- fixed very unlikely race condition in ct_static_init
254.1042 +- free in reverse order of allocation to help memory manager
254.1043 +- use zlib-1.0/* instead of zlib/* inside the tar.gz
254.1044 +- make zlib warning-free with "gcc -O3 -Wall -Wwrite-strings -Wpointer-arith
254.1045 +  -Wconversion -Wstrict-prototypes -Wmissing-prototypes"
254.1046 +- allow gzread on concatenated .gz files
254.1047 +- deflateEnd now returns Z_DATA_ERROR if it was premature
254.1048 +- deflate is finally (?) fully deterministic (no matches beyond end of input)
254.1049 +- Document Z_SYNC_FLUSH
254.1050 +- add uninstall in Makefile
254.1051 +- Check for __cpluplus in zlib.h
254.1052 +- Better test in ct_align for partial flush
254.1053 +- avoid harmless warnings for Borland C++
254.1054 +- initialize hash_head in deflate.c
254.1055 +- avoid warning on fdopen (gzio.c) for HP cc -Aa
254.1056 +- include stdlib.h for STDC compilers
254.1057 +- include errno.h for Cray
254.1058 +- ignore error if ranlib doesn't exist
254.1059 +- call ranlib twice for NeXTSTEP
254.1060 +- use exec_prefix instead of prefix for libz.a
254.1061 +- renamed ct_* as _tr_* to avoid conflict with applications
254.1062 +- clear z->msg in inflateInit2 before any error return
254.1063 +- initialize opaque in example.c, gzio.c, deflate.c and inflate.c
254.1064 +- fixed typo in zconf.h (_GNUC__ => __GNUC__)
254.1065 +- check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode)
254.1066 +- fix typo in Make_vms.com (f$trnlnm -> f$getsyi)
254.1067 +- in fcalloc, normalize pointer if size > 65520 bytes
254.1068 +- don't use special fcalloc for 32 bit Borland C++
254.1069 +- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc...
254.1070 +- use Z_BINARY instead of BINARY
254.1071 +- document that gzclose after gzdopen will close the file
254.1072 +- allow "a" as mode in gzopen.
254.1073 +- fix error checking in gzread
254.1074 +- allow skipping .gz extra-field on pipes
254.1075 +- added reference to Perl interface in README
254.1076 +- put the crc table in FAR data (I dislike more and more the medium model :)
254.1077 +- added get_crc_table
254.1078 +- added a dimension to all arrays (Borland C can't count).
254.1079 +- workaround Borland C bug in declaration of inflate_codes_new & inflate_fast
254.1080 +- guard against multiple inclusion of *.h (for precompiled header on Mac)
254.1081 +- Watcom C pretends to be Microsoft C small model even in 32 bit mode.
254.1082 +- don't use unsized arrays to avoid silly warnings by Visual C++:
254.1083 +     warning C4746: 'inflate_mask' : unsized array treated as  '__far'
254.1084 +     (what's wrong with far data in far model?).
254.1085 +- define enum out of inflate_blocks_state to allow compilation with C++
254.1086 +
254.1087 +Changes in 0.95 (16 Aug 95)
254.1088 +- fix MSDOS small and medium model (now easier to adapt to any compiler)
254.1089 +- inlined send_bits
254.1090 +- fix the final (:-) bug for deflate with flush (output was correct but
254.1091 +  not completely flushed in rare occasions).
254.1092 +- default window size is same for compression and decompression
254.1093 +  (it's now sufficient to set MAX_WBITS in zconf.h).
254.1094 +- voidp -> voidpf and voidnp -> voidp (for consistency with other
254.1095 +  typedefs and because voidnp was not near in large model).
254.1096 +
254.1097 +Changes in 0.94 (13 Aug 95)
254.1098 +- support MSDOS medium model
254.1099 +- fix deflate with flush (could sometimes generate bad output)
254.1100 +- fix deflateReset (zlib header was incorrectly suppressed)
254.1101 +- added support for VMS
254.1102 +- allow a compression level in gzopen()
254.1103 +- gzflush now calls fflush
254.1104 +- For deflate with flush, flush even if no more input is provided.
254.1105 +- rename libgz.a as libz.a
254.1106 +- avoid complex expression in infcodes.c triggering Turbo C bug
254.1107 +- work around a problem with gcc on Alpha (in INSERT_STRING)
254.1108 +- don't use inline functions (problem with some gcc versions)
254.1109 +- allow renaming of Byte, uInt, etc... with #define.
254.1110 +- avoid warning about (unused) pointer before start of array in deflate.c
254.1111 +- avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c
254.1112 +- avoid reserved word 'new' in trees.c
254.1113 +
254.1114 +Changes in 0.93 (25 June 95)
254.1115 +- temporarily disable inline functions
254.1116 +- make deflate deterministic
254.1117 +- give enough lookahead for PARTIAL_FLUSH
254.1118 +- Set binary mode for stdin/stdout in minigzip.c for OS/2
254.1119 +- don't even use signed char in inflate (not portable enough)
254.1120 +- fix inflate memory leak for segmented architectures
254.1121 +
254.1122 +Changes in 0.92 (3 May 95)
254.1123 +- don't assume that char is signed (problem on SGI)
254.1124 +- Clear bit buffer when starting a stored block
254.1125 +- no memcpy on Pyramid
254.1126 +- suppressed inftest.c
254.1127 +- optimized fill_window, put longest_match inline for gcc
254.1128 +- optimized inflate on stored blocks.
254.1129 +- untabify all sources to simplify patches
254.1130 +
254.1131 +Changes in 0.91 (2 May 95)
254.1132 +- Default MEM_LEVEL is 8 (not 9 for Unix) as documented in zlib.h
254.1133 +- Document the memory requirements in zconf.h
254.1134 +- added "make install"
254.1135 +- fix sync search logic in inflateSync
254.1136 +- deflate(Z_FULL_FLUSH) now works even if output buffer too short
254.1137 +- after inflateSync, don't scare people with just "lo world"
254.1138 +- added support for DJGPP
254.1139 +
254.1140 +Changes in 0.9 (1 May 95)
254.1141 +- don't assume that zalloc clears the allocated memory (the TurboC bug
254.1142 +  was Mark's bug after all :)
254.1143 +- let again gzread copy uncompressed data unchanged (was working in 0.71)
254.1144 +- deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented
254.1145 +- added a test of inflateSync in example.c
254.1146 +- moved MAX_WBITS to zconf.h because users might want to change that.
254.1147 +- document explicitly that zalloc(64K) on MSDOS must return a normalized
254.1148 +  pointer (zero offset)
254.1149 +- added Makefiles for Microsoft C, Turbo C, Borland C++
254.1150 +- faster crc32()
254.1151 +
254.1152 +Changes in 0.8 (29 April 95)
254.1153 +- added fast inflate (inffast.c)
254.1154 +- deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this
254.1155 +  is incompatible with previous versions of zlib which returned Z_OK.
254.1156 +- work around a TurboC compiler bug (bad code for b << 0, see infutil.h)
254.1157 +  (actually that was not a compiler bug, see 0.81 above)
254.1158 +- gzread no longer reads one extra byte in certain cases
254.1159 +- In gzio destroy(), don't reference a freed structure
254.1160 +- avoid many warnings for MSDOS
254.1161 +- avoid the ERROR symbol which is used by MS Windows
254.1162 +
254.1163 +Changes in 0.71 (14 April 95)
254.1164 +- Fixed more MSDOS compilation problems :( There is still a bug with
254.1165 +  TurboC large model.
254.1166 +
254.1167 +Changes in 0.7 (14 April 95)
254.1168 +- Added full inflate support.
254.1169 +- Simplified the crc32() interface. The pre- and post-conditioning
254.1170 +  (one's complement) is now done inside crc32(). WARNING: this is
254.1171 +  incompatible with previous versions; see zlib.h for the new usage.
254.1172 +
254.1173 +Changes in 0.61 (12 April 95)
254.1174 +- workaround for a bug in TurboC. example and minigzip now work on MSDOS.
254.1175 +
254.1176 +Changes in 0.6 (11 April 95)
254.1177 +- added minigzip.c
254.1178 +- added gzdopen to reopen a file descriptor as gzFile
254.1179 +- added transparent reading of non-gziped files in gzread.
254.1180 +- fixed bug in gzread (don't read crc as data)
254.1181 +- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose).
254.1182 +- don't allocate big arrays in the stack (for MSDOS)
254.1183 +- fix some MSDOS compilation problems
254.1184 +
254.1185 +Changes in 0.5:
254.1186 +- do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but
254.1187 +  not yet Z_FULL_FLUSH.
254.1188 +- support decompression but only in a single step (forced Z_FINISH)
254.1189 +- added opaque object for zalloc and zfree.
254.1190 +- added deflateReset and inflateReset
254.1191 +- added a variable zlib_version for consistency checking.
254.1192 +- renamed the 'filter' parameter of deflateInit2 as 'strategy'.
254.1193 +  Added Z_FILTERED and Z_HUFFMAN_ONLY constants.
254.1194 +
254.1195 +Changes in 0.4:
254.1196 +- avoid "zip" everywhere, use zlib instead of ziplib.
254.1197 +- suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush
254.1198 +  if compression method == 8.
254.1199 +- added adler32 and crc32
254.1200 +- renamed deflateOptions as deflateInit2, call one or the other but not both
254.1201 +- added the method parameter for deflateInit2.
254.1202 +- added inflateInit2
254.1203 +- simplied considerably deflateInit and inflateInit by not supporting
254.1204 +  user-provided history buffer. This is supported only in deflateInit2
254.1205 +  and inflateInit2.
254.1206 +
254.1207 +Changes in 0.3:
254.1208 +- prefix all macro names with Z_
254.1209 +- use Z_FINISH instead of deflateEnd to finish compression.
254.1210 +- added Z_HUFFMAN_ONLY
254.1211 +- added gzerror()
   255.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   255.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/README	Mon Dec 19 10:06:23 2011 -0800
   255.3 @@ -0,0 +1,115 @@
   255.4 +ZLIB DATA COMPRESSION LIBRARY
   255.5 +
   255.6 +zlib 1.2.5 is a general purpose data compression library.  All the code is
   255.7 +thread safe.  The data format used by the zlib library is described by RFCs
   255.8 +(Request for Comments) 1950 to 1952 in the files
   255.9 +http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format)
  255.10 +and rfc1952.txt (gzip format).
  255.11 +
  255.12 +All functions of the compression library are documented in the file zlib.h
  255.13 +(volunteer to write man pages welcome, contact zlib@gzip.org).  A usage example
  255.14 +of the library is given in the file example.c which also tests that the library
  255.15 +is working correctly.  Another example is given in the file minigzip.c.  The
  255.16 +compression library itself is composed of all source files except example.c and
  255.17 +minigzip.c.
  255.18 +
  255.19 +To compile all files and run the test program, follow the instructions given at
  255.20 +the top of Makefile.in.  In short "./configure; make test", and if that goes
  255.21 +well, "make install" should work for most flavors of Unix.  For Windows, use one
  255.22 +of the special makefiles in win32/ or contrib/vstudio/ .  For VMS, use
  255.23 +make_vms.com.
  255.24 +
  255.25 +Questions about zlib should be sent to <zlib@gzip.org>, or to Gilles Vollant
  255.26 +<info@winimage.com> for the Windows DLL version.  The zlib home page is
  255.27 +http://zlib.net/ .  Before reporting a problem, please check this site to
  255.28 +verify that you have the latest version of zlib; otherwise get the latest
  255.29 +version and check whether the problem still exists or not.
  255.30 +
  255.31 +PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help.
  255.32 +
  255.33 +Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan.  1997
  255.34 +issue of Dr.  Dobb's Journal; a copy of the article is available at
  255.35 +http://marknelson.us/1997/01/01/zlib-engine/ .
  255.36 +
  255.37 +The changes made in version 1.2.5 are documented in the file ChangeLog.
  255.38 +
  255.39 +Unsupported third party contributions are provided in directory contrib/ .
  255.40 +
  255.41 +zlib is available in Java using the java.util.zip package, documented at
  255.42 +http://java.sun.com/developer/technicalArticles/Programming/compression/ .
  255.43 +
  255.44 +A Perl interface to zlib written by Paul Marquess <pmqs@cpan.org> is available
  255.45 +at CPAN (Comprehensive Perl Archive Network) sites, including
  255.46 +http://search.cpan.org/~pmqs/IO-Compress-Zlib/ .
  255.47 +
  255.48 +A Python interface to zlib written by A.M. Kuchling <amk@amk.ca> is
  255.49 +available in Python 1.5 and later versions, see
  255.50 +http://www.python.org/doc/lib/module-zlib.html .
  255.51 +
  255.52 +zlib is built into tcl: http://wiki.tcl.tk/4610 .
  255.53 +
  255.54 +An experimental package to read and write files in .zip format, written on top
  255.55 +of zlib by Gilles Vollant <info@winimage.com>, is available in the
  255.56 +contrib/minizip directory of zlib.
  255.57 +
  255.58 +
  255.59 +Notes for some targets:
  255.60 +
  255.61 +- For Windows DLL versions, please see win32/DLL_FAQ.txt
  255.62 +
  255.63 +- For 64-bit Irix, deflate.c must be compiled without any optimization. With
  255.64 +  -O, one libpng test fails. The test works in 32 bit mode (with the -n32
  255.65 +  compiler flag). The compiler bug has been reported to SGI.
  255.66 +
  255.67 +- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
  255.68 +  when compiled with cc.
  255.69 +
  255.70 +- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is
  255.71 +  necessary to get gzprintf working correctly. This is done by configure.
  255.72 +
  255.73 +- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
  255.74 +  other compilers. Use "make test" to check your compiler.
  255.75 +
  255.76 +- gzdopen is not supported on RISCOS or BEOS.
  255.77 +
  255.78 +- For PalmOs, see http://palmzlib.sourceforge.net/
  255.79 +
  255.80 +
  255.81 +Acknowledgments:
  255.82 +
  255.83 +  The deflate format used by zlib was defined by Phil Katz.  The deflate and
  255.84 +  zlib specifications were written by L.  Peter Deutsch.  Thanks to all the
  255.85 +  people who reported problems and suggested various improvements in zlib; they
  255.86 +  are too numerous to cite here.
  255.87 +
  255.88 +Copyright notice:
  255.89 +
  255.90 + (C) 1995-2010 Jean-loup Gailly and Mark Adler
  255.91 +
  255.92 +  This software is provided 'as-is', without any express or implied
  255.93 +  warranty.  In no event will the authors be held liable for any damages
  255.94 +  arising from the use of this software.
  255.95 +
  255.96 +  Permission is granted to anyone to use this software for any purpose,
  255.97 +  including commercial applications, and to alter it and redistribute it
  255.98 +  freely, subject to the following restrictions:
  255.99 +
 255.100 +  1. The origin of this software must not be misrepresented; you must not
 255.101 +     claim that you wrote the original software. If you use this software
 255.102 +     in a product, an acknowledgment in the product documentation would be
 255.103 +     appreciated but is not required.
 255.104 +  2. Altered source versions must be plainly marked as such, and must not be
 255.105 +     misrepresented as being the original software.
 255.106 +  3. This notice may not be removed or altered from any source distribution.
 255.107 +
 255.108 +  Jean-loup Gailly        Mark Adler
 255.109 +  jloup@gzip.org          madler@alumni.caltech.edu
 255.110 +
 255.111 +If you use the zlib library in a product, we would appreciate *not* receiving
 255.112 +lengthy legal documents to sign.  The sources are provided for free but without
 255.113 +warranty of any kind.  The library has been entirely written by Jean-loup
 255.114 +Gailly and Mark Adler; it does not include third-party code.
 255.115 +
 255.116 +If you redistribute modified sources, we would appreciate that you include in
 255.117 +the file ChangeLog history information documenting your changes.  Please read
 255.118 +the FAQ for more information on the distribution of modified source versions.
   256.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   256.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/compress.c	Mon Dec 19 10:06:23 2011 -0800
   256.3 @@ -0,0 +1,104 @@
   256.4 +/*
   256.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   256.6 + *
   256.7 + * This code is free software; you can redistribute it and/or modify it
   256.8 + * under the terms of the GNU General Public License version 2 only, as
   256.9 + * published by the Free Software Foundation.  Oracle designates this
  256.10 + * particular file as subject to the "Classpath" exception as provided
  256.11 + * by Oracle in the LICENSE file that accompanied this code.
  256.12 + *
  256.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
  256.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  256.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  256.16 + * version 2 for more details (a copy is included in the LICENSE file that
  256.17 + * accompanied this code).
  256.18 + *
  256.19 + * You should have received a copy of the GNU General Public License version
  256.20 + * 2 along with this work; if not, write to the Free Software Foundation,
  256.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  256.22 + *
  256.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  256.24 + * or visit www.oracle.com if you need additional information or have any
  256.25 + * questions.
  256.26 + */
  256.27 +
  256.28 +/* compress.c -- compress a memory buffer
  256.29 + * Copyright (C) 1995-2005 Jean-loup Gailly.
  256.30 + * For conditions of distribution and use, see copyright notice in zlib.h
  256.31 + */
  256.32 +
  256.33 +/* @(#) $Id$ */
  256.34 +
  256.35 +#define ZLIB_INTERNAL
  256.36 +#include "zlib.h"
  256.37 +
  256.38 +/* ===========================================================================
  256.39 +     Compresses the source buffer into the destination buffer. The level
  256.40 +   parameter has the same meaning as in deflateInit.  sourceLen is the byte
  256.41 +   length of the source buffer. Upon entry, destLen is the total size of the
  256.42 +   destination buffer, which must be at least 0.1% larger than sourceLen plus
  256.43 +   12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
  256.44 +
  256.45 +     compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
  256.46 +   memory, Z_BUF_ERROR if there was not enough room in the output buffer,
  256.47 +   Z_STREAM_ERROR if the level parameter is invalid.
  256.48 +*/
  256.49 +int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
  256.50 +    Bytef *dest;
  256.51 +    uLongf *destLen;
  256.52 +    const Bytef *source;
  256.53 +    uLong sourceLen;
  256.54 +    int level;
  256.55 +{
  256.56 +    z_stream stream;
  256.57 +    int err;
  256.58 +
  256.59 +    stream.next_in = (Bytef*)source;
  256.60 +    stream.avail_in = (uInt)sourceLen;
  256.61 +#ifdef MAXSEG_64K
  256.62 +    /* Check for source > 64K on 16-bit machine: */
  256.63 +    if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
  256.64 +#endif
  256.65 +    stream.next_out = dest;
  256.66 +    stream.avail_out = (uInt)*destLen;
  256.67 +    if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
  256.68 +
  256.69 +    stream.zalloc = (alloc_func)0;
  256.70 +    stream.zfree = (free_func)0;
  256.71 +    stream.opaque = (voidpf)0;
  256.72 +
  256.73 +    err = deflateInit(&stream, level);
  256.74 +    if (err != Z_OK) return err;
  256.75 +
  256.76 +    err = deflate(&stream, Z_FINISH);
  256.77 +    if (err != Z_STREAM_END) {
  256.78 +        deflateEnd(&stream);
  256.79 +        return err == Z_OK ? Z_BUF_ERROR : err;
  256.80 +    }
  256.81 +    *destLen = (uLong)stream.total_out;
  256.82 +
  256.83 +    err = deflateEnd(&stream);
  256.84 +    return err;
  256.85 +}
  256.86 +
  256.87 +/* ===========================================================================
  256.88 + */
  256.89 +int ZEXPORT compress (dest, destLen, source, sourceLen)
  256.90 +    Bytef *dest;
  256.91 +    uLongf *destLen;
  256.92 +    const Bytef *source;
  256.93 +    uLong sourceLen;
  256.94 +{
  256.95 +    return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
  256.96 +}
  256.97 +
  256.98 +/* ===========================================================================
  256.99 +     If the default memLevel or windowBits for deflateInit() is changed, then
 256.100 +   this function needs to be updated.
 256.101 + */
 256.102 +uLong ZEXPORT compressBound (sourceLen)
 256.103 +    uLong sourceLen;
 256.104 +{
 256.105 +    return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
 256.106 +           (sourceLen >> 25) + 13;
 256.107 +}
   257.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   257.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/crc32.h	Mon Dec 19 10:06:23 2011 -0800
   257.3 @@ -0,0 +1,465 @@
   257.4 +/*
   257.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   257.6 + *
   257.7 + * This code is free software; you can redistribute it and/or modify it
   257.8 + * under the terms of the GNU General Public License version 2 only, as
   257.9 + * published by the Free Software Foundation.  Oracle designates this
  257.10 + * particular file as subject to the "Classpath" exception as provided
  257.11 + * by Oracle in the LICENSE file that accompanied this code.
  257.12 + *
  257.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
  257.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  257.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  257.16 + * version 2 for more details (a copy is included in the LICENSE file that
  257.17 + * accompanied this code).
  257.18 + *
  257.19 + * You should have received a copy of the GNU General Public License version
  257.20 + * 2 along with this work; if not, write to the Free Software Foundation,
  257.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  257.22 + *
  257.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  257.24 + * or visit www.oracle.com if you need additional information or have any
  257.25 + * questions.
  257.26 + */
  257.27 +
  257.28 +/* crc32.h -- tables for rapid CRC calculation
  257.29 + * Generated automatically by crc32.c
  257.30 + */
  257.31 +
  257.32 +local const unsigned long FAR crc_table[TBLS][256] =
  257.33 +{
  257.34 +  {
  257.35 +    0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
  257.36 +    0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL,
  257.37 +    0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL,
  257.38 +    0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL,
  257.39 +    0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL,
  257.40 +    0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL,
  257.41 +    0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL,
  257.42 +    0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL,
  257.43 +    0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL,
  257.44 +    0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL,
  257.45 +    0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL,
  257.46 +    0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL,
  257.47 +    0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL,
  257.48 +    0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL,
  257.49 +    0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL,
  257.50 +    0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL,
  257.51 +    0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL,
  257.52 +    0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL,
  257.53 +    0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL,
  257.54 +    0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL,
  257.55 +    0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL,
  257.56 +    0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL,
  257.57 +    0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL,
  257.58 +    0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL,
  257.59 +    0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL,
  257.60 +    0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL,
  257.61 +    0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL,
  257.62 +    0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL,
  257.63 +    0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL,
  257.64 +    0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL,
  257.65 +    0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL,
  257.66 +    0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL,
  257.67 +    0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL,
  257.68 +    0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL,
  257.69 +    0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL,
  257.70 +    0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL,
  257.71 +    0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL,
  257.72 +    0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL,
  257.73 +    0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL,
  257.74 +    0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL,
  257.75 +    0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL,
  257.76 +    0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL,
  257.77 +    0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL,
  257.78 +    0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL,
  257.79 +    0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL,
  257.80 +    0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL,
  257.81 +    0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL,
  257.82 +    0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL,
  257.83 +    0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL,
  257.84 +    0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL,
  257.85 +    0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL,
  257.86 +    0x2d02ef8dUL
  257.87 +#ifdef BYFOUR
  257.88 +  },
  257.89 +  {
  257.90 +    0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL,
  257.91 +    0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL,
  257.92 +    0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL,
  257.93 +    0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL,
  257.94 +    0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL,
  257.95 +    0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL,
  257.96 +    0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL,
  257.97 +    0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL,
  257.98 +    0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL,
  257.99 +    0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL,
 257.100 +    0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL,
 257.101 +    0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL,
 257.102 +    0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL,
 257.103 +    0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL,
 257.104 +    0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL,
 257.105 +    0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL,
 257.106 +    0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL,
 257.107 +    0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL,
 257.108 +    0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL,
 257.109 +    0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL,
 257.110 +    0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL,
 257.111 +    0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL,
 257.112 +    0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL,
 257.113 +    0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL,
 257.114 +    0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL,
 257.115 +    0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL,
 257.116 +    0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL,
 257.117 +    0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL,
 257.118 +    0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL,
 257.119 +    0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL,
 257.120 +    0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL,
 257.121 +    0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL,
 257.122 +    0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL,
 257.123 +    0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL,
 257.124 +    0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL,
 257.125 +    0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL,
 257.126 +    0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL,
 257.127 +    0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL,
 257.128 +    0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL,
 257.129 +    0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL,
 257.130 +    0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL,
 257.131 +    0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL,
 257.132 +    0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL,
 257.133 +    0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL,
 257.134 +    0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL,
 257.135 +    0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL,
 257.136 +    0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL,
 257.137 +    0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL,
 257.138 +    0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL,
 257.139 +    0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL,
 257.140 +    0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL,
 257.141 +    0x9324fd72UL
 257.142 +  },
 257.143 +  {
 257.144 +    0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL,
 257.145 +    0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL,
 257.146 +    0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL,
 257.147 +    0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL,
 257.148 +    0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL,
 257.149 +    0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL,
 257.150 +    0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL,
 257.151 +    0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL,
 257.152 +    0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL,
 257.153 +    0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL,
 257.154 +    0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL,
 257.155 +    0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL,
 257.156 +    0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL,
 257.157 +    0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL,
 257.158 +    0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL,
 257.159 +    0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL,
 257.160 +    0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL,
 257.161 +    0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL,
 257.162 +    0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL,
 257.163 +    0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL,
 257.164 +    0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL,
 257.165 +    0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL,
 257.166 +    0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL,
 257.167 +    0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL,
 257.168 +    0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL,
 257.169 +    0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL,
 257.170 +    0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL,
 257.171 +    0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL,
 257.172 +    0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL,
 257.173 +    0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL,
 257.174 +    0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL,
 257.175 +    0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL,
 257.176 +    0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL,
 257.177 +    0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL,
 257.178 +    0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL,
 257.179 +    0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL,
 257.180 +    0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL,
 257.181 +    0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL,
 257.182 +    0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL,
 257.183 +    0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL,
 257.184 +    0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL,
 257.185 +    0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL,
 257.186 +    0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL,
 257.187 +    0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL,
 257.188 +    0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL,
 257.189 +    0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL,
 257.190 +    0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL,
 257.191 +    0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL,
 257.192 +    0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL,
 257.193 +    0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL,
 257.194 +    0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL,
 257.195 +    0xbe9834edUL
 257.196 +  },
 257.197 +  {
 257.198 +    0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL,
 257.199 +    0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL,
 257.200 +    0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL,
 257.201 +    0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL,
 257.202 +    0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL,
 257.203 +    0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL,
 257.204 +    0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL,
 257.205 +    0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL,
 257.206 +    0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL,
 257.207 +    0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL,
 257.208 +    0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL,
 257.209 +    0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL,
 257.210 +    0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL,
 257.211 +    0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL,
 257.212 +    0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL,
 257.213 +    0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL,
 257.214 +    0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL,
 257.215 +    0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL,
 257.216 +    0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL,
 257.217 +    0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL,
 257.218 +    0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL,
 257.219 +    0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL,
 257.220 +    0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL,
 257.221 +    0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL,
 257.222 +    0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL,
 257.223 +    0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL,
 257.224 +    0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL,
 257.225 +    0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL,
 257.226 +    0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL,
 257.227 +    0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL,
 257.228 +    0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL,
 257.229 +    0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL,
 257.230 +    0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL,
 257.231 +    0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL,
 257.232 +    0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL,
 257.233 +    0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL,
 257.234 +    0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL,
 257.235 +    0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL,
 257.236 +    0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL,
 257.237 +    0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL,
 257.238 +    0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL,
 257.239 +    0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL,
 257.240 +    0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL,
 257.241 +    0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL,
 257.242 +    0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL,
 257.243 +    0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL,
 257.244 +    0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL,
 257.245 +    0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL,
 257.246 +    0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL,
 257.247 +    0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL,
 257.248 +    0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL,
 257.249 +    0xde0506f1UL
 257.250 +  },
 257.251 +  {
 257.252 +    0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL,
 257.253 +    0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL,
 257.254 +    0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL,
 257.255 +    0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL,
 257.256 +    0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL,
 257.257 +    0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL,
 257.258 +    0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL,
 257.259 +    0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL,
 257.260 +    0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL,
 257.261 +    0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL,
 257.262 +    0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL,
 257.263 +    0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL,
 257.264 +    0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL,
 257.265 +    0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL,
 257.266 +    0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL,
 257.267 +    0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL,
 257.268 +    0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL,
 257.269 +    0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL,
 257.270 +    0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL,
 257.271 +    0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL,
 257.272 +    0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL,
 257.273 +    0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL,
 257.274 +    0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL,
 257.275 +    0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL,
 257.276 +    0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL,
 257.277 +    0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL,
 257.278 +    0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL,
 257.279 +    0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL,
 257.280 +    0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL,
 257.281 +    0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL,
 257.282 +    0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL,
 257.283 +    0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL,
 257.284 +    0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL,
 257.285 +    0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL,
 257.286 +    0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL,
 257.287 +    0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL,
 257.288 +    0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL,
 257.289 +    0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL,
 257.290 +    0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL,
 257.291 +    0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL,
 257.292 +    0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL,
 257.293 +    0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL,
 257.294 +    0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL,
 257.295 +    0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL,
 257.296 +    0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL,
 257.297 +    0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL,
 257.298 +    0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL,
 257.299 +    0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL,
 257.300 +    0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL,
 257.301 +    0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL,
 257.302 +    0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL,
 257.303 +    0x8def022dUL
 257.304 +  },
 257.305 +  {
 257.306 +    0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL,
 257.307 +    0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL,
 257.308 +    0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL,
 257.309 +    0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL,
 257.310 +    0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL,
 257.311 +    0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL,
 257.312 +    0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL,
 257.313 +    0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL,
 257.314 +    0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL,
 257.315 +    0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL,
 257.316 +    0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL,
 257.317 +    0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL,
 257.318 +    0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL,
 257.319 +    0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL,
 257.320 +    0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL,
 257.321 +    0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL,
 257.322 +    0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL,
 257.323 +    0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL,
 257.324 +    0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL,
 257.325 +    0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL,
 257.326 +    0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL,
 257.327 +    0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL,
 257.328 +    0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL,
 257.329 +    0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL,
 257.330 +    0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL,
 257.331 +    0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL,
 257.332 +    0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL,
 257.333 +    0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL,
 257.334 +    0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL,
 257.335 +    0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL,
 257.336 +    0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL,
 257.337 +    0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL,
 257.338 +    0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL,
 257.339 +    0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL,
 257.340 +    0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL,
 257.341 +    0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL,
 257.342 +    0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL,
 257.343 +    0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL,
 257.344 +    0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL,
 257.345 +    0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL,
 257.346 +    0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL,
 257.347 +    0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL,
 257.348 +    0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL,
 257.349 +    0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL,
 257.350 +    0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL,
 257.351 +    0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL,
 257.352 +    0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL,
 257.353 +    0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL,
 257.354 +    0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL,
 257.355 +    0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL,
 257.356 +    0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL,
 257.357 +    0x72fd2493UL
 257.358 +  },
 257.359 +  {
 257.360 +    0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL,
 257.361 +    0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL,
 257.362 +    0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL,
 257.363 +    0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL,
 257.364 +    0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL,
 257.365 +    0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL,
 257.366 +    0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL,
 257.367 +    0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL,
 257.368 +    0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL,
 257.369 +    0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL,
 257.370 +    0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL,
 257.371 +    0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL,
 257.372 +    0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL,
 257.373 +    0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL,
 257.374 +    0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL,
 257.375 +    0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL,
 257.376 +    0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL,
 257.377 +    0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL,
 257.378 +    0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL,
 257.379 +    0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL,
 257.380 +    0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL,
 257.381 +    0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL,
 257.382 +    0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL,
 257.383 +    0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL,
 257.384 +    0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL,
 257.385 +    0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL,
 257.386 +    0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL,
 257.387 +    0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL,
 257.388 +    0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL,
 257.389 +    0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL,
 257.390 +    0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL,
 257.391 +    0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL,
 257.392 +    0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL,
 257.393 +    0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL,
 257.394 +    0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL,
 257.395 +    0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL,
 257.396 +    0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL,
 257.397 +    0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL,
 257.398 +    0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL,
 257.399 +    0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL,
 257.400 +    0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL,
 257.401 +    0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL,
 257.402 +    0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL,
 257.403 +    0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL,
 257.404 +    0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL,
 257.405 +    0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL,
 257.406 +    0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL,
 257.407 +    0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL,
 257.408 +    0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL,
 257.409 +    0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL,
 257.410 +    0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL,
 257.411 +    0xed3498beUL
 257.412 +  },
 257.413 +  {
 257.414 +    0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL,
 257.415 +    0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL,
 257.416 +    0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL,
 257.417 +    0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL,
 257.418 +    0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL,
 257.419 +    0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL,
 257.420 +    0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL,
 257.421 +    0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL,
 257.422 +    0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL,
 257.423 +    0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL,
 257.424 +    0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL,
 257.425 +    0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL,
 257.426 +    0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL,
 257.427 +    0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL,
 257.428 +    0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL,
 257.429 +    0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL,
 257.430 +    0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL,
 257.431 +    0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL,
 257.432 +    0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL,
 257.433 +    0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL,
 257.434 +    0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL,
 257.435 +    0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL,
 257.436 +    0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL,
 257.437 +    0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL,
 257.438 +    0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL,
 257.439 +    0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL,
 257.440 +    0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL,
 257.441 +    0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL,
 257.442 +    0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL,
 257.443 +    0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL,
 257.444 +    0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL,
 257.445 +    0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL,
 257.446 +    0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL,
 257.447 +    0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL,
 257.448 +    0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL,
 257.449 +    0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL,
 257.450 +    0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL,
 257.451 +    0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL,
 257.452 +    0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL,
 257.453 +    0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL,
 257.454 +    0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL,
 257.455 +    0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL,
 257.456 +    0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL,
 257.457 +    0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL,
 257.458 +    0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL,
 257.459 +    0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL,
 257.460 +    0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL,
 257.461 +    0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL,
 257.462 +    0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL,
 257.463 +    0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL,
 257.464 +    0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL,
 257.465 +    0xf10605deUL
 257.466 +#endif
 257.467 +  }
 257.468 +};
   258.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   258.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/deflate.c	Mon Dec 19 10:06:23 2011 -0800
   258.3 @@ -0,0 +1,1858 @@
   258.4 +/*
   258.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   258.6 + *
   258.7 + * This code is free software; you can redistribute it and/or modify it
   258.8 + * under the terms of the GNU General Public License version 2 only, as
   258.9 + * published by the Free Software Foundation.  Oracle designates this
  258.10 + * particular file as subject to the "Classpath" exception as provided
  258.11 + * by Oracle in the LICENSE file that accompanied this code.
  258.12 + *
  258.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
  258.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  258.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  258.16 + * version 2 for more details (a copy is included in the LICENSE file that
  258.17 + * accompanied this code).
  258.18 + *
  258.19 + * You should have received a copy of the GNU General Public License version
  258.20 + * 2 along with this work; if not, write to the Free Software Foundation,
  258.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  258.22 + *
  258.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  258.24 + * or visit www.oracle.com if you need additional information or have any
  258.25 + * questions.
  258.26 + */
  258.27 +
  258.28 +/* deflate.c -- compress data using the deflation algorithm
  258.29 + * Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler
  258.30 + * For conditions of distribution and use, see copyright notice in zlib.h
  258.31 + */
  258.32 +
  258.33 +/*
  258.34 + *  ALGORITHM
  258.35 + *
  258.36 + *      The "deflation" process depends on being able to identify portions
  258.37 + *      of the input text which are identical to earlier input (within a
  258.38 + *      sliding window trailing behind the input currently being processed).
  258.39 + *
  258.40 + *      The most straightforward technique turns out to be the fastest for
  258.41 + *      most input files: try all possible matches and select the longest.
  258.42 + *      The key feature of this algorithm is that insertions into the string
  258.43 + *      dictionary are very simple and thus fast, and deletions are avoided
  258.44 + *      completely. Insertions are performed at each input character, whereas
  258.45 + *      string matches are performed only when the previous match ends. So it
  258.46 + *      is preferable to spend more time in matches to allow very fast string
  258.47 + *      insertions and avoid deletions. The matching algorithm for small
  258.48 + *      strings is inspired from that of Rabin & Karp. A brute force approach
  258.49 + *      is used to find longer strings when a small match has been found.
  258.50 + *      A similar algorithm is used in comic (by Jan-Mark Wams) and freeze
  258.51 + *      (by Leonid Broukhis).
  258.52 + *         A previous version of this file used a more sophisticated algorithm
  258.53 + *      (by Fiala and Greene) which is guaranteed to run in linear amortized
  258.54 + *      time, but has a larger average cost, uses more memory and is patented.
  258.55 + *      However the F&G algorithm may be faster for some highly redundant
  258.56 + *      files if the parameter max_chain_length (described below) is too large.
  258.57 + *
  258.58 + *  ACKNOWLEDGEMENTS
  258.59 + *
  258.60 + *      The idea of lazy evaluation of matches is due to Jan-Mark Wams, and
  258.61 + *      I found it in 'freeze' written by Leonid Broukhis.
  258.62 + *      Thanks to many people for bug reports and testing.
  258.63 + *
  258.64 + *  REFERENCES
  258.65 + *
  258.66 + *      Deutsch, L.P.,"DEFLATE Compressed Data Format Specification".
  258.67 + *      Available in http://www.ietf.org/rfc/rfc1951.txt
  258.68 + *
  258.69 + *      A description of the Rabin and Karp algorithm is given in the book
  258.70 + *         "Algorithms" by R. Sedgewick, Addison-Wesley, p252.
  258.71 + *
  258.72 + *      Fiala,E.R., and Greene,D.H.
  258.73 + *         Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595
  258.74 + *
  258.75 + */
  258.76 +
  258.77 +/* @(#) $Id$ */
  258.78 +
  258.79 +#include "deflate.h"
  258.80 +
  258.81 +const char deflate_copyright[] =
  258.82 +   " deflate 1.2.5 Copyright 1995-2010 Jean-loup Gailly and Mark Adler ";
  258.83 +/*
  258.84 +  If you use the zlib library in a product, an acknowledgment is welcome
  258.85 +  in the documentation of your product. If for some reason you cannot
  258.86 +  include such an acknowledgment, I would appreciate that you keep this
  258.87 +  copyright string in the executable of your product.
  258.88 + */
  258.89 +
  258.90 +/* ===========================================================================
  258.91 + *  Function prototypes.
  258.92 + */
  258.93 +typedef enum {
  258.94 +    need_more,      /* block not completed, need more input or more output */
  258.95 +    block_done,     /* block flush performed */
  258.96 +    finish_started, /* finish started, need only more output at next deflate */
  258.97 +    finish_done     /* finish done, accept no more input or output */
  258.98 +} block_state;
  258.99 +
 258.100 +typedef block_state (*compress_func) OF((deflate_state *s, int flush));
 258.101 +/* Compression function. Returns the block state after the call. */
 258.102 +
 258.103 +local void fill_window    OF((deflate_state *s));
 258.104 +local block_state deflate_stored OF((deflate_state *s, int flush));
 258.105 +local block_state deflate_fast   OF((deflate_state *s, int flush));
 258.106 +#ifndef FASTEST
 258.107 +local block_state deflate_slow   OF((deflate_state *s, int flush));
 258.108 +#endif
 258.109 +local block_state deflate_rle    OF((deflate_state *s, int flush));
 258.110 +local block_state deflate_huff   OF((deflate_state *s, int flush));
 258.111 +local void lm_init        OF((deflate_state *s));
 258.112 +local void putShortMSB    OF((deflate_state *s, uInt b));
 258.113 +local void flush_pending  OF((z_streamp strm));
 258.114 +local int read_buf        OF((z_streamp strm, Bytef *buf, unsigned size));
 258.115 +#ifdef ASMV
 258.116 +      void match_init OF((void)); /* asm code initialization */
 258.117 +      uInt longest_match  OF((deflate_state *s, IPos cur_match));
 258.118 +#else
 258.119 +local uInt longest_match  OF((deflate_state *s, IPos cur_match));
 258.120 +#endif
 258.121 +
 258.122 +#ifdef DEBUG
 258.123 +local  void check_match OF((deflate_state *s, IPos start, IPos match,
 258.124 +                            int length));
 258.125 +#endif
 258.126 +
 258.127 +/* ===========================================================================
 258.128 + * Local data
 258.129 + */
 258.130 +
 258.131 +#define NIL 0
 258.132 +/* Tail of hash chains */
 258.133 +
 258.134 +#ifndef TOO_FAR
 258.135 +#  define TOO_FAR 4096
 258.136 +#endif
 258.137 +/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
 258.138 +
 258.139 +/* Values for max_lazy_match, good_match and max_chain_length, depending on
 258.140 + * the desired pack level (0..9). The values given below have been tuned to
 258.141 + * exclude worst case performance for pathological files. Better values may be
 258.142 + * found for specific files.
 258.143 + */
 258.144 +typedef struct config_s {
 258.145 +   ush good_length; /* reduce lazy search above this match length */
 258.146 +   ush max_lazy;    /* do not perform lazy search above this match length */
 258.147 +   ush nice_length; /* quit search above this match length */
 258.148 +   ush max_chain;
 258.149 +   compress_func func;
 258.150 +} config;
 258.151 +
 258.152 +#ifdef FASTEST
 258.153 +local const config configuration_table[2] = {
 258.154 +/*      good lazy nice chain */
 258.155 +/* 0 */ {0,    0,  0,    0, deflate_stored},  /* store only */
 258.156 +/* 1 */ {4,    4,  8,    4, deflate_fast}}; /* max speed, no lazy matches */
 258.157 +#else
 258.158 +local const config configuration_table[10] = {
 258.159 +/*      good lazy nice chain */
 258.160 +/* 0 */ {0,    0,  0,    0, deflate_stored},  /* store only */
 258.161 +/* 1 */ {4,    4,  8,    4, deflate_fast}, /* max speed, no lazy matches */
 258.162 +/* 2 */ {4,    5, 16,    8, deflate_fast},
 258.163 +/* 3 */ {4,    6, 32,   32, deflate_fast},
 258.164 +
 258.165 +/* 4 */ {4,    4, 16,   16, deflate_slow},  /* lazy matches */
 258.166 +/* 5 */ {8,   16, 32,   32, deflate_slow},
 258.167 +/* 6 */ {8,   16, 128, 128, deflate_slow},
 258.168 +/* 7 */ {8,   32, 128, 256, deflate_slow},
 258.169 +/* 8 */ {32, 128, 258, 1024, deflate_slow},
 258.170 +/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */
 258.171 +#endif
 258.172 +
 258.173 +/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4
 258.174 + * For deflate_fast() (levels <= 3) good is ignored and lazy has a different
 258.175 + * meaning.
 258.176 + */
 258.177 +
 258.178 +#define EQUAL 0
 258.179 +/* result of memcmp for equal strings */
 258.180 +
 258.181 +#ifndef NO_DUMMY_DECL
 258.182 +struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
 258.183 +#endif
 258.184 +
 258.185 +/* ===========================================================================
 258.186 + * Update a hash value with the given input byte
 258.187 + * IN  assertion: all calls to to UPDATE_HASH are made with consecutive
 258.188 + *    input characters, so that a running hash key can be computed from the
 258.189 + *    previous key instead of complete recalculation each time.
 258.190 + */
 258.191 +#define UPDATE_HASH(s,h,c) (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask)
 258.192 +
 258.193 +
 258.194 +/* ===========================================================================
 258.195 + * Insert string str in the dictionary and set match_head to the previous head
 258.196 + * of the hash chain (the most recent string with same hash key). Return
 258.197 + * the previous length of the hash chain.
 258.198 + * If this file is compiled with -DFASTEST, the compression level is forced
 258.199 + * to 1, and no hash chains are maintained.
 258.200 + * IN  assertion: all calls to to INSERT_STRING are made with consecutive
 258.201 + *    input characters and the first MIN_MATCH bytes of str are valid
 258.202 + *    (except for the last MIN_MATCH-1 bytes of the input file).
 258.203 + */
 258.204 +#ifdef FASTEST
 258.205 +#define INSERT_STRING(s, str, match_head) \
 258.206 +   (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
 258.207 +    match_head = s->head[s->ins_h], \
 258.208 +    s->head[s->ins_h] = (Pos)(str))
 258.209 +#else
 258.210 +#define INSERT_STRING(s, str, match_head) \
 258.211 +   (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
 258.212 +    match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \
 258.213 +    s->head[s->ins_h] = (Pos)(str))
 258.214 +#endif
 258.215 +
 258.216 +/* ===========================================================================
 258.217 + * Initialize the hash table (avoiding 64K overflow for 16 bit systems).
 258.218 + * prev[] will be initialized on the fly.
 258.219 + */
 258.220 +#define CLEAR_HASH(s) \
 258.221 +    s->head[s->hash_size-1] = NIL; \
 258.222 +    zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
 258.223 +
 258.224 +/* ========================================================================= */
 258.225 +int ZEXPORT deflateInit_(strm, level, version, stream_size)
 258.226 +    z_streamp strm;
 258.227 +    int level;
 258.228 +    const char *version;
 258.229 +    int stream_size;
 258.230 +{
 258.231 +    return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
 258.232 +                         Z_DEFAULT_STRATEGY, version, stream_size);
 258.233 +    /* To do: ignore strm->next_in if we use it as window */
 258.234 +}
 258.235 +
 258.236 +/* ========================================================================= */
 258.237 +int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
 258.238 +                  version, stream_size)
 258.239 +    z_streamp strm;
 258.240 +    int  level;
 258.241 +    int  method;
 258.242 +    int  windowBits;
 258.243 +    int  memLevel;
 258.244 +    int  strategy;
 258.245 +    const char *version;
 258.246 +    int stream_size;
 258.247 +{
 258.248 +    deflate_state *s;
 258.249 +    int wrap = 1;
 258.250 +    static const char my_version[] = ZLIB_VERSION;
 258.251 +
 258.252 +    ushf *overlay;
 258.253 +    /* We overlay pending_buf and d_buf+l_buf. This works since the average
 258.254 +     * output size for (length,distance) codes is <= 24 bits.
 258.255 +     */
 258.256 +
 258.257 +    if (version == Z_NULL || version[0] != my_version[0] ||
 258.258 +        stream_size != sizeof(z_stream)) {
 258.259 +        return Z_VERSION_ERROR;
 258.260 +    }
 258.261 +    if (strm == Z_NULL) return Z_STREAM_ERROR;
 258.262 +
 258.263 +    strm->msg = Z_NULL;
 258.264 +    if (strm->zalloc == (alloc_func)0) {
 258.265 +        strm->zalloc = zcalloc;
 258.266 +        strm->opaque = (voidpf)0;
 258.267 +    }
 258.268 +    if (strm->zfree == (free_func)0) strm->zfree = zcfree;
 258.269 +
 258.270 +#ifdef FASTEST
 258.271 +    if (level != 0) level = 1;
 258.272 +#else
 258.273 +    if (level == Z_DEFAULT_COMPRESSION) level = 6;
 258.274 +#endif
 258.275 +
 258.276 +    if (windowBits < 0) { /* suppress zlib wrapper */
 258.277 +        wrap = 0;
 258.278 +        windowBits = -windowBits;
 258.279 +    }
 258.280 +#ifdef GZIP
 258.281 +    else if (windowBits > 15) {
 258.282 +        wrap = 2;       /* write gzip wrapper instead */
 258.283 +        windowBits -= 16;
 258.284 +    }
 258.285 +#endif
 258.286 +    if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
 258.287 +        windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
 258.288 +        strategy < 0 || strategy > Z_FIXED) {
 258.289 +        return Z_STREAM_ERROR;
 258.290 +    }
 258.291 +    if (windowBits == 8) windowBits = 9;  /* until 256-byte window bug fixed */
 258.292 +    s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));
 258.293 +    if (s == Z_NULL) return Z_MEM_ERROR;
 258.294 +    strm->state = (struct internal_state FAR *)s;
 258.295 +    s->strm = strm;
 258.296 +
 258.297 +    s->wrap = wrap;
 258.298 +    s->gzhead = Z_NULL;
 258.299 +    s->w_bits = windowBits;
 258.300 +    s->w_size = 1 << s->w_bits;
 258.301 +    s->w_mask = s->w_size - 1;
 258.302 +
 258.303 +    s->hash_bits = memLevel + 7;
 258.304 +    s->hash_size = 1 << s->hash_bits;
 258.305 +    s->hash_mask = s->hash_size - 1;
 258.306 +    s->hash_shift =  ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH);
 258.307 +
 258.308 +    s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
 258.309 +    s->prev   = (Posf *)  ZALLOC(strm, s->w_size, sizeof(Pos));
 258.310 +    s->head   = (Posf *)  ZALLOC(strm, s->hash_size, sizeof(Pos));
 258.311 +
 258.312 +    s->high_water = 0;      /* nothing written to s->window yet */
 258.313 +
 258.314 +    s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
 258.315 +
 258.316 +    overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
 258.317 +    s->pending_buf = (uchf *) overlay;
 258.318 +    s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);
 258.319 +
 258.320 +    if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
 258.321 +        s->pending_buf == Z_NULL) {
 258.322 +        s->status = FINISH_STATE;
 258.323 +        strm->msg = (char*)ERR_MSG(Z_MEM_ERROR);
 258.324 +        deflateEnd (strm);
 258.325 +        return Z_MEM_ERROR;
 258.326 +    }
 258.327 +    s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
 258.328 +    s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
 258.329 +
 258.330 +    s->level = level;
 258.331 +    s->strategy = strategy;
 258.332 +    s->method = (Byte)method;
 258.333 +
 258.334 +    return deflateReset(strm);
 258.335 +}
 258.336 +
 258.337 +/* ========================================================================= */
 258.338 +int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
 258.339 +    z_streamp strm;
 258.340 +    const Bytef *dictionary;
 258.341 +    uInt  dictLength;
 258.342 +{
 258.343 +    deflate_state *s;
 258.344 +    uInt length = dictLength;
 258.345 +    uInt n;
 258.346 +    IPos hash_head = 0;
 258.347 +
 258.348 +    if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL ||
 258.349 +        strm->state->wrap == 2 ||
 258.350 +        (strm->state->wrap == 1 && strm->state->status != INIT_STATE))
 258.351 +        return Z_STREAM_ERROR;
 258.352 +
 258.353 +    s = strm->state;
 258.354 +    if (s->wrap)
 258.355 +        strm->adler = adler32(strm->adler, dictionary, dictLength);
 258.356 +
 258.357 +    if (length < MIN_MATCH) return Z_OK;
 258.358 +    if (length > s->w_size) {
 258.359 +        length = s->w_size;
 258.360 +        dictionary += dictLength - length; /* use the tail of the dictionary */
 258.361 +    }
 258.362 +    zmemcpy(s->window, dictionary, length);
 258.363 +    s->strstart = length;
 258.364 +    s->block_start = (long)length;
 258.365 +
 258.366 +    /* Insert all strings in the hash table (except for the last two bytes).
 258.367 +     * s->lookahead stays null, so s->ins_h will be recomputed at the next
 258.368 +     * call of fill_window.
 258.369 +     */
 258.370 +    s->ins_h = s->window[0];
 258.371 +    UPDATE_HASH(s, s->ins_h, s->window[1]);
 258.372 +    for (n = 0; n <= length - MIN_MATCH; n++) {
 258.373 +        INSERT_STRING(s, n, hash_head);
 258.374 +    }
 258.375 +    if (hash_head) hash_head = 0;  /* to make compiler happy */
 258.376 +    return Z_OK;
 258.377 +}
 258.378 +
 258.379 +/* ========================================================================= */
 258.380 +int ZEXPORT deflateReset (strm)
 258.381 +    z_streamp strm;
 258.382 +{
 258.383 +    deflate_state *s;
 258.384 +
 258.385 +    if (strm == Z_NULL || strm->state == Z_NULL ||
 258.386 +        strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) {
 258.387 +        return Z_STREAM_ERROR;
 258.388 +    }
 258.389 +
 258.390 +    strm->total_in = strm->total_out = 0;
 258.391 +    strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */
 258.392 +    strm->data_type = Z_UNKNOWN;
 258.393 +
 258.394 +    s = (deflate_state *)strm->state;
 258.395 +    s->pending = 0;
 258.396 +    s->pending_out = s->pending_buf;
 258.397 +
 258.398 +    if (s->wrap < 0) {
 258.399 +        s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */
 258.400 +    }
 258.401 +    s->status = s->wrap ? INIT_STATE : BUSY_STATE;
 258.402 +    strm->adler =
 258.403 +#ifdef GZIP
 258.404 +        s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
 258.405 +#endif
 258.406 +        adler32(0L, Z_NULL, 0);
 258.407 +    s->last_flush = Z_NO_FLUSH;
 258.408 +
 258.409 +    _tr_init(s);
 258.410 +    lm_init(s);
 258.411 +
 258.412 +    return Z_OK;
 258.413 +}
 258.414 +
 258.415 +/* ========================================================================= */
 258.416 +int ZEXPORT deflateSetHeader (strm, head)
 258.417 +    z_streamp strm;
 258.418 +    gz_headerp head;
 258.419 +{
 258.420 +    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
 258.421 +    if (strm->state->wrap != 2) return Z_STREAM_ERROR;
 258.422 +    strm->state->gzhead = head;
 258.423 +    return Z_OK;
 258.424 +}
 258.425 +
 258.426 +/* ========================================================================= */
 258.427 +int ZEXPORT deflatePrime (strm, bits, value)
 258.428 +    z_streamp strm;
 258.429 +    int bits;
 258.430 +    int value;
 258.431 +{
 258.432 +    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
 258.433 +    strm->state->bi_valid = bits;
 258.434 +    strm->state->bi_buf = (ush)(value & ((1 << bits) - 1));
 258.435 +    return Z_OK;
 258.436 +}
 258.437 +
 258.438 +/* ========================================================================= */
 258.439 +int ZEXPORT deflateParams(strm, level, strategy)
 258.440 +    z_streamp strm;
 258.441 +    int level;
 258.442 +    int strategy;
 258.443 +{
 258.444 +    deflate_state *s;
 258.445 +    compress_func func;
 258.446 +    int err = Z_OK;
 258.447 +
 258.448 +    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
 258.449 +    s = strm->state;
 258.450 +
 258.451 +#ifdef FASTEST
 258.452 +    if (level != 0) level = 1;
 258.453 +#else
 258.454 +    if (level == Z_DEFAULT_COMPRESSION) level = 6;
 258.455 +#endif
 258.456 +    if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) {
 258.457 +        return Z_STREAM_ERROR;
 258.458 +    }
 258.459 +    func = configuration_table[s->level].func;
 258.460 +
 258.461 +    if ((strategy != s->strategy || func != configuration_table[level].func) &&
 258.462 +        strm->total_in != 0) {
 258.463 +        /* Flush the last buffer: */
 258.464 +        err = deflate(strm, Z_BLOCK);
 258.465 +    }
 258.466 +    if (s->level != level) {
 258.467 +        s->level = level;
 258.468 +        s->max_lazy_match   = configuration_table[level].max_lazy;
 258.469 +        s->good_match       = configuration_table[level].good_length;
 258.470 +        s->nice_match       = configuration_table[level].nice_length;
 258.471 +        s->max_chain_length = configuration_table[level].max_chain;
 258.472 +    }
 258.473 +    s->strategy = strategy;
 258.474 +    return err;
 258.475 +}
 258.476 +
 258.477 +/* ========================================================================= */
 258.478 +int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)
 258.479 +    z_streamp strm;
 258.480 +    int good_length;
 258.481 +    int max_lazy;
 258.482 +    int nice_length;
 258.483 +    int max_chain;
 258.484 +{
 258.485 +    deflate_state *s;
 258.486 +
 258.487 +    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
 258.488 +    s = strm->state;
 258.489 +    s->good_match = good_length;
 258.490 +    s->max_lazy_match = max_lazy;
 258.491 +    s->nice_match = nice_length;
 258.492 +    s->max_chain_length = max_chain;
 258.493 +    return Z_OK;
 258.494 +}
 258.495 +
 258.496 +/* =========================================================================
 258.497 + * For the default windowBits of 15 and memLevel of 8, this function returns
 258.498 + * a close to exact, as well as small, upper bound on the compressed size.
 258.499 + * They are coded as constants here for a reason--if the #define's are
 258.500 + * changed, then this function needs to be changed as well.  The return
 258.501 + * value for 15 and 8 only works for those exact settings.
 258.502 + *
 258.503 + * For any setting other than those defaults for windowBits and memLevel,
 258.504 + * the value returned is a conservative worst case for the maximum expansion
 258.505 + * resulting from using fixed blocks instead of stored blocks, which deflate
 258.506 + * can emit on compressed data for some combinations of the parameters.
 258.507 + *
 258.508 + * This function could be more sophisticated to provide closer upper bounds for
 258.509 + * every combination of windowBits and memLevel.  But even the conservative
 258.510 + * upper bound of about 14% expansion does not seem onerous for output buffer
 258.511 + * allocation.
 258.512 + */
 258.513 +uLong ZEXPORT deflateBound(strm, sourceLen)
 258.514 +    z_streamp strm;
 258.515 +    uLong sourceLen;
 258.516 +{
 258.517 +    deflate_state *s;
 258.518 +    uLong complen, wraplen;
 258.519 +    Bytef *str;
 258.520 +
 258.521 +    /* conservative upper bound for compressed data */
 258.522 +    complen = sourceLen +
 258.523 +              ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5;
 258.524 +
 258.525 +    /* if can't get parameters, return conservative bound plus zlib wrapper */
 258.526 +    if (strm == Z_NULL || strm->state == Z_NULL)
 258.527 +        return complen + 6;
 258.528 +
 258.529 +    /* compute wrapper length */
 258.530 +    s = strm->state;
 258.531 +    switch (s->wrap) {
 258.532 +    case 0:                                 /* raw deflate */
 258.533 +        wraplen = 0;
 258.534 +        break;
 258.535 +    case 1:                                 /* zlib wrapper */
 258.536 +        wraplen = 6 + (s->strstart ? 4 : 0);
 258.537 +        break;
 258.538 +    case 2:                                 /* gzip wrapper */
 258.539 +        wraplen = 18;
 258.540 +        if (s->gzhead != Z_NULL) {          /* user-supplied gzip header */
 258.541 +            if (s->gzhead->extra != Z_NULL)
 258.542 +                wraplen += 2 + s->gzhead->extra_len;
 258.543 +            str = s->gzhead->name;
 258.544 +            if (str != Z_NULL)
 258.545 +                do {
 258.546 +                    wraplen++;
 258.547 +                } while (*str++);
 258.548 +            str = s->gzhead->comment;
 258.549 +            if (str != Z_NULL)
 258.550 +                do {
 258.551 +                    wraplen++;
 258.552 +                } while (*str++);
 258.553 +            if (s->gzhead->hcrc)
 258.554 +                wraplen += 2;
 258.555 +        }
 258.556 +        break;
 258.557 +    default:                                /* for compiler happiness */
 258.558 +        wraplen = 6;
 258.559 +    }
 258.560 +
 258.561 +    /* if not default parameters, return conservative bound */
 258.562 +    if (s->w_bits != 15 || s->hash_bits != 8 + 7)
 258.563 +        return complen + wraplen;
 258.564 +
 258.565 +    /* default settings: return tight bound for that case */
 258.566 +    return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
 258.567 +           (sourceLen >> 25) + 13 - 6 + wraplen;
 258.568 +}
 258.569 +
 258.570 +/* =========================================================================
 258.571 + * Put a short in the pending buffer. The 16-bit value is put in MSB order.
 258.572 + * IN assertion: the stream state is correct and there is enough room in
 258.573 + * pending_buf.
 258.574 + */
 258.575 +local void putShortMSB (s, b)
 258.576 +    deflate_state *s;
 258.577 +    uInt b;
 258.578 +{
 258.579 +    put_byte(s, (Byte)(b >> 8));
 258.580 +    put_byte(s, (Byte)(b & 0xff));
 258.581 +}
 258.582 +
 258.583 +/* =========================================================================
 258.584 + * Flush as much pending output as possible. All deflate() output goes
 258.585 + * through this function so some applications may wish to modify it
 258.586 + * to avoid allocating a large strm->next_out buffer and copying into it.
 258.587 + * (See also read_buf()).
 258.588 + */
 258.589 +local void flush_pending(strm)
 258.590 +    z_streamp strm;
 258.591 +{
 258.592 +    unsigned len = strm->state->pending;
 258.593 +
 258.594 +    if (len > strm->avail_out) len = strm->avail_out;
 258.595 +    if (len == 0) return;
 258.596 +
 258.597 +    zmemcpy(strm->next_out, strm->state->pending_out, len);
 258.598 +    strm->next_out  += len;
 258.599 +    strm->state->pending_out  += len;
 258.600 +    strm->total_out += len;
 258.601 +    strm->avail_out  -= len;
 258.602 +    strm->state->pending -= len;
 258.603 +    if (strm->state->pending == 0) {
 258.604 +        strm->state->pending_out = strm->state->pending_buf;
 258.605 +    }
 258.606 +}
 258.607 +
 258.608 +/* ========================================================================= */
 258.609 +int ZEXPORT deflate (strm, flush)
 258.610 +    z_streamp strm;
 258.611 +    int flush;
 258.612 +{
 258.613 +    int old_flush; /* value of flush param for previous deflate call */
 258.614 +    deflate_state *s;
 258.615 +
 258.616 +    if (strm == Z_NULL || strm->state == Z_NULL ||
 258.617 +        flush > Z_BLOCK || flush < 0) {
 258.618 +        return Z_STREAM_ERROR;
 258.619 +    }
 258.620 +    s = strm->state;
 258.621 +
 258.622 +    if (strm->next_out == Z_NULL ||
 258.623 +        (strm->next_in == Z_NULL && strm->avail_in != 0) ||
 258.624 +        (s->status == FINISH_STATE && flush != Z_FINISH)) {
 258.625 +        ERR_RETURN(strm, Z_STREAM_ERROR);
 258.626 +    }
 258.627 +    if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR);
 258.628 +
 258.629 +    s->strm = strm; /* just in case */
 258.630 +    old_flush = s->last_flush;
 258.631 +    s->last_flush = flush;
 258.632 +
 258.633 +    /* Write the header */
 258.634 +    if (s->status == INIT_STATE) {
 258.635 +#ifdef GZIP
 258.636 +        if (s->wrap == 2) {
 258.637 +            strm->adler = crc32(0L, Z_NULL, 0);
 258.638 +            put_byte(s, 31);
 258.639 +            put_byte(s, 139);
 258.640 +            put_byte(s, 8);
 258.641 +            if (s->gzhead == Z_NULL) {
 258.642 +                put_byte(s, 0);
 258.643 +                put_byte(s, 0);
 258.644 +                put_byte(s, 0);
 258.645 +                put_byte(s, 0);
 258.646 +                put_byte(s, 0);
 258.647 +                put_byte(s, s->level == 9 ? 2 :
 258.648 +                            (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
 258.649 +                             4 : 0));
 258.650 +                put_byte(s, OS_CODE);
 258.651 +                s->status = BUSY_STATE;
 258.652 +            }
 258.653 +            else {
 258.654 +                put_byte(s, (s->gzhead->text ? 1 : 0) +
 258.655 +                            (s->gzhead->hcrc ? 2 : 0) +
 258.656 +                            (s->gzhead->extra == Z_NULL ? 0 : 4) +
 258.657 +                            (s->gzhead->name == Z_NULL ? 0 : 8) +
 258.658 +                            (s->gzhead->comment == Z_NULL ? 0 : 16)
 258.659 +                        );
 258.660 +                put_byte(s, (Byte)(s->gzhead->time & 0xff));
 258.661 +                put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff));
 258.662 +                put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff));
 258.663 +                put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff));
 258.664 +                put_byte(s, s->level == 9 ? 2 :
 258.665 +                            (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
 258.666 +                             4 : 0));
 258.667 +                put_byte(s, s->gzhead->os & 0xff);
 258.668 +                if (s->gzhead->extra != Z_NULL) {
 258.669 +                    put_byte(s, s->gzhead->extra_len & 0xff);
 258.670 +                    put_byte(s, (s->gzhead->extra_len >> 8) & 0xff);
 258.671 +                }
 258.672 +                if (s->gzhead->hcrc)
 258.673 +                    strm->adler = crc32(strm->adler, s->pending_buf,
 258.674 +                                        s->pending);
 258.675 +                s->gzindex = 0;
 258.676 +                s->status = EXTRA_STATE;
 258.677 +            }
 258.678 +        }
 258.679 +        else
 258.680 +#endif
 258.681 +        {
 258.682 +            uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;
 258.683 +            uInt level_flags;
 258.684 +
 258.685 +            if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2)
 258.686 +                level_flags = 0;
 258.687 +            else if (s->level < 6)
 258.688 +                level_flags = 1;
 258.689 +            else if (s->level == 6)
 258.690 +                level_flags = 2;
 258.691 +            else
 258.692 +                level_flags = 3;
 258.693 +            header |= (level_flags << 6);
 258.694 +            if (s->strstart != 0) header |= PRESET_DICT;
 258.695 +            header += 31 - (header % 31);
 258.696 +
 258.697 +            s->status = BUSY_STATE;
 258.698 +            putShortMSB(s, header);
 258.699 +
 258.700 +            /* Save the adler32 of the preset dictionary: */
 258.701 +            if (s->strstart != 0) {
 258.702 +                putShortMSB(s, (uInt)(strm->adler >> 16));
 258.703 +                putShortMSB(s, (uInt)(strm->adler & 0xffff));
 258.704 +            }
 258.705 +            strm->adler = adler32(0L, Z_NULL, 0);
 258.706 +        }
 258.707 +    }
 258.708 +#ifdef GZIP
 258.709 +    if (s->status == EXTRA_STATE) {
 258.710 +        if (s->gzhead->extra != Z_NULL) {
 258.711 +            uInt beg = s->pending;  /* start of bytes to update crc */
 258.712 +
 258.713 +            while (s->gzindex < (s->gzhead->extra_len & 0xffff)) {
 258.714 +                if (s->pending == s->pending_buf_size) {
 258.715 +                    if (s->gzhead->hcrc && s->pending > beg)
 258.716 +                        strm->adler = crc32(strm->adler, s->pending_buf + beg,
 258.717 +                                            s->pending - beg);
 258.718 +                    flush_pending(strm);
 258.719 +                    beg = s->pending;
 258.720 +                    if (s->pending == s->pending_buf_size)
 258.721 +                        break;
 258.722 +                }
 258.723 +                put_byte(s, s->gzhead->extra[s->gzindex]);
 258.724 +                s->gzindex++;
 258.725 +            }
 258.726 +            if (s->gzhead->hcrc && s->pending > beg)
 258.727 +                strm->adler = crc32(strm->adler, s->pending_buf + beg,
 258.728 +                                    s->pending - beg);
 258.729 +            if (s->gzindex == s->gzhead->extra_len) {
 258.730 +                s->gzindex = 0;
 258.731 +                s->status = NAME_STATE;
 258.732 +            }
 258.733 +        }
 258.734 +        else
 258.735 +            s->status = NAME_STATE;
 258.736 +    }
 258.737 +    if (s->status == NAME_STATE) {
 258.738 +        if (s->gzhead->name != Z_NULL) {
 258.739 +            uInt beg = s->pending;  /* start of bytes to update crc */
 258.740 +            int val;
 258.741 +
 258.742 +            do {
 258.743 +                if (s->pending == s->pending_buf_size) {
 258.744 +                    if (s->gzhead->hcrc && s->pending > beg)
 258.745 +                        strm->adler = crc32(strm->adler, s->pending_buf + beg,
 258.746 +                                            s->pending - beg);
 258.747 +                    flush_pending(strm);
 258.748 +                    beg = s->pending;
 258.749 +                    if (s->pending == s->pending_buf_size) {
 258.750 +                        val = 1;
 258.751 +                        break;
 258.752 +                    }
 258.753 +                }
 258.754 +                val = s->gzhead->name[s->gzindex++];
 258.755 +                put_byte(s, val);
 258.756 +            } while (val != 0);
 258.757 +            if (s->gzhead->hcrc && s->pending > beg)
 258.758 +                strm->adler = crc32(strm->adler, s->pending_buf + beg,
 258.759 +                                    s->pending - beg);
 258.760 +            if (val == 0) {
 258.761 +                s->gzindex = 0;
 258.762 +                s->status = COMMENT_STATE;
 258.763 +            }
 258.764 +        }
 258.765 +        else
 258.766 +            s->status = COMMENT_STATE;
 258.767 +    }
 258.768 +    if (s->status == COMMENT_STATE) {
 258.769 +        if (s->gzhead->comment != Z_NULL) {
 258.770 +            uInt beg = s->pending;  /* start of bytes to update crc */
 258.771 +            int val;
 258.772 +
 258.773 +            do {
 258.774 +                if (s->pending == s->pending_buf_size) {
 258.775 +                    if (s->gzhead->hcrc && s->pending > beg)
 258.776 +                        strm->adler = crc32(strm->adler, s->pending_buf + beg,
 258.777 +                                            s->pending - beg);
 258.778 +                    flush_pending(strm);
 258.779 +                    beg = s->pending;
 258.780 +                    if (s->pending == s->pending_buf_size) {
 258.781 +                        val = 1;
 258.782 +                        break;
 258.783 +                    }
 258.784 +                }
 258.785 +                val = s->gzhead->comment[s->gzindex++];
 258.786 +                put_byte(s, val);
 258.787 +            } while (val != 0);
 258.788 +            if (s->gzhead->hcrc && s->pending > beg)
 258.789 +                strm->adler = crc32(strm->adler, s->pending_buf + beg,
 258.790 +                                    s->pending - beg);
 258.791 +            if (val == 0)
 258.792 +                s->status = HCRC_STATE;
 258.793 +        }
 258.794 +        else
 258.795 +            s->status = HCRC_STATE;
 258.796 +    }
 258.797 +    if (s->status == HCRC_STATE) {
 258.798 +        if (s->gzhead->hcrc) {
 258.799 +            if (s->pending + 2 > s->pending_buf_size)
 258.800 +                flush_pending(strm);
 258.801 +            if (s->pending + 2 <= s->pending_buf_size) {
 258.802 +                put_byte(s, (Byte)(strm->adler & 0xff));
 258.803 +                put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
 258.804 +                strm->adler = crc32(0L, Z_NULL, 0);
 258.805 +                s->status = BUSY_STATE;
 258.806 +            }
 258.807 +        }
 258.808 +        else
 258.809 +            s->status = BUSY_STATE;
 258.810 +    }
 258.811 +#endif
 258.812 +
 258.813 +    /* Flush as much pending output as possible */
 258.814 +    if (s->pending != 0) {
 258.815 +        flush_pending(strm);
 258.816 +        if (strm->avail_out == 0) {
 258.817 +            /* Since avail_out is 0, deflate will be called again with
 258.818 +             * more output space, but possibly with both pending and
 258.819 +             * avail_in equal to zero. There won't be anything to do,
 258.820 +             * but this is not an error situation so make sure we
 258.821 +             * return OK instead of BUF_ERROR at next call of deflate:
 258.822 +             */
 258.823 +            s->last_flush = -1;
 258.824 +            return Z_OK;
 258.825 +        }
 258.826 +
 258.827 +    /* Make sure there is something to do and avoid duplicate consecutive
 258.828 +     * flushes. For repeated and useless calls with Z_FINISH, we keep
 258.829 +     * returning Z_STREAM_END instead of Z_BUF_ERROR.
 258.830 +     */
 258.831 +    } else if (strm->avail_in == 0 && flush <= old_flush &&
 258.832 +               flush != Z_FINISH) {
 258.833 +        ERR_RETURN(strm, Z_BUF_ERROR);
 258.834 +    }
 258.835 +
 258.836 +    /* User must not provide more input after the first FINISH: */
 258.837 +    if (s->status == FINISH_STATE && strm->avail_in != 0) {
 258.838 +        ERR_RETURN(strm, Z_BUF_ERROR);
 258.839 +    }
 258.840 +
 258.841 +    /* Start a new block or continue the current one.
 258.842 +     */
 258.843 +    if (strm->avail_in != 0 || s->lookahead != 0 ||
 258.844 +        (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
 258.845 +        block_state bstate;
 258.846 +
 258.847 +        bstate = s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) :
 258.848 +                    (s->strategy == Z_RLE ? deflate_rle(s, flush) :
 258.849 +                        (*(configuration_table[s->level].func))(s, flush));
 258.850 +
 258.851 +        if (bstate == finish_started || bstate == finish_done) {
 258.852 +            s->status = FINISH_STATE;
 258.853 +        }
 258.854 +        if (bstate == need_more || bstate == finish_started) {
 258.855 +            if (strm->avail_out == 0) {
 258.856 +                s->last_flush = -1; /* avoid BUF_ERROR next call, see above */
 258.857 +            }
 258.858 +            return Z_OK;
 258.859 +            /* If flush != Z_NO_FLUSH && avail_out == 0, the next call
 258.860 +             * of deflate should use the same flush parameter to make sure
 258.861 +             * that the flush is complete. So we don't have to output an
 258.862 +             * empty block here, this will be done at next call. This also
 258.863 +             * ensures that for a very small output buffer, we emit at most
 258.864 +             * one empty block.
 258.865 +             */
 258.866 +        }
 258.867 +        if (bstate == block_done) {
 258.868 +            if (flush == Z_PARTIAL_FLUSH) {
 258.869 +                _tr_align(s);
 258.870 +            } else if (flush != Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */
 258.871 +                _tr_stored_block(s, (char*)0, 0L, 0);
 258.872 +                /* For a full flush, this empty block will be recognized
 258.873 +                 * as a special marker by inflate_sync().
 258.874 +                 */
 258.875 +                if (flush == Z_FULL_FLUSH) {
 258.876 +                    CLEAR_HASH(s);             /* forget history */
 258.877 +                    if (s->lookahead == 0) {
 258.878 +                        s->strstart = 0;
 258.879 +                        s->block_start = 0L;
 258.880 +                    }
 258.881 +                }
 258.882 +            }
 258.883 +            flush_pending(strm);
 258.884 +            if (strm->avail_out == 0) {
 258.885 +              s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */
 258.886 +              return Z_OK;
 258.887 +            }
 258.888 +        }
 258.889 +    }
 258.890 +    Assert(strm->avail_out > 0, "bug2");
 258.891 +
 258.892 +    if (flush != Z_FINISH) return Z_OK;
 258.893 +    if (s->wrap <= 0) return Z_STREAM_END;
 258.894 +
 258.895 +    /* Write the trailer */
 258.896 +#ifdef GZIP
 258.897 +    if (s->wrap == 2) {
 258.898 +        put_byte(s, (Byte)(strm->adler & 0xff));
 258.899 +        put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
 258.900 +        put_byte(s, (Byte)((strm->adler >> 16) & 0xff));
 258.901 +        put_byte(s, (Byte)((strm->adler >> 24) & 0xff));
 258.902 +        put_byte(s, (Byte)(strm->total_in & 0xff));
 258.903 +        put_byte(s, (Byte)((strm->total_in >> 8) & 0xff));
 258.904 +        put_byte(s, (Byte)((strm->total_in >> 16) & 0xff));
 258.905 +        put_byte(s, (Byte)((strm->total_in >> 24) & 0xff));
 258.906 +    }
 258.907 +    else
 258.908 +#endif
 258.909 +    {
 258.910 +        putShortMSB(s, (uInt)(strm->adler >> 16));
 258.911 +        putShortMSB(s, (uInt)(strm->adler & 0xffff));
 258.912 +    }
 258.913 +    flush_pending(strm);
 258.914 +    /* If avail_out is zero, the application will call deflate again
 258.915 +     * to flush the rest.
 258.916 +     */
 258.917 +    if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */
 258.918 +    return s->pending != 0 ? Z_OK : Z_STREAM_END;
 258.919 +}
 258.920 +
 258.921 +/* ========================================================================= */
 258.922 +int ZEXPORT deflateEnd (strm)
 258.923 +    z_streamp strm;
 258.924 +{
 258.925 +    int status;
 258.926 +
 258.927 +    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
 258.928 +
 258.929 +    status = strm->state->status;
 258.930 +    if (status != INIT_STATE &&
 258.931 +        status != EXTRA_STATE &&
 258.932 +        status != NAME_STATE &&
 258.933 +        status != COMMENT_STATE &&
 258.934 +        status != HCRC_STATE &&
 258.935 +        status != BUSY_STATE &&
 258.936 +        status != FINISH_STATE) {
 258.937 +      return Z_STREAM_ERROR;
 258.938 +    }
 258.939 +
 258.940 +    /* Deallocate in reverse order of allocations: */
 258.941 +    TRY_FREE(strm, strm->state->pending_buf);
 258.942 +    TRY_FREE(strm, strm->state->head);
 258.943 +    TRY_FREE(strm, strm->state->prev);
 258.944 +    TRY_FREE(strm, strm->state->window);
 258.945 +
 258.946 +    ZFREE(strm, strm->state);
 258.947 +    strm->state = Z_NULL;
 258.948 +
 258.949 +    return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
 258.950 +}
 258.951 +
 258.952 +/* =========================================================================
 258.953 + * Copy the source state to the destination state.
 258.954 + * To simplify the source, this is not supported for 16-bit MSDOS (which
 258.955 + * doesn't have enough memory anyway to duplicate compression states).
 258.956 + */
 258.957 +int ZEXPORT deflateCopy (dest, source)
 258.958 +    z_streamp dest;
 258.959 +    z_streamp source;
 258.960 +{
 258.961 +#ifdef MAXSEG_64K
 258.962 +    return Z_STREAM_ERROR;
 258.963 +#else
 258.964 +    deflate_state *ds;
 258.965 +    deflate_state *ss;
 258.966 +    ushf *overlay;
 258.967 +
 258.968 +
 258.969 +    if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) {
 258.970 +        return Z_STREAM_ERROR;
 258.971 +    }
 258.972 +
 258.973 +    ss = source->state;
 258.974 +
 258.975 +    zmemcpy(dest, source, sizeof(z_stream));
 258.976 +
 258.977 +    ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
 258.978 +    if (ds == Z_NULL) return Z_MEM_ERROR;
 258.979 +    dest->state = (struct internal_state FAR *) ds;
 258.980 +    zmemcpy(ds, ss, sizeof(deflate_state));
 258.981 +    ds->strm = dest;
 258.982 +
 258.983 +    ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
 258.984 +    ds->prev   = (Posf *)  ZALLOC(dest, ds->w_size, sizeof(Pos));
 258.985 +    ds->head   = (Posf *)  ZALLOC(dest, ds->hash_size, sizeof(Pos));
 258.986 +    overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2);
 258.987 +    ds->pending_buf = (uchf *) overlay;
 258.988 +
 258.989 +    if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
 258.990 +        ds->pending_buf == Z_NULL) {
 258.991 +        deflateEnd (dest);
 258.992 +        return Z_MEM_ERROR;
 258.993 +    }
 258.994 +    /* following zmemcpy do not work for 16-bit MSDOS */
 258.995 +    zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));
 258.996 +    zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos));
 258.997 +    zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos));
 258.998 +    zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
 258.999 +
258.1000 +    ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
258.1001 +    ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush);
258.1002 +    ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize;
258.1003 +
258.1004 +    ds->l_desc.dyn_tree = ds->dyn_ltree;
258.1005 +    ds->d_desc.dyn_tree = ds->dyn_dtree;
258.1006 +    ds->bl_desc.dyn_tree = ds->bl_tree;
258.1007 +
258.1008 +    return Z_OK;
258.1009 +#endif /* MAXSEG_64K */
258.1010 +}
258.1011 +
258.1012 +/* ===========================================================================
258.1013 + * Read a new buffer from the current input stream, update the adler32
258.1014 + * and total number of bytes read.  All deflate() input goes through
258.1015 + * this function so some applications may wish to modify it to avoid
258.1016 + * allocating a large strm->next_in buffer and copying from it.
258.1017 + * (See also flush_pending()).
258.1018 + */
258.1019 +local int read_buf(strm, buf, size)
258.1020 +    z_streamp strm;
258.1021 +    Bytef *buf;
258.1022 +    unsigned size;
258.1023 +{
258.1024 +    unsigned len = strm->avail_in;
258.1025 +
258.1026 +    if (len > size) len = size;
258.1027 +    if (len == 0) return 0;
258.1028 +
258.1029 +    strm->avail_in  -= len;
258.1030 +
258.1031 +    if (strm->state->wrap == 1) {
258.1032 +        strm->adler = adler32(strm->adler, strm->next_in, len);
258.1033 +    }
258.1034 +#ifdef GZIP
258.1035 +    else if (strm->state->wrap == 2) {
258.1036 +        strm->adler = crc32(strm->adler, strm->next_in, len);
258.1037 +    }
258.1038 +#endif
258.1039 +    zmemcpy(buf, strm->next_in, len);
258.1040 +    strm->next_in  += len;
258.1041 +    strm->total_in += len;
258.1042 +
258.1043 +    return (int)len;
258.1044 +}
258.1045 +
258.1046 +/* ===========================================================================
258.1047 + * Initialize the "longest match" routines for a new zlib stream
258.1048 + */
258.1049 +local void lm_init (s)
258.1050 +    deflate_state *s;
258.1051 +{
258.1052 +    s->window_size = (ulg)2L*s->w_size;
258.1053 +
258.1054 +    CLEAR_HASH(s);
258.1055 +
258.1056 +    /* Set the default configuration parameters:
258.1057 +     */
258.1058 +    s->max_lazy_match   = configuration_table[s->level].max_lazy;
258.1059 +    s->good_match       = configuration_table[s->level].good_length;
258.1060 +    s->nice_match       = configuration_table[s->level].nice_length;
258.1061 +    s->max_chain_length = configuration_table[s->level].max_chain;
258.1062 +
258.1063 +    s->strstart = 0;
258.1064 +    s->block_start = 0L;
258.1065 +    s->lookahead = 0;
258.1066 +    s->match_length = s->prev_length = MIN_MATCH-1;
258.1067 +    s->match_available = 0;
258.1068 +    s->ins_h = 0;
258.1069 +#ifndef FASTEST
258.1070 +#ifdef ASMV
258.1071 +    match_init(); /* initialize the asm code */
258.1072 +#endif
258.1073 +#endif
258.1074 +}
258.1075 +
258.1076 +#ifndef FASTEST
258.1077 +/* ===========================================================================
258.1078 + * Set match_start to the longest match starting at the given string and
258.1079 + * return its length. Matches shorter or equal to prev_length are discarded,
258.1080 + * in which case the result is equal to prev_length and match_start is
258.1081 + * garbage.
258.1082 + * IN assertions: cur_match is the head of the hash chain for the current
258.1083 + *   string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
258.1084 + * OUT assertion: the match length is not greater than s->lookahead.
258.1085 + */
258.1086 +#ifndef ASMV
258.1087 +/* For 80x86 and 680x0, an optimized version will be provided in match.asm or
258.1088 + * match.S. The code will be functionally equivalent.
258.1089 + */
258.1090 +local uInt longest_match(s, cur_match)
258.1091 +    deflate_state *s;
258.1092 +    IPos cur_match;                             /* current match */
258.1093 +{
258.1094 +    unsigned chain_length = s->max_chain_length;/* max hash chain length */
258.1095 +    register Bytef *scan = s->window + s->strstart; /* current string */
258.1096 +    register Bytef *match;                       /* matched string */
258.1097 +    register int len;                           /* length of current match */
258.1098 +    int best_len = s->prev_length;              /* best match length so far */
258.1099 +    int nice_match = s->nice_match;             /* stop if match long enough */
258.1100 +    IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
258.1101 +        s->strstart - (IPos)MAX_DIST(s) : NIL;
258.1102 +    /* Stop when cur_match becomes <= limit. To simplify the code,
258.1103 +     * we prevent matches with the string of window index 0.
258.1104 +     */
258.1105 +    Posf *prev = s->prev;
258.1106 +    uInt wmask = s->w_mask;
258.1107 +
258.1108 +#ifdef UNALIGNED_OK
258.1109 +    /* Compare two bytes at a time. Note: this is not always beneficial.
258.1110 +     * Try with and without -DUNALIGNED_OK to check.
258.1111 +     */
258.1112 +    register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
258.1113 +    register ush scan_start = *(ushf*)scan;
258.1114 +    register ush scan_end   = *(ushf*)(scan+best_len-1);
258.1115 +#else
258.1116 +    register Bytef *strend = s->window + s->strstart + MAX_MATCH;
258.1117 +    register Byte scan_end1  = scan[best_len-1];
258.1118 +    register Byte scan_end   = scan[best_len];
258.1119 +#endif
258.1120 +
258.1121 +    /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
258.1122 +     * It is easy to get rid of this optimization if necessary.
258.1123 +     */
258.1124 +    Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
258.1125 +
258.1126 +    /* Do not waste too much time if we already have a good match: */
258.1127 +    if (s->prev_length >= s->good_match) {
258.1128 +        chain_length >>= 2;
258.1129 +    }
258.1130 +    /* Do not look for matches beyond the end of the input. This is necessary
258.1131 +     * to make deflate deterministic.
258.1132 +     */
258.1133 +    if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
258.1134 +
258.1135 +    Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
258.1136 +
258.1137 +    do {
258.1138 +        Assert(cur_match < s->strstart, "no future");
258.1139 +        match = s->window + cur_match;
258.1140 +
258.1141 +        /* Skip to next match if the match length cannot increase
258.1142 +         * or if the match length is less than 2.  Note that the checks below
258.1143 +         * for insufficient lookahead only occur occasionally for performance
258.1144 +         * reasons.  Therefore uninitialized memory will be accessed, and
258.1145 +         * conditional jumps will be made that depend on those values.
258.1146 +         * However the length of the match is limited to the lookahead, so
258.1147 +         * the output of deflate is not affected by the uninitialized values.
258.1148 +         */
258.1149 +#if (defined(UNALIGNED_OK) && MAX_MATCH == 258)
258.1150 +        /* This code assumes sizeof(unsigned short) == 2. Do not use
258.1151 +         * UNALIGNED_OK if your compiler uses a different size.
258.1152 +         */
258.1153 +        if (*(ushf*)(match+best_len-1) != scan_end ||
258.1154 +            *(ushf*)match != scan_start) continue;
258.1155 +
258.1156 +        /* It is not necessary to compare scan[2] and match[2] since they are
258.1157 +         * always equal when the other bytes match, given that the hash keys
258.1158 +         * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at
258.1159 +         * strstart+3, +5, ... up to strstart+257. We check for insufficient
258.1160 +         * lookahead only every 4th comparison; the 128th check will be made
258.1161 +         * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is
258.1162 +         * necessary to put more guard bytes at the end of the window, or
258.1163 +         * to check more often for insufficient lookahead.
258.1164 +         */
258.1165 +        Assert(scan[2] == match[2], "scan[2]?");
258.1166 +        scan++, match++;
258.1167 +        do {
258.1168 +        } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
258.1169 +                 *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
258.1170 +                 *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
258.1171 +                 *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
258.1172 +                 scan < strend);
258.1173 +        /* The funny "do {}" generates better code on most compilers */
258.1174 +
258.1175 +        /* Here, scan <= window+strstart+257 */
258.1176 +        Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
258.1177 +        if (*scan == *match) scan++;
258.1178 +
258.1179 +        len = (MAX_MATCH - 1) - (int)(strend-scan);
258.1180 +        scan = strend - (MAX_MATCH-1);
258.1181 +
258.1182 +#else /* UNALIGNED_OK */
258.1183 +
258.1184 +        if (match[best_len]   != scan_end  ||
258.1185 +            match[best_len-1] != scan_end1 ||
258.1186 +            *match            != *scan     ||
258.1187 +            *++match          != scan[1])      continue;
258.1188 +
258.1189 +        /* The check at best_len-1 can be removed because it will be made
258.1190 +         * again later. (This heuristic is not always a win.)
258.1191 +         * It is not necessary to compare scan[2] and match[2] since they
258.1192 +         * are always equal when the other bytes match, given that
258.1193 +         * the hash keys are equal and that HASH_BITS >= 8.
258.1194 +         */
258.1195 +        scan += 2, match++;
258.1196 +        Assert(*scan == *match, "match[2]?");
258.1197 +
258.1198 +        /* We check for insufficient lookahead only every 8th comparison;
258.1199 +         * the 256th check will be made at strstart+258.
258.1200 +         */
258.1201 +        do {
258.1202 +        } while (*++scan == *++match && *++scan == *++match &&
258.1203 +                 *++scan == *++match && *++scan == *++match &&
258.1204 +                 *++scan == *++match && *++scan == *++match &&
258.1205 +                 *++scan == *++match && *++scan == *++match &&
258.1206 +                 scan < strend);
258.1207 +
258.1208 +        Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
258.1209 +
258.1210 +        len = MAX_MATCH - (int)(strend - scan);
258.1211 +        scan = strend - MAX_MATCH;
258.1212 +
258.1213 +#endif /* UNALIGNED_OK */
258.1214 +
258.1215 +        if (len > best_len) {
258.1216 +            s->match_start = cur_match;
258.1217 +            best_len = len;
258.1218 +            if (len >= nice_match) break;
258.1219 +#ifdef UNALIGNED_OK
258.1220 +            scan_end = *(ushf*)(scan+best_len-1);
258.1221 +#else
258.1222 +            scan_end1  = scan[best_len-1];
258.1223 +            scan_end   = scan[best_len];
258.1224 +#endif
258.1225 +        }
258.1226 +    } while ((cur_match = prev[cur_match & wmask]) > limit
258.1227 +             && --chain_length != 0);
258.1228 +
258.1229 +    if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
258.1230 +    return s->lookahead;
258.1231 +}
258.1232 +#endif /* ASMV */
258.1233 +
258.1234 +#else /* FASTEST */
258.1235 +
258.1236 +/* ---------------------------------------------------------------------------
258.1237 + * Optimized version for FASTEST only
258.1238 + */
258.1239 +local uInt longest_match(s, cur_match)
258.1240 +    deflate_state *s;
258.1241 +    IPos cur_match;                             /* current match */
258.1242 +{
258.1243 +    register Bytef *scan = s->window + s->strstart; /* current string */
258.1244 +    register Bytef *match;                       /* matched string */
258.1245 +    register int len;                           /* length of current match */
258.1246 +    register Bytef *strend = s->window + s->strstart + MAX_MATCH;
258.1247 +
258.1248 +    /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
258.1249 +     * It is easy to get rid of this optimization if necessary.
258.1250 +     */
258.1251 +    Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
258.1252 +
258.1253 +    Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
258.1254 +
258.1255 +    Assert(cur_match < s->strstart, "no future");
258.1256 +
258.1257 +    match = s->window + cur_match;
258.1258 +
258.1259 +    /* Return failure if the match length is less than 2:
258.1260 +     */
258.1261 +    if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1;
258.1262 +
258.1263 +    /* The check at best_len-1 can be removed because it will be made
258.1264 +     * again later. (This heuristic is not always a win.)
258.1265 +     * It is not necessary to compare scan[2] and match[2] since they
258.1266 +     * are always equal when the other bytes match, given that
258.1267 +     * the hash keys are equal and that HASH_BITS >= 8.
258.1268 +     */
258.1269 +    scan += 2, match += 2;
258.1270 +    Assert(*scan == *match, "match[2]?");
258.1271 +
258.1272 +    /* We check for insufficient lookahead only every 8th comparison;
258.1273 +     * the 256th check will be made at strstart+258.
258.1274 +     */
258.1275 +    do {
258.1276 +    } while (*++scan == *++match && *++scan == *++match &&
258.1277 +             *++scan == *++match && *++scan == *++match &&
258.1278 +             *++scan == *++match && *++scan == *++match &&
258.1279 +             *++scan == *++match && *++scan == *++match &&
258.1280 +             scan < strend);
258.1281 +
258.1282 +    Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
258.1283 +
258.1284 +    len = MAX_MATCH - (int)(strend - scan);
258.1285 +
258.1286 +    if (len < MIN_MATCH) return MIN_MATCH - 1;
258.1287 +
258.1288 +    s->match_start = cur_match;
258.1289 +    return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead;
258.1290 +}
258.1291 +
258.1292 +#endif /* FASTEST */
258.1293 +
258.1294 +#ifdef DEBUG
258.1295 +/* ===========================================================================
258.1296 + * Check that the match at match_start is indeed a match.
258.1297 + */
258.1298 +local void check_match(s, start, match, length)
258.1299 +    deflate_state *s;
258.1300 +    IPos start, match;
258.1301 +    int length;
258.1302 +{
258.1303 +    /* check that the match is indeed a match */
258.1304 +    if (zmemcmp(s->window + match,
258.1305 +                s->window + start, length) != EQUAL) {
258.1306 +        fprintf(stderr, " start %u, match %u, length %d\n",
258.1307 +                start, match, length);
258.1308 +        do {
258.1309 +            fprintf(stderr, "%c%c", s->window[match++], s->window[start++]);
258.1310 +        } while (--length != 0);
258.1311 +        z_error("invalid match");
258.1312 +    }
258.1313 +    if (z_verbose > 1) {
258.1314 +        fprintf(stderr,"\\[%d,%d]", start-match, length);
258.1315 +        do { putc(s->window[start++], stderr); } while (--length != 0);
258.1316 +    }
258.1317 +}
258.1318 +#else
258.1319 +#  define check_match(s, start, match, length)
258.1320 +#endif /* DEBUG */
258.1321 +
258.1322 +/* ===========================================================================
258.1323 + * Fill the window when the lookahead becomes insufficient.
258.1324 + * Updates strstart and lookahead.
258.1325 + *
258.1326 + * IN assertion: lookahead < MIN_LOOKAHEAD
258.1327 + * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
258.1328 + *    At least one byte has been read, or avail_in == 0; reads are
258.1329 + *    performed for at least two bytes (required for the zip translate_eol
258.1330 + *    option -- not supported here).
258.1331 + */
258.1332 +local void fill_window(s)
258.1333 +    deflate_state *s;
258.1334 +{
258.1335 +    register unsigned n, m;
258.1336 +    register Posf *p;
258.1337 +    unsigned more;    /* Amount of free space at the end of the window. */
258.1338 +    uInt wsize = s->w_size;
258.1339 +
258.1340 +    do {
258.1341 +        more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
258.1342 +
258.1343 +        /* Deal with !@#$% 64K limit: */
258.1344 +        if (sizeof(int) <= 2) {
258.1345 +            if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
258.1346 +                more = wsize;
258.1347 +
258.1348 +            } else if (more == (unsigned)(-1)) {
258.1349 +                /* Very unlikely, but possible on 16 bit machine if
258.1350 +                 * strstart == 0 && lookahead == 1 (input done a byte at time)
258.1351 +                 */
258.1352 +                more--;
258.1353 +            }
258.1354 +        }
258.1355 +
258.1356 +        /* If the window is almost full and there is insufficient lookahead,
258.1357 +         * move the upper half to the lower one to make room in the upper half.
258.1358 +         */
258.1359 +        if (s->strstart >= wsize+MAX_DIST(s)) {
258.1360 +
258.1361 +            zmemcpy(s->window, s->window+wsize, (unsigned)wsize);
258.1362 +            s->match_start -= wsize;
258.1363 +            s->strstart    -= wsize; /* we now have strstart >= MAX_DIST */
258.1364 +            s->block_start -= (long) wsize;
258.1365 +
258.1366 +            /* Slide the hash table (could be avoided with 32 bit values
258.1367 +               at the expense of memory usage). We slide even when level == 0
258.1368 +               to keep the hash table consistent if we switch back to level > 0
258.1369 +               later. (Using level 0 permanently is not an optimal usage of
258.1370 +               zlib, so we don't care about this pathological case.)
258.1371 +             */
258.1372 +            n = s->hash_size;
258.1373 +            p = &s->head[n];
258.1374 +            do {
258.1375 +                m = *--p;
258.1376 +                *p = (Pos)(m >= wsize ? m-wsize : NIL);
258.1377 +            } while (--n);
258.1378 +
258.1379 +            n = wsize;
258.1380 +#ifndef FASTEST
258.1381 +            p = &s->prev[n];
258.1382 +            do {
258.1383 +                m = *--p;
258.1384 +                *p = (Pos)(m >= wsize ? m-wsize : NIL);
258.1385 +                /* If n is not on any hash chain, prev[n] is garbage but
258.1386 +                 * its value will never be used.
258.1387 +                 */
258.1388 +            } while (--n);
258.1389 +#endif
258.1390 +            more += wsize;
258.1391 +        }
258.1392 +        if (s->strm->avail_in == 0) return;
258.1393 +
258.1394 +        /* If there was no sliding:
258.1395 +         *    strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
258.1396 +         *    more == window_size - lookahead - strstart
258.1397 +         * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
258.1398 +         * => more >= window_size - 2*WSIZE + 2
258.1399 +         * In the BIG_MEM or MMAP case (not yet supported),
258.1400 +         *   window_size == input_size + MIN_LOOKAHEAD  &&
258.1401 +         *   strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
258.1402 +         * Otherwise, window_size == 2*WSIZE so more >= 2.
258.1403 +         * If there was sliding, more >= WSIZE. So in all cases, more >= 2.
258.1404 +         */
258.1405 +        Assert(more >= 2, "more < 2");
258.1406 +
258.1407 +        n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
258.1408 +        s->lookahead += n;
258.1409 +
258.1410 +        /* Initialize the hash value now that we have some input: */
258.1411 +        if (s->lookahead >= MIN_MATCH) {
258.1412 +            s->ins_h = s->window[s->strstart];
258.1413 +            UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
258.1414 +#if MIN_MATCH != 3
258.1415 +            Call UPDATE_HASH() MIN_MATCH-3 more times
258.1416 +#endif
258.1417 +        }
258.1418 +        /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
258.1419 +         * but this is not important since only literal bytes will be emitted.
258.1420 +         */
258.1421 +
258.1422 +    } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
258.1423 +
258.1424 +    /* If the WIN_INIT bytes after the end of the current data have never been
258.1425 +     * written, then zero those bytes in order to avoid memory check reports of
258.1426 +     * the use of uninitialized (or uninitialised as Julian writes) bytes by
258.1427 +     * the longest match routines.  Update the high water mark for the next
258.1428 +     * time through here.  WIN_INIT is set to MAX_MATCH since the longest match
258.1429 +     * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
258.1430 +     */
258.1431 +    if (s->high_water < s->window_size) {
258.1432 +        ulg curr = s->strstart + (ulg)(s->lookahead);
258.1433 +        ulg init;
258.1434 +
258.1435 +        if (s->high_water < curr) {
258.1436 +            /* Previous high water mark below current data -- zero WIN_INIT
258.1437 +             * bytes or up to end of window, whichever is less.
258.1438 +             */
258.1439 +            init = s->window_size - curr;
258.1440 +            if (init > WIN_INIT)
258.1441 +                init = WIN_INIT;
258.1442 +            zmemzero(s->window + curr, (unsigned)init);
258.1443 +            s->high_water = curr + init;
258.1444 +        }
258.1445 +        else if (s->high_water < (ulg)curr + WIN_INIT) {
258.1446 +            /* High water mark at or above current data, but below current data
258.1447 +             * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
258.1448 +             * to end of window, whichever is less.
258.1449 +             */
258.1450 +            init = (ulg)curr + WIN_INIT - s->high_water;
258.1451 +            if (init > s->window_size - s->high_water)
258.1452 +                init = s->window_size - s->high_water;
258.1453 +            zmemzero(s->window + s->high_water, (unsigned)init);
258.1454 +            s->high_water += init;
258.1455 +        }
258.1456 +    }
258.1457 +}
258.1458 +
258.1459 +/* ===========================================================================
258.1460 + * Flush the current block, with given end-of-file flag.
258.1461 + * IN assertion: strstart is set to the end of the current match.
258.1462 + */
258.1463 +#define FLUSH_BLOCK_ONLY(s, last) { \
258.1464 +   _tr_flush_block(s, (s->block_start >= 0L ? \
258.1465 +                   (charf *)&s->window[(unsigned)s->block_start] : \
258.1466 +                   (charf *)Z_NULL), \
258.1467 +                (ulg)((long)s->strstart - s->block_start), \
258.1468 +                (last)); \
258.1469 +   s->block_start = s->strstart; \
258.1470 +   flush_pending(s->strm); \
258.1471 +   Tracev((stderr,"[FLUSH]")); \
258.1472 +}
258.1473 +
258.1474 +/* Same but force premature exit if necessary. */
258.1475 +#define FLUSH_BLOCK(s, last) { \
258.1476 +   FLUSH_BLOCK_ONLY(s, last); \
258.1477 +   if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
258.1478 +}
258.1479 +
258.1480 +/* ===========================================================================
258.1481 + * Copy without compression as much as possible from the input stream, return
258.1482 + * the current block state.
258.1483 + * This function does not insert new strings in the dictionary since
258.1484 + * uncompressible data is probably not useful. This function is used
258.1485 + * only for the level=0 compression option.
258.1486 + * NOTE: this function should be optimized to avoid extra copying from
258.1487 + * window to pending_buf.
258.1488 + */
258.1489 +local block_state deflate_stored(s, flush)
258.1490 +    deflate_state *s;
258.1491 +    int flush;
258.1492 +{
258.1493 +    /* Stored blocks are limited to 0xffff bytes, pending_buf is limited
258.1494 +     * to pending_buf_size, and each stored block has a 5 byte header:
258.1495 +     */
258.1496 +    ulg max_block_size = 0xffff;
258.1497 +    ulg max_start;
258.1498 +
258.1499 +    if (max_block_size > s->pending_buf_size - 5) {
258.1500 +        max_block_size = s->pending_buf_size - 5;
258.1501 +    }
258.1502 +
258.1503 +    /* Copy as much as possible from input to output: */
258.1504 +    for (;;) {
258.1505 +        /* Fill the window as much as possible: */
258.1506 +        if (s->lookahead <= 1) {
258.1507 +
258.1508 +            Assert(s->strstart < s->w_size+MAX_DIST(s) ||
258.1509 +                   s->block_start >= (long)s->w_size, "slide too late");
258.1510 +
258.1511 +            fill_window(s);
258.1512 +            if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more;
258.1513 +
258.1514 +            if (s->lookahead == 0) break; /* flush the current block */
258.1515 +        }
258.1516 +        Assert(s->block_start >= 0L, "block gone");
258.1517 +
258.1518 +        s->strstart += s->lookahead;
258.1519 +        s->lookahead = 0;
258.1520 +
258.1521 +        /* Emit a stored block if pending_buf will be full: */
258.1522 +        max_start = s->block_start + max_block_size;
258.1523 +        if (s->strstart == 0 || (ulg)s->strstart >= max_start) {
258.1524 +            /* strstart == 0 is possible when wraparound on 16-bit machine */
258.1525 +            s->lookahead = (uInt)(s->strstart - max_start);
258.1526 +            s->strstart = (uInt)max_start;
258.1527 +            FLUSH_BLOCK(s, 0);
258.1528 +        }
258.1529 +        /* Flush if we may have to slide, otherwise block_start may become
258.1530 +         * negative and the data will be gone:
258.1531 +         */
258.1532 +        if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) {
258.1533 +            FLUSH_BLOCK(s, 0);
258.1534 +        }
258.1535 +    }
258.1536 +    FLUSH_BLOCK(s, flush == Z_FINISH);
258.1537 +    return flush == Z_FINISH ? finish_done : block_done;
258.1538 +}
258.1539 +
258.1540 +/* ===========================================================================
258.1541 + * Compress as much as possible from the input stream, return the current
258.1542 + * block state.
258.1543 + * This function does not perform lazy evaluation of matches and inserts
258.1544 + * new strings in the dictionary only for unmatched strings or for short
258.1545 + * matches. It is used only for the fast compression options.
258.1546 + */
258.1547 +local block_state deflate_fast(s, flush)
258.1548 +    deflate_state *s;
258.1549 +    int flush;
258.1550 +{
258.1551 +    IPos hash_head;       /* head of the hash chain */
258.1552 +    int bflush;           /* set if current block must be flushed */
258.1553 +
258.1554 +    for (;;) {
258.1555 +        /* Make sure that we always have enough lookahead, except
258.1556 +         * at the end of the input file. We need MAX_MATCH bytes
258.1557 +         * for the next match, plus MIN_MATCH bytes to insert the
258.1558 +         * string following the next match.
258.1559 +         */
258.1560 +        if (s->lookahead < MIN_LOOKAHEAD) {
258.1561 +            fill_window(s);
258.1562 +            if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
258.1563 +                return need_more;
258.1564 +            }
258.1565 +            if (s->lookahead == 0) break; /* flush the current block */
258.1566 +        }
258.1567 +
258.1568 +        /* Insert the string window[strstart .. strstart+2] in the
258.1569 +         * dictionary, and set hash_head to the head of the hash chain:
258.1570 +         */
258.1571 +        hash_head = NIL;
258.1572 +        if (s->lookahead >= MIN_MATCH) {
258.1573 +            INSERT_STRING(s, s->strstart, hash_head);
258.1574 +        }
258.1575 +
258.1576 +        /* Find the longest match, discarding those <= prev_length.
258.1577 +         * At this point we have always match_length < MIN_MATCH
258.1578 +         */
258.1579 +        if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) {
258.1580 +            /* To simplify the code, we prevent matches with the string
258.1581 +             * of window index 0 (in particular we have to avoid a match
258.1582 +             * of the string with itself at the start of the input file).
258.1583 +             */
258.1584 +            s->match_length = longest_match (s, hash_head);
258.1585 +            /* longest_match() sets match_start */
258.1586 +        }
258.1587 +        if (s->match_length >= MIN_MATCH) {
258.1588 +            check_match(s, s->strstart, s->match_start, s->match_length);
258.1589 +
258.1590 +            _tr_tally_dist(s, s->strstart - s->match_start,
258.1591 +                           s->match_length - MIN_MATCH, bflush);
258.1592 +
258.1593 +            s->lookahead -= s->match_length;
258.1594 +
258.1595 +            /* Insert new strings in the hash table only if the match length
258.1596 +             * is not too large. This saves time but degrades compression.
258.1597 +             */
258.1598 +#ifndef FASTEST
258.1599 +            if (s->match_length <= s->max_insert_length &&
258.1600 +                s->lookahead >= MIN_MATCH) {
258.1601 +                s->match_length--; /* string at strstart already in table */
258.1602 +                do {
258.1603 +                    s->strstart++;
258.1604 +                    INSERT_STRING(s, s->strstart, hash_head);
258.1605 +                    /* strstart never exceeds WSIZE-MAX_MATCH, so there are
258.1606 +                     * always MIN_MATCH bytes ahead.
258.1607 +                     */
258.1608 +                } while (--s->match_length != 0);
258.1609 +                s->strstart++;
258.1610 +            } else
258.1611 +#endif
258.1612 +            {
258.1613 +                s->strstart += s->match_length;
258.1614 +                s->match_length = 0;
258.1615 +                s->ins_h = s->window[s->strstart];
258.1616 +                UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
258.1617 +#if MIN_MATCH != 3
258.1618 +                Call UPDATE_HASH() MIN_MATCH-3 more times
258.1619 +#endif
258.1620 +                /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not
258.1621 +                 * matter since it will be recomputed at next deflate call.
258.1622 +                 */
258.1623 +            }
258.1624 +        } else {
258.1625 +            /* No match, output a literal byte */
258.1626 +            Tracevv((stderr,"%c", s->window[s->strstart]));
258.1627 +            _tr_tally_lit (s, s->window[s->strstart], bflush);
258.1628 +            s->lookahead--;
258.1629 +            s->strstart++;
258.1630 +        }
258.1631 +        if (bflush) FLUSH_BLOCK(s, 0);
258.1632 +    }
258.1633 +    FLUSH_BLOCK(s, flush == Z_FINISH);
258.1634 +    return flush == Z_FINISH ? finish_done : block_done;
258.1635 +}
258.1636 +
258.1637 +#ifndef FASTEST
258.1638 +/* ===========================================================================
258.1639 + * Same as above, but achieves better compression. We use a lazy
258.1640 + * evaluation for matches: a match is finally adopted only if there is
258.1641 + * no better match at the next window position.
258.1642 + */
258.1643 +local block_state deflate_slow(s, flush)
258.1644 +    deflate_state *s;
258.1645 +    int flush;
258.1646 +{
258.1647 +    IPos hash_head;          /* head of hash chain */
258.1648 +    int bflush;              /* set if current block must be flushed */
258.1649 +
258.1650 +    /* Process the input block. */
258.1651 +    for (;;) {
258.1652 +        /* Make sure that we always have enough lookahead, except
258.1653 +         * at the end of the input file. We need MAX_MATCH bytes
258.1654 +         * for the next match, plus MIN_MATCH bytes to insert the
258.1655 +         * string following the next match.
258.1656 +         */
258.1657 +        if (s->lookahead < MIN_LOOKAHEAD) {
258.1658 +            fill_window(s);
258.1659 +            if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
258.1660 +                return need_more;
258.1661 +            }
258.1662 +            if (s->lookahead == 0) break; /* flush the current block */
258.1663 +        }
258.1664 +
258.1665 +        /* Insert the string window[strstart .. strstart+2] in the
258.1666 +         * dictionary, and set hash_head to the head of the hash chain:
258.1667 +         */
258.1668 +        hash_head = NIL;
258.1669 +        if (s->lookahead >= MIN_MATCH) {
258.1670 +            INSERT_STRING(s, s->strstart, hash_head);
258.1671 +        }
258.1672 +
258.1673 +        /* Find the longest match, discarding those <= prev_length.
258.1674 +         */
258.1675 +        s->prev_length = s->match_length, s->prev_match = s->match_start;
258.1676 +        s->match_length = MIN_MATCH-1;
258.1677 +
258.1678 +        if (hash_head != NIL && s->prev_length < s->max_lazy_match &&
258.1679 +            s->strstart - hash_head <= MAX_DIST(s)) {
258.1680 +            /* To simplify the code, we prevent matches with the string
258.1681 +             * of window index 0 (in particular we have to avoid a match
258.1682 +             * of the string with itself at the start of the input file).
258.1683 +             */
258.1684 +            s->match_length = longest_match (s, hash_head);
258.1685 +            /* longest_match() sets match_start */
258.1686 +
258.1687 +            if (s->match_length <= 5 && (s->strategy == Z_FILTERED
258.1688 +#if TOO_FAR <= 32767
258.1689 +                || (s->match_length == MIN_MATCH &&
258.1690 +                    s->strstart - s->match_start > TOO_FAR)
258.1691 +#endif
258.1692 +                )) {
258.1693 +
258.1694 +                /* If prev_match is also MIN_MATCH, match_start is garbage
258.1695 +                 * but we will ignore the current match anyway.
258.1696 +                 */
258.1697 +                s->match_length = MIN_MATCH-1;
258.1698 +            }
258.1699 +        }
258.1700 +        /* If there was a match at the previous step and the current
258.1701 +         * match is not better, output the previous match:
258.1702 +         */
258.1703 +        if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) {
258.1704 +            uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
258.1705 +            /* Do not insert strings in hash table beyond this. */
258.1706 +
258.1707 +            check_match(s, s->strstart-1, s->prev_match, s->prev_length);
258.1708 +
258.1709 +            _tr_tally_dist(s, s->strstart -1 - s->prev_match,
258.1710 +                           s->prev_length - MIN_MATCH, bflush);
258.1711 +
258.1712 +            /* Insert in hash table all strings up to the end of the match.
258.1713 +             * strstart-1 and strstart are already inserted. If there is not
258.1714 +             * enough lookahead, the last two strings are not inserted in
258.1715 +             * the hash table.
258.1716 +             */
258.1717 +            s->lookahead -= s->prev_length-1;
258.1718 +            s->prev_length -= 2;
258.1719 +            do {
258.1720 +                if (++s->strstart <= max_insert) {
258.1721 +                    INSERT_STRING(s, s->strstart, hash_head);
258.1722 +                }
258.1723 +            } while (--s->prev_length != 0);
258.1724 +            s->match_available = 0;
258.1725 +            s->match_length = MIN_MATCH-1;
258.1726 +            s->strstart++;
258.1727 +
258.1728 +            if (bflush) FLUSH_BLOCK(s, 0);
258.1729 +
258.1730 +        } else if (s->match_available) {
258.1731 +            /* If there was no match at the previous position, output a
258.1732 +             * single literal. If there was a match but the current match
258.1733 +             * is longer, truncate the previous match to a single literal.
258.1734 +             */
258.1735 +            Tracevv((stderr,"%c", s->window[s->strstart-1]));
258.1736 +            _tr_tally_lit(s, s->window[s->strstart-1], bflush);
258.1737 +            if (bflush) {
258.1738 +                FLUSH_BLOCK_ONLY(s, 0);
258.1739 +            }
258.1740 +            s->strstart++;
258.1741 +            s->lookahead--;
258.1742 +            if (s->strm->avail_out == 0) return need_more;
258.1743 +        } else {
258.1744 +            /* There is no previous match to compare with, wait for
258.1745 +             * the next step to decide.
258.1746 +             */
258.1747 +            s->match_available = 1;
258.1748 +            s->strstart++;
258.1749 +            s->lookahead--;
258.1750 +        }
258.1751 +    }
258.1752 +    Assert (flush != Z_NO_FLUSH, "no flush?");
258.1753 +    if (s->match_available) {
258.1754 +        Tracevv((stderr,"%c", s->window[s->strstart-1]));
258.1755 +        _tr_tally_lit(s, s->window[s->strstart-1], bflush);
258.1756 +        s->match_available = 0;
258.1757 +    }
258.1758 +    FLUSH_BLOCK(s, flush == Z_FINISH);
258.1759 +    return flush == Z_FINISH ? finish_done : block_done;
258.1760 +}
258.1761 +#endif /* FASTEST */
258.1762 +
258.1763 +/* ===========================================================================
258.1764 + * For Z_RLE, simply look for runs of bytes, generate matches only of distance
258.1765 + * one.  Do not maintain a hash table.  (It will be regenerated if this run of
258.1766 + * deflate switches away from Z_RLE.)
258.1767 + */
258.1768 +local block_state deflate_rle(s, flush)
258.1769 +    deflate_state *s;
258.1770 +    int flush;
258.1771 +{
258.1772 +    int bflush;             /* set if current block must be flushed */
258.1773 +    uInt prev;              /* byte at distance one to match */
258.1774 +    Bytef *scan, *strend;   /* scan goes up to strend for length of run */
258.1775 +
258.1776 +    for (;;) {
258.1777 +        /* Make sure that we always have enough lookahead, except
258.1778 +         * at the end of the input file. We need MAX_MATCH bytes
258.1779 +         * for the longest encodable run.
258.1780 +         */
258.1781 +        if (s->lookahead < MAX_MATCH) {
258.1782 +            fill_window(s);
258.1783 +            if (s->lookahead < MAX_MATCH && flush == Z_NO_FLUSH) {
258.1784 +                return need_more;
258.1785 +            }
258.1786 +            if (s->lookahead == 0) break; /* flush the current block */
258.1787 +        }
258.1788 +
258.1789 +        /* See how many times the previous byte repeats */
258.1790 +        s->match_length = 0;
258.1791 +        if (s->lookahead >= MIN_MATCH && s->strstart > 0) {
258.1792 +            scan = s->window + s->strstart - 1;
258.1793 +            prev = *scan;
258.1794 +            if (prev == *++scan && prev == *++scan && prev == *++scan) {
258.1795 +                strend = s->window + s->strstart + MAX_MATCH;
258.1796 +                do {
258.1797 +                } while (prev == *++scan && prev == *++scan &&
258.1798 +                         prev == *++scan && prev == *++scan &&
258.1799 +                         prev == *++scan && prev == *++scan &&
258.1800 +                         prev == *++scan && prev == *++scan &&
258.1801 +                         scan < strend);
258.1802 +                s->match_length = MAX_MATCH - (int)(strend - scan);
258.1803 +                if (s->match_length > s->lookahead)
258.1804 +                    s->match_length = s->lookahead;
258.1805 +            }
258.1806 +        }
258.1807 +
258.1808 +        /* Emit match if have run of MIN_MATCH or longer, else emit literal */
258.1809 +        if (s->match_length >= MIN_MATCH) {
258.1810 +            check_match(s, s->strstart, s->strstart - 1, s->match_length);
258.1811 +
258.1812 +            _tr_tally_dist(s, 1, s->match_length - MIN_MATCH, bflush);
258.1813 +
258.1814 +            s->lookahead -= s->match_length;
258.1815 +            s->strstart += s->match_length;
258.1816 +            s->match_length = 0;
258.1817 +        } else {
258.1818 +            /* No match, output a literal byte */
258.1819 +            Tracevv((stderr,"%c", s->window[s->strstart]));
258.1820 +            _tr_tally_lit (s, s->window[s->strstart], bflush);
258.1821 +            s->lookahead--;
258.1822 +            s->strstart++;
258.1823 +        }
258.1824 +        if (bflush) FLUSH_BLOCK(s, 0);
258.1825 +    }
258.1826 +    FLUSH_BLOCK(s, flush == Z_FINISH);
258.1827 +    return flush == Z_FINISH ? finish_done : block_done;
258.1828 +}
258.1829 +
258.1830 +/* ===========================================================================
258.1831 + * For Z_HUFFMAN_ONLY, do not look for matches.  Do not maintain a hash table.
258.1832 + * (It will be regenerated if this run of deflate switches away from Huffman.)
258.1833 + */
258.1834 +local block_state deflate_huff(s, flush)
258.1835 +    deflate_state *s;
258.1836 +    int flush;
258.1837 +{
258.1838 +    int bflush;             /* set if current block must be flushed */
258.1839 +
258.1840 +    for (;;) {
258.1841 +        /* Make sure that we have a literal to write. */
258.1842 +        if (s->lookahead == 0) {
258.1843 +            fill_window(s);
258.1844 +            if (s->lookahead == 0) {
258.1845 +                if (flush == Z_NO_FLUSH)
258.1846 +                    return need_more;
258.1847 +                break;      /* flush the current block */
258.1848 +            }
258.1849 +        }
258.1850 +
258.1851 +        /* Output a literal byte */
258.1852 +        s->match_length = 0;
258.1853 +        Tracevv((stderr,"%c", s->window[s->strstart]));
258.1854 +        _tr_tally_lit (s, s->window[s->strstart], bflush);
258.1855 +        s->lookahead--;
258.1856 +        s->strstart++;
258.1857 +        if (bflush) FLUSH_BLOCK(s, 0);
258.1858 +    }
258.1859 +    FLUSH_BLOCK(s, flush == Z_FINISH);
258.1860 +    return flush == Z_FINISH ? finish_done : block_done;
258.1861 +}
   259.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   259.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/deflate.h	Mon Dec 19 10:06:23 2011 -0800
   259.3 @@ -0,0 +1,366 @@
   259.4 +/*
   259.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   259.6 + *
   259.7 + * This code is free software; you can redistribute it and/or modify it
   259.8 + * under the terms of the GNU General Public License version 2 only, as
   259.9 + * published by the Free Software Foundation.  Oracle designates this
  259.10 + * particular file as subject to the "Classpath" exception as provided
  259.11 + * by Oracle in the LICENSE file that accompanied this code.
  259.12 + *
  259.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
  259.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  259.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  259.16 + * version 2 for more details (a copy is included in the LICENSE file that
  259.17 + * accompanied this code).
  259.18 + *
  259.19 + * You should have received a copy of the GNU General Public License version
  259.20 + * 2 along with this work; if not, write to the Free Software Foundation,
  259.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  259.22 + *
  259.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  259.24 + * or visit www.oracle.com if you need additional information or have any
  259.25 + * questions.
  259.26 + */
  259.27 +
  259.28 +/* deflate.h -- internal compression state
  259.29 + * Copyright (C) 1995-2010 Jean-loup Gailly
  259.30 + * For conditions of distribution and use, see copyright notice in zlib.h
  259.31 + */
  259.32 +
  259.33 +/* WARNING: this file should *not* be used by applications. It is
  259.34 +   part of the implementation of the compression library and is
  259.35 +   subject to change. Applications should only use zlib.h.
  259.36 + */
  259.37 +
  259.38 +/* @(#) $Id$ */
  259.39 +
  259.40 +#ifndef DEFLATE_H
  259.41 +#define DEFLATE_H
  259.42 +
  259.43 +#include "zutil.h"
  259.44 +
  259.45 +/* define NO_GZIP when compiling if you want to disable gzip header and
  259.46 +   trailer creation by deflate().  NO_GZIP would be used to avoid linking in
  259.47 +   the crc code when it is not needed.  For shared libraries, gzip encoding
  259.48 +   should be left enabled. */
  259.49 +#ifndef NO_GZIP
  259.50 +#  define GZIP
  259.51 +#endif
  259.52 +
  259.53 +/* ===========================================================================
  259.54 + * Internal compression state.
  259.55 + */
  259.56 +
  259.57 +#define LENGTH_CODES 29
  259.58 +/* number of length codes, not counting the special END_BLOCK code */
  259.59 +
  259.60 +#define LITERALS  256
  259.61 +/* number of literal bytes 0..255 */
  259.62 +
  259.63 +#define L_CODES (LITERALS+1+LENGTH_CODES)
  259.64 +/* number of Literal or Length codes, including the END_BLOCK code */
  259.65 +
  259.66 +#define D_CODES   30
  259.67 +/* number of distance codes */
  259.68 +
  259.69 +#define BL_CODES  19
  259.70 +/* number of codes used to transfer the bit lengths */
  259.71 +
  259.72 +#define HEAP_SIZE (2*L_CODES+1)
  259.73 +/* maximum heap size */
  259.74 +
  259.75 +#define MAX_BITS 15
  259.76 +/* All codes must not exceed MAX_BITS bits */
  259.77 +
  259.78 +#define INIT_STATE    42
  259.79 +#define EXTRA_STATE   69
  259.80 +#define NAME_STATE    73
  259.81 +#define COMMENT_STATE 91
  259.82 +#define HCRC_STATE   103
  259.83 +#define BUSY_STATE   113
  259.84 +#define FINISH_STATE 666
  259.85 +/* Stream status */
  259.86 +
  259.87 +
  259.88 +/* Data structure describing a single value and its code string. */
  259.89 +typedef struct ct_data_s {
  259.90 +    union {
  259.91 +        ush  freq;       /* frequency count */
  259.92 +        ush  code;       /* bit string */
  259.93 +    } fc;
  259.94 +    union {
  259.95 +        ush  dad;        /* father node in Huffman tree */
  259.96 +        ush  len;        /* length of bit string */
  259.97 +    } dl;
  259.98 +} FAR ct_data;
  259.99 +
 259.100 +#define Freq fc.freq
 259.101 +#define Code fc.code
 259.102 +#define Dad  dl.dad
 259.103 +#define Len  dl.len
 259.104 +
 259.105 +typedef struct static_tree_desc_s  static_tree_desc;
 259.106 +
 259.107 +typedef struct tree_desc_s {
 259.108 +    ct_data *dyn_tree;           /* the dynamic tree */
 259.109 +    int     max_code;            /* largest code with non zero frequency */
 259.110 +    static_tree_desc *stat_desc; /* the corresponding static tree */
 259.111 +} FAR tree_desc;
 259.112 +
 259.113 +typedef ush Pos;
 259.114 +typedef Pos FAR Posf;
 259.115 +typedef unsigned IPos;
 259.116 +
 259.117 +/* A Pos is an index in the character window. We use short instead of int to
 259.118 + * save space in the various tables. IPos is used only for parameter passing.
 259.119 + */
 259.120 +
 259.121 +typedef struct internal_state {
 259.122 +    z_streamp strm;      /* pointer back to this zlib stream */
 259.123 +    int   status;        /* as the name implies */
 259.124 +    Bytef *pending_buf;  /* output still pending */
 259.125 +    ulg   pending_buf_size; /* size of pending_buf */
 259.126 +    Bytef *pending_out;  /* next pending byte to output to the stream */
 259.127 +    uInt   pending;      /* nb of bytes in the pending buffer */
 259.128 +    int   wrap;          /* bit 0 true for zlib, bit 1 true for gzip */
 259.129 +    gz_headerp  gzhead;  /* gzip header information to write */
 259.130 +    uInt   gzindex;      /* where in extra, name, or comment */
 259.131 +    Byte  method;        /* STORED (for zip only) or DEFLATED */
 259.132 +    int   last_flush;    /* value of flush param for previous deflate call */
 259.133 +
 259.134 +                /* used by deflate.c: */
 259.135 +
 259.136 +    uInt  w_size;        /* LZ77 window size (32K by default) */
 259.137 +    uInt  w_bits;        /* log2(w_size)  (8..16) */
 259.138 +    uInt  w_mask;        /* w_size - 1 */
 259.139 +
 259.140 +    Bytef *window;
 259.141 +    /* Sliding window. Input bytes are read into the second half of the window,
 259.142 +     * and move to the first half later to keep a dictionary of at least wSize
 259.143 +     * bytes. With this organization, matches are limited to a distance of
 259.144 +     * wSize-MAX_MATCH bytes, but this ensures that IO is always
 259.145 +     * performed with a length multiple of the block size. Also, it limits
 259.146 +     * the window size to 64K, which is quite useful on MSDOS.
 259.147 +     * To do: use the user input buffer as sliding window.
 259.148 +     */
 259.149 +
 259.150 +    ulg window_size;
 259.151 +    /* Actual size of window: 2*wSize, except when the user input buffer
 259.152 +     * is directly used as sliding window.
 259.153 +     */
 259.154 +
 259.155 +    Posf *prev;
 259.156 +    /* Link to older string with same hash index. To limit the size of this
 259.157 +     * array to 64K, this link is maintained only for the last 32K strings.
 259.158 +     * An index in this array is thus a window index modulo 32K.
 259.159 +     */
 259.160 +
 259.161 +    Posf *head; /* Heads of the hash chains or NIL. */
 259.162 +
 259.163 +    uInt  ins_h;          /* hash index of string to be inserted */
 259.164 +    uInt  hash_size;      /* number of elements in hash table */
 259.165 +    uInt  hash_bits;      /* log2(hash_size) */
 259.166 +    uInt  hash_mask;      /* hash_size-1 */
 259.167 +
 259.168 +    uInt  hash_shift;
 259.169 +    /* Number of bits by which ins_h must be shifted at each input
 259.170 +     * step. It must be such that after MIN_MATCH steps, the oldest
 259.171 +     * byte no longer takes part in the hash key, that is:
 259.172 +     *   hash_shift * MIN_MATCH >= hash_bits
 259.173 +     */
 259.174 +
 259.175 +    long block_start;
 259.176 +    /* Window position at the beginning of the current output block. Gets
 259.177 +     * negative when the window is moved backwards.
 259.178 +     */
 259.179 +
 259.180 +    uInt match_length;           /* length of best match */
 259.181 +    IPos prev_match;             /* previous match */
 259.182 +    int match_available;         /* set if previous match exists */
 259.183 +    uInt strstart;               /* start of string to insert */
 259.184 +    uInt match_start;            /* start of matching string */
 259.185 +    uInt lookahead;              /* number of valid bytes ahead in window */
 259.186 +
 259.187 +    uInt prev_length;
 259.188 +    /* Length of the best match at previous step. Matches not greater than this
 259.189 +     * are discarded. This is used in the lazy match evaluation.
 259.190 +     */
 259.191 +
 259.192 +    uInt max_chain_length;
 259.193 +    /* To speed up deflation, hash chains are never searched beyond this
 259.194 +     * length.  A higher limit improves compression ratio but degrades the
 259.195 +     * speed.
 259.196 +     */
 259.197 +
 259.198 +    uInt max_lazy_match;
 259.199 +    /* Attempt to find a better match only when the current match is strictly
 259.200 +     * smaller than this value. This mechanism is used only for compression
 259.201 +     * levels >= 4.
 259.202 +     */
 259.203 +#   define max_insert_length  max_lazy_match
 259.204 +    /* Insert new strings in the hash table only if the match length is not
 259.205 +     * greater than this length. This saves time but degrades compression.
 259.206 +     * max_insert_length is used only for compression levels <= 3.
 259.207 +     */
 259.208 +
 259.209 +    int level;    /* compression level (1..9) */
 259.210 +    int strategy; /* favor or force Huffman coding*/
 259.211 +
 259.212 +    uInt good_match;
 259.213 +    /* Use a faster search when the previous match is longer than this */
 259.214 +
 259.215 +    int nice_match; /* Stop searching when current match exceeds this */
 259.216 +
 259.217 +                /* used by trees.c: */
 259.218 +    /* Didn't use ct_data typedef below to supress compiler warning */
 259.219 +    struct ct_data_s dyn_ltree[HEAP_SIZE];   /* literal and length tree */
 259.220 +    struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
 259.221 +    struct ct_data_s bl_tree[2*BL_CODES+1];  /* Huffman tree for bit lengths */
 259.222 +
 259.223 +    struct tree_desc_s l_desc;               /* desc. for literal tree */
 259.224 +    struct tree_desc_s d_desc;               /* desc. for distance tree */
 259.225 +    struct tree_desc_s bl_desc;              /* desc. for bit length tree */
 259.226 +
 259.227 +    ush bl_count[MAX_BITS+1];
 259.228 +    /* number of codes at each bit length for an optimal tree */
 259.229 +
 259.230 +    int heap[2*L_CODES+1];      /* heap used to build the Huffman trees */
 259.231 +    int heap_len;               /* number of elements in the heap */
 259.232 +    int heap_max;               /* element of largest frequency */
 259.233 +    /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
 259.234 +     * The same heap array is used to build all trees.
 259.235 +     */
 259.236 +
 259.237 +    uch depth[2*L_CODES+1];
 259.238 +    /* Depth of each subtree used as tie breaker for trees of equal frequency
 259.239 +     */
 259.240 +
 259.241 +    uchf *l_buf;          /* buffer for literals or lengths */
 259.242 +
 259.243 +    uInt  lit_bufsize;
 259.244 +    /* Size of match buffer for literals/lengths.  There are 4 reasons for
 259.245 +     * limiting lit_bufsize to 64K:
 259.246 +     *   - frequencies can be kept in 16 bit counters
 259.247 +     *   - if compression is not successful for the first block, all input
 259.248 +     *     data is still in the window so we can still emit a stored block even
 259.249 +     *     when input comes from standard input.  (This can also be done for
 259.250 +     *     all blocks if lit_bufsize is not greater than 32K.)
 259.251 +     *   - if compression is not successful for a file smaller than 64K, we can
 259.252 +     *     even emit a stored file instead of a stored block (saving 5 bytes).
 259.253 +     *     This is applicable only for zip (not gzip or zlib).
 259.254 +     *   - creating new Huffman trees less frequently may not provide fast
 259.255 +     *     adaptation to changes in the input data statistics. (Take for
 259.256 +     *     example a binary file with poorly compressible code followed by
 259.257 +     *     a highly compressible string table.) Smaller buffer sizes give
 259.258 +     *     fast adaptation but have of course the overhead of transmitting
 259.259 +     *     trees more frequently.
 259.260 +     *   - I can't count above 4
 259.261 +     */
 259.262 +
 259.263 +    uInt last_lit;      /* running index in l_buf */
 259.264 +
 259.265 +    ushf *d_buf;
 259.266 +    /* Buffer for distances. To simplify the code, d_buf and l_buf have
 259.267 +     * the same number of elements. To use different lengths, an extra flag
 259.268 +     * array would be necessary.
 259.269 +     */
 259.270 +
 259.271 +    ulg opt_len;        /* bit length of current block with optimal trees */
 259.272 +    ulg static_len;     /* bit length of current block with static trees */
 259.273 +    uInt matches;       /* number of string matches in current block */
 259.274 +    int last_eob_len;   /* bit length of EOB code for last block */
 259.275 +
 259.276 +#ifdef DEBUG
 259.277 +    ulg compressed_len; /* total bit length of compressed file mod 2^32 */
 259.278 +    ulg bits_sent;      /* bit length of compressed data sent mod 2^32 */
 259.279 +#endif
 259.280 +
 259.281 +    ush bi_buf;
 259.282 +    /* Output buffer. bits are inserted starting at the bottom (least
 259.283 +     * significant bits).
 259.284 +     */
 259.285 +    int bi_valid;
 259.286 +    /* Number of valid bits in bi_buf.  All bits above the last valid bit
 259.287 +     * are always zero.
 259.288 +     */
 259.289 +
 259.290 +    ulg high_water;
 259.291 +    /* High water mark offset in window for initialized bytes -- bytes above
 259.292 +     * this are set to zero in order to avoid memory check warnings when
 259.293 +     * longest match routines access bytes past the input.  This is then
 259.294 +     * updated to the new high water mark.
 259.295 +     */
 259.296 +
 259.297 +} FAR deflate_state;
 259.298 +
 259.299 +/* Output a byte on the stream.
 259.300 + * IN assertion: there is enough room in pending_buf.
 259.301 + */
 259.302 +#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);}
 259.303 +
 259.304 +
 259.305 +#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
 259.306 +/* Minimum amount of lookahead, except at the end of the input file.
 259.307 + * See deflate.c for comments about the MIN_MATCH+1.
 259.308 + */
 259.309 +
 259.310 +#define MAX_DIST(s)  ((s)->w_size-MIN_LOOKAHEAD)
 259.311 +/* In order to simplify the code, particularly on 16 bit machines, match
 259.312 + * distances are limited to MAX_DIST instead of WSIZE.
 259.313 + */
 259.314 +
 259.315 +#define WIN_INIT MAX_MATCH
 259.316 +/* Number of bytes after end of data in window to initialize in order to avoid
 259.317 +   memory checker errors from longest match routines */
 259.318 +
 259.319 +        /* in trees.c */
 259.320 +void ZLIB_INTERNAL _tr_init OF((deflate_state *s));
 259.321 +int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
 259.322 +void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf,
 259.323 +                        ulg stored_len, int last));
 259.324 +void ZLIB_INTERNAL _tr_align OF((deflate_state *s));
 259.325 +void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
 259.326 +                        ulg stored_len, int last));
 259.327 +
 259.328 +#define d_code(dist) \
 259.329 +   ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
 259.330 +/* Mapping from a distance to a distance code. dist is the distance - 1 and
 259.331 + * must not have side effects. _dist_code[256] and _dist_code[257] are never
 259.332 + * used.
 259.333 + */
 259.334 +
 259.335 +#ifndef DEBUG
 259.336 +/* Inline versions of _tr_tally for speed: */
 259.337 +
 259.338 +#if defined(GEN_TREES_H) || !defined(STDC)
 259.339 +  extern uch ZLIB_INTERNAL _length_code[];
 259.340 +  extern uch ZLIB_INTERNAL _dist_code[];
 259.341 +#else
 259.342 +  extern const uch ZLIB_INTERNAL _length_code[];
 259.343 +  extern const uch ZLIB_INTERNAL _dist_code[];
 259.344 +#endif
 259.345 +
 259.346 +# define _tr_tally_lit(s, c, flush) \
 259.347 +  { uch cc = (c); \
 259.348 +    s->d_buf[s->last_lit] = 0; \
 259.349 +    s->l_buf[s->last_lit++] = cc; \
 259.350 +    s->dyn_ltree[cc].Freq++; \
 259.351 +    flush = (s->last_lit == s->lit_bufsize-1); \
 259.352 +   }
 259.353 +# define _tr_tally_dist(s, distance, length, flush) \
 259.354 +  { uch len = (length); \
 259.355 +    ush dist = (distance); \
 259.356 +    s->d_buf[s->last_lit] = dist; \
 259.357 +    s->l_buf[s->last_lit++] = len; \
 259.358 +    dist--; \
 259.359 +    s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
 259.360 +    s->dyn_dtree[d_code(dist)].Freq++; \
 259.361 +    flush = (s->last_lit == s->lit_bufsize-1); \
 259.362 +  }
 259.363 +#else
 259.364 +# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
 259.365 +# define _tr_tally_dist(s, distance, length, flush) \
 259.366 +              flush = _tr_tally(s, distance, length)
 259.367 +#endif
 259.368 +
 259.369 +#endif /* DEFLATE_H */
   260.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   260.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/gzclose.c	Mon Dec 19 10:06:23 2011 -0800
   260.3 @@ -0,0 +1,49 @@
   260.4 +/*
   260.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   260.6 + *
   260.7 + * This code is free software; you can redistribute it and/or modify it
   260.8 + * under the terms of the GNU General Public License version 2 only, as
   260.9 + * published by the Free Software Foundation.  Oracle designates this
  260.10 + * particular file as subject to the "Classpath" exception as provided
  260.11 + * by Oracle in the LICENSE file that accompanied this code.
  260.12 + *
  260.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
  260.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  260.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  260.16 + * version 2 for more details (a copy is included in the LICENSE file that
  260.17 + * accompanied this code).
  260.18 + *
  260.19 + * You should have received a copy of the GNU General Public License version
  260.20 + * 2 along with this work; if not, write to the Free Software Foundation,
  260.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  260.22 + *
  260.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  260.24 + * or visit www.oracle.com if you need additional information or have any
  260.25 + * questions.
  260.26 + */
  260.27 +
  260.28 +/* gzclose.c -- zlib gzclose() function
  260.29 + * Copyright (C) 2004, 2010 Mark Adler
  260.30 + * For conditions of distribution and use, see copyright notice in zlib.h
  260.31 + */
  260.32 +
  260.33 +#include "gzguts.h"
  260.34 +
  260.35 +/* gzclose() is in a separate file so that it is linked in only if it is used.
  260.36 +   That way the other gzclose functions can be used instead to avoid linking in
  260.37 +   unneeded compression or decompression routines. */
  260.38 +int ZEXPORT gzclose(file)
  260.39 +    gzFile file;
  260.40 +{
  260.41 +#ifndef NO_GZCOMPRESS
  260.42 +    gz_statep state;
  260.43 +
  260.44 +    if (file == NULL)
  260.45 +        return Z_STREAM_ERROR;
  260.46 +    state = (gz_statep)file;
  260.47 +
  260.48 +    return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file);
  260.49 +#else
  260.50 +    return gzclose_r(file);
  260.51 +#endif
  260.52 +}
   261.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   261.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/gzguts.h	Mon Dec 19 10:06:23 2011 -0800
   261.3 @@ -0,0 +1,156 @@
   261.4 +/*
   261.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   261.6 + *
   261.7 + * This code is free software; you can redistribute it and/or modify it
   261.8 + * under the terms of the GNU General Public License version 2 only, as
   261.9 + * published by the Free Software Foundation.  Oracle designates this
  261.10 + * particular file as subject to the "Classpath" exception as provided
  261.11 + * by Oracle in the LICENSE file that accompanied this code.
  261.12 + *
  261.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
  261.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  261.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  261.16 + * version 2 for more details (a copy is included in the LICENSE file that
  261.17 + * accompanied this code).
  261.18 + *
  261.19 + * You should have received a copy of the GNU General Public License version
  261.20 + * 2 along with this work; if not, write to the Free Software Foundation,
  261.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  261.22 + *
  261.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  261.24 + * or visit www.oracle.com if you need additional information or have any
  261.25 + * questions.
  261.26 + */
  261.27 +
  261.28 +/* gzguts.h -- zlib internal header definitions for gz* operations
  261.29 + * Copyright (C) 2004, 2005, 2010 Mark Adler
  261.30 + * For conditions of distribution and use, see copyright notice in zlib.h
  261.31 + */
  261.32 +
  261.33 +#ifdef _LARGEFILE64_SOURCE
  261.34 +#  ifndef _LARGEFILE_SOURCE
  261.35 +#    define _LARGEFILE_SOURCE 1
  261.36 +#  endif
  261.37 +#  ifdef _FILE_OFFSET_BITS
  261.38 +#    undef _FILE_OFFSET_BITS
  261.39 +#  endif
  261.40 +#endif
  261.41 +
  261.42 +#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ)
  261.43 +#  define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
  261.44 +#else
  261.45 +#  define ZLIB_INTERNAL
  261.46 +#endif
  261.47 +
  261.48 +#include <stdio.h>
  261.49 +#include "zlib.h"
  261.50 +#ifdef STDC
  261.51 +#  include <string.h>
  261.52 +#  include <stdlib.h>
  261.53 +#  include <limits.h>
  261.54 +#endif
  261.55 +#include <fcntl.h>
  261.56 +
  261.57 +#ifdef NO_DEFLATE       /* for compatibility with old definition */
  261.58 +#  define NO_GZCOMPRESS
  261.59 +#endif
  261.60 +
  261.61 +#ifdef _MSC_VER
  261.62 +#  include <io.h>
  261.63 +#  define vsnprintf _vsnprintf
  261.64 +#endif
  261.65 +
  261.66 +#ifndef local
  261.67 +#  define local static
  261.68 +#endif
  261.69 +/* compile with -Dlocal if your debugger can't find static symbols */
  261.70 +
  261.71 +/* gz* functions always use library allocation functions */
  261.72 +#ifndef STDC
  261.73 +  extern voidp  malloc OF((uInt size));
  261.74 +  extern void   free   OF((voidpf ptr));
  261.75 +#endif
  261.76 +
  261.77 +/* get errno and strerror definition */
  261.78 +#if defined UNDER_CE
  261.79 +#  include <windows.h>
  261.80 +#  define zstrerror() gz_strwinerror((DWORD)GetLastError())
  261.81 +#else
  261.82 +#  ifdef STDC
  261.83 +#    include <errno.h>
  261.84 +#    define zstrerror() strerror(errno)
  261.85 +#  else
  261.86 +#    define zstrerror() "stdio error (consult errno)"
  261.87 +#  endif
  261.88 +#endif
  261.89 +
  261.90 +/* provide prototypes for these when building zlib without LFS */
  261.91 +#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
  261.92 +    ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
  261.93 +    ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
  261.94 +    ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
  261.95 +    ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
  261.96 +#endif
  261.97 +
  261.98 +/* default i/o buffer size -- double this for output when reading */
  261.99 +#define GZBUFSIZE 8192
 261.100 +
 261.101 +/* gzip modes, also provide a little integrity check on the passed structure */
 261.102 +#define GZ_NONE 0
 261.103 +#define GZ_READ 7247
 261.104 +#define GZ_WRITE 31153
 261.105 +#define GZ_APPEND 1     /* mode set to GZ_WRITE after the file is opened */
 261.106 +
 261.107 +/* values for gz_state how */
 261.108 +#define LOOK 0      /* look for a gzip header */
 261.109 +#define COPY 1      /* copy input directly */
 261.110 +#define GZIP 2      /* decompress a gzip stream */
 261.111 +
 261.112 +/* internal gzip file state data structure */
 261.113 +typedef struct {
 261.114 +        /* used for both reading and writing */
 261.115 +    int mode;               /* see gzip modes above */
 261.116 +    int fd;                 /* file descriptor */
 261.117 +    char *path;             /* path or fd for error messages */
 261.118 +    z_off64_t pos;          /* current position in uncompressed data */
 261.119 +    unsigned size;          /* buffer size, zero if not allocated yet */
 261.120 +    unsigned want;          /* requested buffer size, default is GZBUFSIZE */
 261.121 +    unsigned char *in;      /* input buffer */
 261.122 +    unsigned char *out;     /* output buffer (double-sized when reading) */
 261.123 +    unsigned char *next;    /* next output data to deliver or write */
 261.124 +        /* just for reading */
 261.125 +    unsigned have;          /* amount of output data unused at next */
 261.126 +    int eof;                /* true if end of input file reached */
 261.127 +    z_off64_t start;        /* where the gzip data started, for rewinding */
 261.128 +    z_off64_t raw;          /* where the raw data started, for seeking */
 261.129 +    int how;                /* 0: get header, 1: copy, 2: decompress */
 261.130 +    int direct;             /* true if last read direct, false if gzip */
 261.131 +        /* just for writing */
 261.132 +    int level;              /* compression level */
 261.133 +    int strategy;           /* compression strategy */
 261.134 +        /* seek request */
 261.135 +    z_off64_t skip;         /* amount to skip (already rewound if backwards) */
 261.136 +    int seek;               /* true if seek request pending */
 261.137 +        /* error information */
 261.138 +    int err;                /* error code */
 261.139 +    char *msg;              /* error message */
 261.140 +        /* zlib inflate or deflate stream */
 261.141 +    z_stream strm;          /* stream structure in-place (not a pointer) */
 261.142 +} gz_state;
 261.143 +typedef gz_state FAR *gz_statep;
 261.144 +
 261.145 +/* shared functions */
 261.146 +void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *));
 261.147 +#if defined UNDER_CE
 261.148 +char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error));
 261.149 +#endif
 261.150 +
 261.151 +/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
 261.152 +   value -- needed when comparing unsigned to z_off64_t, which is signed
 261.153 +   (possible z_off64_t types off_t, off64_t, and long are all signed) */
 261.154 +#ifdef INT_MAX
 261.155 +#  define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX)
 261.156 +#else
 261.157 +unsigned ZLIB_INTERNAL gz_intmax OF((void));
 261.158 +#  define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
 261.159 +#endif
   262.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   262.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/gzlib.c	Mon Dec 19 10:06:23 2011 -0800
   262.3 @@ -0,0 +1,560 @@
   262.4 +/* NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   262.5 + *
   262.6 + * This code is free software; you can redistribute it and/or modify it
   262.7 + * under the terms of the GNU General Public License version 2 only, as
   262.8 + * published by the Free Software Foundation.  Oracle designates this
   262.9 + * particular file as subject to the "Classpath" exception as provided
  262.10 + * by Oracle in the LICENSE file that accompanied this code.
  262.11 + *
  262.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  262.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  262.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  262.15 + * version 2 for more details (a copy is included in the LICENSE file that
  262.16 + * accompanied this code).
  262.17 + *
  262.18 + * You should have received a copy of the GNU General Public License version
  262.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  262.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  262.21 + *
  262.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  262.23 + * or visit www.oracle.com if you need additional information or have any
  262.24 + * questions.
  262.25 + */
  262.26 +
  262.27 +/*
  262.28 + * Copyright (C) 2004, 2010 Mark Adler
  262.29 + * For conditions of distribution and use, see copyright notice in zlib.h
  262.30 + */
  262.31 +
  262.32 +#include "gzguts.h"
  262.33 +
  262.34 +#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
  262.35 +#  define LSEEK lseek64
  262.36 +#else
  262.37 +#  define LSEEK lseek
  262.38 +#endif
  262.39 +
  262.40 +/* Local functions */
  262.41 +local void gz_reset OF((gz_statep));
  262.42 +local gzFile gz_open OF((const char *, int, const char *));
  262.43 +
  262.44 +#if defined UNDER_CE
  262.45 +
  262.46 +/* Map the Windows error number in ERROR to a locale-dependent error message
  262.47 +   string and return a pointer to it.  Typically, the values for ERROR come
  262.48 +   from GetLastError.
  262.49 +
  262.50 +   The string pointed to shall not be modified by the application, but may be
  262.51 +   overwritten by a subsequent call to gz_strwinerror
  262.52 +
  262.53 +   The gz_strwinerror function does not change the current setting of
  262.54 +   GetLastError. */
  262.55 +char ZLIB_INTERNAL *gz_strwinerror (error)
  262.56 +     DWORD error;
  262.57 +{
  262.58 +    static char buf[1024];
  262.59 +
  262.60 +    wchar_t *msgbuf;
  262.61 +    DWORD lasterr = GetLastError();
  262.62 +    DWORD chars = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM
  262.63 +        | FORMAT_MESSAGE_ALLOCATE_BUFFER,
  262.64 +        NULL,
  262.65 +        error,
  262.66 +        0, /* Default language */
  262.67 +        (LPVOID)&msgbuf,
  262.68 +        0,
  262.69 +        NULL);
  262.70 +    if (chars != 0) {
  262.71 +        /* If there is an \r\n appended, zap it.  */
  262.72 +        if (chars >= 2
  262.73 +            && msgbuf[chars - 2] == '\r' && msgbuf[chars - 1] == '\n') {
  262.74 +            chars -= 2;
  262.75 +            msgbuf[chars] = 0;
  262.76 +        }
  262.77 +
  262.78 +        if (chars > sizeof (buf) - 1) {
  262.79 +            chars = sizeof (buf) - 1;
  262.80 +            msgbuf[chars] = 0;
  262.81 +        }
  262.82 +
  262.83 +        wcstombs(buf, msgbuf, chars + 1);
  262.84 +        LocalFree(msgbuf);
  262.85 +    }
  262.86 +    else {
  262.87 +        sprintf(buf, "unknown win32 error (%ld)", error);
  262.88 +    }
  262.89 +
  262.90 +    SetLastError(lasterr);
  262.91 +    return buf;
  262.92 +}
  262.93 +
  262.94 +#endif /* UNDER_CE */
  262.95 +
  262.96 +/* Reset gzip file state */
  262.97 +local void gz_reset(state)
  262.98 +    gz_statep state;
  262.99 +{
 262.100 +    if (state->mode == GZ_READ) {   /* for reading ... */
 262.101 +        state->have = 0;            /* no output data available */
 262.102 +        state->eof = 0;             /* not at end of file */
 262.103 +        state->how = LOOK;          /* look for gzip header */
 262.104 +        state->direct = 1;          /* default for empty file */
 262.105 +    }
 262.106 +    state->seek = 0;                /* no seek request pending */
 262.107 +    gz_error(state, Z_OK, NULL);    /* clear error */
 262.108 +    state->pos = 0;                 /* no uncompressed data yet */
 262.109 +    state->strm.avail_in = 0;       /* no input data yet */
 262.110 +}
 262.111 +
 262.112 +/* Open a gzip file either by name or file descriptor. */
 262.113 +local gzFile gz_open(path, fd, mode)
 262.114 +    const char *path;
 262.115 +    int fd;
 262.116 +    const char *mode;
 262.117 +{
 262.118 +    gz_statep state;
 262.119 +
 262.120 +    /* allocate gzFile structure to return */
 262.121 +    state = malloc(sizeof(gz_state));
 262.122 +    if (state == NULL)
 262.123 +        return NULL;
 262.124 +    state->size = 0;            /* no buffers allocated yet */
 262.125 +    state->want = GZBUFSIZE;    /* requested buffer size */
 262.126 +    state->msg = NULL;          /* no error message yet */
 262.127 +
 262.128 +    /* interpret mode */
 262.129 +    state->mode = GZ_NONE;
 262.130 +    state->level = Z_DEFAULT_COMPRESSION;
 262.131 +    state->strategy = Z_DEFAULT_STRATEGY;
 262.132 +    while (*mode) {
 262.133 +        if (*mode >= '0' && *mode <= '9')
 262.134 +            state->level = *mode - '0';
 262.135 +        else
 262.136 +            switch (*mode) {
 262.137 +            case 'r':
 262.138 +                state->mode = GZ_READ;
 262.139 +                break;
 262.140 +#ifndef NO_GZCOMPRESS
 262.141 +            case 'w':
 262.142 +                state->mode = GZ_WRITE;
 262.143 +                break;
 262.144 +            case 'a':
 262.145 +                state->mode = GZ_APPEND;
 262.146 +                break;
 262.147 +#endif
 262.148 +            case '+':       /* can't read and write at the same time */
 262.149 +                free(state);
 262.150 +                return NULL;
 262.151 +            case 'b':       /* ignore -- will request binary anyway */
 262.152 +                break;
 262.153 +            case 'f':
 262.154 +                state->strategy = Z_FILTERED;
 262.155 +                break;
 262.156 +            case 'h':
 262.157 +                state->strategy = Z_HUFFMAN_ONLY;
 262.158 +                break;
 262.159 +            case 'R':
 262.160 +                state->strategy = Z_RLE;
 262.161 +                break;
 262.162 +            case 'F':
 262.163 +                state->strategy = Z_FIXED;
 262.164 +            default:        /* could consider as an error, but just ignore */
 262.165 +                ;
 262.166 +            }
 262.167 +        mode++;
 262.168 +    }
 262.169 +
 262.170 +    /* must provide an "r", "w", or "a" */
 262.171 +    if (state->mode == GZ_NONE) {
 262.172 +        free(state);
 262.173 +        return NULL;
 262.174 +    }
 262.175 +
 262.176 +    /* save the path name for error messages */
 262.177 +    state->path = malloc(strlen(path) + 1);
 262.178 +    if (state->path == NULL) {
 262.179 +        free(state);
 262.180 +        return NULL;
 262.181 +    }
 262.182 +    strcpy(state->path, path);
 262.183 +
 262.184 +    /* open the file with the appropriate mode (or just use fd) */
 262.185 +    state->fd = fd != -1 ? fd :
 262.186 +        open(path,
 262.187 +#ifdef O_LARGEFILE
 262.188 +            O_LARGEFILE |
 262.189 +#endif
 262.190 +#ifdef O_BINARY
 262.191 +            O_BINARY |
 262.192 +#endif
 262.193 +            (state->mode == GZ_READ ?
 262.194 +                O_RDONLY :
 262.195 +                (O_WRONLY | O_CREAT | (
 262.196 +                    state->mode == GZ_WRITE ?
 262.197 +                        O_TRUNC :
 262.198 +                        O_APPEND))),
 262.199 +            0666);
 262.200 +    if (state->fd == -1) {
 262.201 +        free(state->path);
 262.202 +        free(state);
 262.203 +        return NULL;
 262.204 +    }
 262.205 +    if (state->mode == GZ_APPEND)
 262.206 +        state->mode = GZ_WRITE;         /* simplify later checks */
 262.207 +
 262.208 +    /* save the current position for rewinding (only if reading) */
 262.209 +    if (state->mode == GZ_READ) {
 262.210 +        state->start = LSEEK(state->fd, 0, SEEK_CUR);
 262.211 +        if (state->start == -1) state->start = 0;
 262.212 +    }
 262.213 +
 262.214 +    /* initialize stream */
 262.215 +    gz_reset(state);
 262.216 +
 262.217 +    /* return stream */
 262.218 +    return (gzFile)state;
 262.219 +}
 262.220 +
 262.221 +/* -- see zlib.h -- */
 262.222 +gzFile ZEXPORT gzopen(path, mode)
 262.223 +    const char *path;
 262.224 +    const char *mode;
 262.225 +{
 262.226 +    return gz_open(path, -1, mode);
 262.227 +}
 262.228 +
 262.229 +/* -- see zlib.h -- */
 262.230 +gzFile ZEXPORT gzopen64(path, mode)
 262.231 +    const char *path;
 262.232 +    const char *mode;
 262.233 +{
 262.234 +    return gz_open(path, -1, mode);
 262.235 +}
 262.236 +
 262.237 +/* -- see zlib.h -- */
 262.238 +gzFile ZEXPORT gzdopen(fd, mode)
 262.239 +    int fd;
 262.240 +    const char *mode;
 262.241 +{
 262.242 +    char *path;         /* identifier for error messages */
 262.243 +    gzFile gz;
 262.244 +
 262.245 +    if (fd == -1 || (path = malloc(7 + 3 * sizeof(int))) == NULL)
 262.246 +        return NULL;
 262.247 +    sprintf(path, "<fd:%d>", fd);   /* for debugging */
 262.248 +    gz = gz_open(path, fd, mode);
 262.249 +    free(path);
 262.250 +    return gz;
 262.251 +}
 262.252 +
 262.253 +/* -- see zlib.h -- */
 262.254 +int ZEXPORT gzbuffer(file, size)
 262.255 +    gzFile file;
 262.256 +    unsigned size;
 262.257 +{
 262.258 +    gz_statep state;
 262.259 +
 262.260 +    /* get internal structure and check integrity */
 262.261 +    if (file == NULL)
 262.262 +        return -1;
 262.263 +    state = (gz_statep)file;
 262.264 +    if (state->mode != GZ_READ && state->mode != GZ_WRITE)
 262.265 +        return -1;
 262.266 +
 262.267 +    /* make sure we haven't already allocated memory */
 262.268 +    if (state->size != 0)
 262.269 +        return -1;
 262.270 +
 262.271 +    /* check and set requested size */
 262.272 +    if (size == 0)
 262.273 +        return -1;
 262.274 +    state->want = size;
 262.275 +    return 0;
 262.276 +}
 262.277 +
 262.278 +/* -- see zlib.h -- */
 262.279 +int ZEXPORT gzrewind(file)
 262.280 +    gzFile file;
 262.281 +{
 262.282 +    gz_statep state;
 262.283 +
 262.284 +    /* get internal structure */
 262.285 +    if (file == NULL)
 262.286 +        return -1;
 262.287 +    state = (gz_statep)file;
 262.288 +
 262.289 +    /* check that we're reading and that there's no error */
 262.290 +    if (state->mode != GZ_READ || state->err != Z_OK)
 262.291 +        return -1;
 262.292 +
 262.293 +    /* back up and start over */
 262.294 +    if (LSEEK(state->fd, state->start, SEEK_SET) == -1)
 262.295 +        return -1;
 262.296 +    gz_reset(state);
 262.297 +    return 0;
 262.298 +}
 262.299 +
 262.300 +/* -- see zlib.h -- */
 262.301 +z_off64_t ZEXPORT gzseek64(file, offset, whence)
 262.302 +    gzFile file;
 262.303 +    z_off64_t offset;
 262.304 +    int whence;
 262.305 +{
 262.306 +    unsigned n;
 262.307 +    z_off64_t ret;
 262.308 +    gz_statep state;
 262.309 +
 262.310 +    /* get internal structure and check integrity */
 262.311 +    if (file == NULL)
 262.312 +        return -1;
 262.313 +    state = (gz_statep)file;
 262.314 +    if (state->mode != GZ_READ && state->mode != GZ_WRITE)
 262.315 +        return -1;
 262.316 +
 262.317 +    /* check that there's no error */
 262.318 +    if (state->err != Z_OK)
 262.319 +        return -1;
 262.320 +
 262.321 +    /* can only seek from start or relative to current position */
 262.322 +    if (whence != SEEK_SET && whence != SEEK_CUR)
 262.323 +        return -1;
 262.324 +
 262.325 +    /* normalize offset to a SEEK_CUR specification */
 262.326 +    if (whence == SEEK_SET)
 262.327 +        offset -= state->pos;
 262.328 +    else if (state->seek)
 262.329 +        offset += state->skip;
 262.330 +    state->seek = 0;
 262.331 +
 262.332 +    /* if within raw area while reading, just go there */
 262.333 +    if (state->mode == GZ_READ && state->how == COPY &&
 262.334 +        state->pos + offset >= state->raw) {
 262.335 +        ret = LSEEK(state->fd, offset - state->have, SEEK_CUR);
 262.336 +        if (ret == -1)
 262.337 +            return -1;
 262.338 +        state->have = 0;
 262.339 +        state->eof = 0;
 262.340 +        state->seek = 0;
 262.341 +        gz_error(state, Z_OK, NULL);
 262.342 +        state->strm.avail_in = 0;
 262.343 +        state->pos += offset;
 262.344 +        return state->pos;
 262.345 +    }
 262.346 +
 262.347 +    /* calculate skip amount, rewinding if needed for back seek when reading */
 262.348 +    if (offset < 0) {
 262.349 +        if (state->mode != GZ_READ)         /* writing -- can't go backwards */
 262.350 +            return -1;
 262.351 +        offset += state->pos;
 262.352 +        if (offset < 0)                     /* before start of file! */
 262.353 +            return -1;
 262.354 +        if (gzrewind(file) == -1)           /* rewind, then skip to offset */
 262.355 +            return -1;
 262.356 +    }
 262.357 +
 262.358 +    /* if reading, skip what's in output buffer (one less gzgetc() check) */
 262.359 +    if (state->mode == GZ_READ) {
 262.360 +        n = GT_OFF(state->have) || (z_off64_t)state->have > offset ?
 262.361 +            (unsigned)offset : state->have;
 262.362 +        state->have -= n;
 262.363 +        state->next += n;
 262.364 +        state->pos += n;
 262.365 +        offset -= n;
 262.366 +    }
 262.367 +
 262.368 +    /* request skip (if not zero) */
 262.369 +    if (offset) {
 262.370 +        state->seek = 1;
 262.371 +        state->skip = offset;
 262.372 +    }
 262.373 +    return state->pos + offset;
 262.374 +}
 262.375 +
 262.376 +/* -- see zlib.h -- */
 262.377 +z_off_t ZEXPORT gzseek(file, offset, whence)
 262.378 +    gzFile file;
 262.379 +    z_off_t offset;
 262.380 +    int whence;
 262.381 +{
 262.382 +    z_off64_t ret;
 262.383 +
 262.384 +    ret = gzseek64(file, (z_off64_t)offset, whence);
 262.385 +    return ret == (z_off_t)ret ? (z_off_t)ret : -1;
 262.386 +}
 262.387 +
 262.388 +/* -- see zlib.h -- */
 262.389 +z_off64_t ZEXPORT gztell64(file)
 262.390 +    gzFile file;
 262.391 +{
 262.392 +    gz_statep state;
 262.393 +
 262.394 +    /* get internal structure and check integrity */
 262.395 +    if (file == NULL)
 262.396 +        return -1;
 262.397 +    state = (gz_statep)file;
 262.398 +    if (state->mode != GZ_READ && state->mode != GZ_WRITE)
 262.399 +        return -1;
 262.400 +
 262.401 +    /* return position */
 262.402 +    return state->pos + (state->seek ? state->skip : 0);
 262.403 +}
 262.404 +
 262.405 +/* -- see zlib.h -- */
 262.406 +z_off_t ZEXPORT gztell(file)
 262.407 +    gzFile file;
 262.408 +{
 262.409 +    z_off64_t ret;
 262.410 +
 262.411 +    ret = gztell64(file);
 262.412 +    return ret == (z_off_t)ret ? (z_off_t)ret : -1;
 262.413 +}
 262.414 +
 262.415 +/* -- see zlib.h -- */
 262.416 +z_off64_t ZEXPORT gzoffset64(file)
 262.417 +    gzFile file;
 262.418 +{
 262.419 +    z_off64_t offset;
 262.420 +    gz_statep state;
 262.421 +
 262.422 +    /* get internal structure and check integrity */
 262.423 +    if (file == NULL)
 262.424 +        return -1;
 262.425 +    state = (gz_statep)file;
 262.426 +    if (state->mode != GZ_READ && state->mode != GZ_WRITE)
 262.427 +        return -1;
 262.428 +
 262.429 +    /* compute and return effective offset in file */
 262.430 +    offset = LSEEK(state->fd, 0, SEEK_CUR);
 262.431 +    if (offset == -1)
 262.432 +        return -1;
 262.433 +    if (state->mode == GZ_READ)             /* reading */
 262.434 +        offset -= state->strm.avail_in;     /* don't count buffered input */
 262.435 +    return offset;
 262.436 +}
 262.437 +
 262.438 +/* -- see zlib.h -- */
 262.439 +z_off_t ZEXPORT gzoffset(file)
 262.440 +    gzFile file;
 262.441 +{
 262.442 +    z_off64_t ret;
 262.443 +
 262.444 +    ret = gzoffset64(file);
 262.445 +    return ret == (z_off_t)ret ? (z_off_t)ret : -1;
 262.446 +}
 262.447 +
 262.448 +/* -- see zlib.h -- */
 262.449 +int ZEXPORT gzeof(file)
 262.450 +    gzFile file;
 262.451 +{
 262.452 +    gz_statep state;
 262.453 +
 262.454 +    /* get internal structure and check integrity */
 262.455 +    if (file == NULL)
 262.456 +        return 0;
 262.457 +    state = (gz_statep)file;
 262.458 +    if (state->mode != GZ_READ && state->mode != GZ_WRITE)
 262.459 +        return 0;
 262.460 +
 262.461 +    /* return end-of-file state */
 262.462 +    return state->mode == GZ_READ ?
 262.463 +        (state->eof && state->strm.avail_in == 0 && state->have == 0) : 0;
 262.464 +}
 262.465 +
 262.466 +/* -- see zlib.h -- */
 262.467 +const char * ZEXPORT gzerror(file, errnum)
 262.468 +    gzFile file;
 262.469 +    int *errnum;
 262.470 +{
 262.471 +    gz_statep state;
 262.472 +
 262.473 +    /* get internal structure and check integrity */
 262.474 +    if (file == NULL)
 262.475 +        return NULL;
 262.476 +    state = (gz_statep)file;
 262.477 +    if (state->mode != GZ_READ && state->mode != GZ_WRITE)
 262.478 +        return NULL;
 262.479 +
 262.480 +    /* return error information */
 262.481 +    if (errnum != NULL)
 262.482 +        *errnum = state->err;
 262.483 +    return state->msg == NULL ? "" : state->msg;
 262.484 +}
 262.485 +
 262.486 +/* -- see zlib.h -- */
 262.487 +void ZEXPORT gzclearerr(file)
 262.488 +    gzFile file;
 262.489 +{
 262.490 +    gz_statep state;
 262.491 +
 262.492 +    /* get internal structure and check integrity */
 262.493 +    if (file == NULL)
 262.494 +        return;
 262.495 +    state = (gz_statep)file;
 262.496 +    if (state->mode != GZ_READ && state->mode != GZ_WRITE)
 262.497 +        return;
 262.498 +
 262.499 +    /* clear error and end-of-file */
 262.500 +    if (state->mode == GZ_READ)
 262.501 +        state->eof = 0;
 262.502 +    gz_error(state, Z_OK, NULL);
 262.503 +}
 262.504 +
 262.505 +/* Create an error message in allocated memory and set state->err and
 262.506 +   state->msg accordingly.  Free any previous error message already there.  Do
 262.507 +   not try to free or allocate space if the error is Z_MEM_ERROR (out of
 262.508 +   memory).  Simply save the error message as a static string.  If there is an
 262.509 +   allocation failure constructing the error message, then convert the error to
 262.510 +   out of memory. */
 262.511 +void ZLIB_INTERNAL gz_error(state, err, msg)
 262.512 +    gz_statep state;
 262.513 +    int err;
 262.514 +    const char *msg;
 262.515 +{
 262.516 +    /* free previously allocated message and clear */
 262.517 +    if (state->msg != NULL) {
 262.518 +        if (state->err != Z_MEM_ERROR)
 262.519 +            free(state->msg);
 262.520 +        state->msg = NULL;
 262.521 +    }
 262.522 +
 262.523 +    /* set error code, and if no message, then done */
 262.524 +    state->err = err;
 262.525 +    if (msg == NULL)
 262.526 +        return;
 262.527 +
 262.528 +    /* for an out of memory error, save as static string */
 262.529 +    if (err == Z_MEM_ERROR) {
 262.530 +        state->msg = (char *)msg;
 262.531 +        return;
 262.532 +    }
 262.533 +
 262.534 +    /* construct error message with path */
 262.535 +    if ((state->msg = malloc(strlen(state->path) + strlen(msg) + 3)) == NULL) {
 262.536 +        state->err = Z_MEM_ERROR;
 262.537 +        state->msg = (char *)"out of memory";
 262.538 +        return;
 262.539 +    }
 262.540 +    strcpy(state->msg, state->path);
 262.541 +    strcat(state->msg, ": ");
 262.542 +    strcat(state->msg, msg);
 262.543 +    return;
 262.544 +}
 262.545 +
 262.546 +#ifndef INT_MAX
 262.547 +/* portably return maximum value for an int (when limits.h presumed not
 262.548 +   available) -- we need to do this to cover cases where 2's complement not
 262.549 +   used, since C standard permits 1's complement and sign-bit representations,
 262.550 +   otherwise we could just use ((unsigned)-1) >> 1 */
 262.551 +unsigned ZLIB_INTERNAL gz_intmax()
 262.552 +{
 262.553 +    unsigned p, q;
 262.554 +
 262.555 +    p = 1;
 262.556 +    do {
 262.557 +        q = p;
 262.558 +        p <<= 1;
 262.559 +        p++;
 262.560 +    } while (p > q);
 262.561 +    return q >> 1;
 262.562 +}
 262.563 +#endif
   263.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   263.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/gzread.c	Mon Dec 19 10:06:23 2011 -0800
   263.3 @@ -0,0 +1,677 @@
   263.4 +/*
   263.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   263.6 + *
   263.7 + * This code is free software; you can redistribute it and/or modify it
   263.8 + * under the terms of the GNU General Public License version 2 only, as
   263.9 + * published by the Free Software Foundation.  Oracle designates this
  263.10 + * particular file as subject to the "Classpath" exception as provided
  263.11 + * by Oracle in the LICENSE file that accompanied this code.
  263.12 + *
  263.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
  263.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  263.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  263.16 + * version 2 for more details (a copy is included in the LICENSE file that
  263.17 + * accompanied this code).
  263.18 + *
  263.19 + * You should have received a copy of the GNU General Public License version
  263.20 + * 2 along with this work; if not, write to the Free Software Foundation,
  263.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  263.22 + *
  263.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  263.24 + * or visit www.oracle.com if you need additional information or have any
  263.25 + * questions.
  263.26 + */
  263.27 +
  263.28 +/* gzread.c -- zlib functions for reading gzip files
  263.29 + * Copyright (C) 2004, 2005, 2010 Mark Adler
  263.30 + * For conditions of distribution and use, see copyright notice in zlib.h
  263.31 + */
  263.32 +
  263.33 +#include "gzguts.h"
  263.34 +
  263.35 +/* Local functions */
  263.36 +local int gz_load OF((gz_statep, unsigned char *, unsigned, unsigned *));
  263.37 +local int gz_avail OF((gz_statep));
  263.38 +local int gz_next4 OF((gz_statep, unsigned long *));
  263.39 +local int gz_head OF((gz_statep));
  263.40 +local int gz_decomp OF((gz_statep));
  263.41 +local int gz_make OF((gz_statep));
  263.42 +local int gz_skip OF((gz_statep, z_off64_t));
  263.43 +
  263.44 +/* Use read() to load a buffer -- return -1 on error, otherwise 0.  Read from
  263.45 +   state->fd, and update state->eof, state->err, and state->msg as appropriate.
  263.46 +   This function needs to loop on read(), since read() is not guaranteed to
  263.47 +   read the number of bytes requested, depending on the type of descriptor. */
  263.48 +local int gz_load(state, buf, len, have)
  263.49 +    gz_statep state;
  263.50 +    unsigned char *buf;
  263.51 +    unsigned len;
  263.52 +    unsigned *have;
  263.53 +{
  263.54 +    int ret;
  263.55 +
  263.56 +    *have = 0;
  263.57 +    do {
  263.58 +        ret = read(state->fd, buf + *have, len - *have);
  263.59 +        if (ret <= 0)
  263.60 +            break;
  263.61 +        *have += ret;
  263.62 +    } while (*have < len);
  263.63 +    if (ret < 0) {
  263.64 +        gz_error(state, Z_ERRNO, zstrerror());
  263.65 +        return -1;
  263.66 +    }
  263.67 +    if (ret == 0)
  263.68 +        state->eof = 1;
  263.69 +    return 0;
  263.70 +}
  263.71 +
  263.72 +/* Load up input buffer and set eof flag if last data loaded -- return -1 on
  263.73 +   error, 0 otherwise.  Note that the eof flag is set when the end of the input
  263.74 +   file is reached, even though there may be unused data in the buffer.  Once
  263.75 +   that data has been used, no more attempts will be made to read the file.
  263.76 +   gz_avail() assumes that strm->avail_in == 0. */
  263.77 +local int gz_avail(state)
  263.78 +    gz_statep state;
  263.79 +{
  263.80 +    z_streamp strm = &(state->strm);
  263.81 +
  263.82 +    if (state->err != Z_OK)
  263.83 +        return -1;
  263.84 +    if (state->eof == 0) {
  263.85 +        if (gz_load(state, state->in, state->size,
  263.86 +                (unsigned *)&(strm->avail_in)) == -1)
  263.87 +            return -1;
  263.88 +        strm->next_in = state->in;
  263.89 +    }
  263.90 +    return 0;
  263.91 +}
  263.92 +
  263.93 +/* Get next byte from input, or -1 if end or error. */
  263.94 +#define NEXT() ((strm->avail_in == 0 && gz_avail(state) == -1) ? -1 : \
  263.95 +                (strm->avail_in == 0 ? -1 : \
  263.96 +                 (strm->avail_in--, *(strm->next_in)++)))
  263.97 +
  263.98 +/* Get a four-byte little-endian integer and return 0 on success and the value
  263.99 +   in *ret.  Otherwise -1 is returned and *ret is not modified. */
 263.100 +local int gz_next4(state, ret)
 263.101 +    gz_statep state;
 263.102 +    unsigned long *ret;
 263.103 +{
 263.104 +    int ch;
 263.105 +    unsigned long val;
 263.106 +    z_streamp strm = &(state->strm);
 263.107 +
 263.108 +    val = NEXT();
 263.109 +    val += (unsigned)NEXT() << 8;
 263.110 +    val += (unsigned long)NEXT() << 16;
 263.111 +    ch = NEXT();
 263.112 +    if (ch == -1)
 263.113 +        return -1;
 263.114 +    val += (unsigned long)ch << 24;
 263.115 +    *ret = val;
 263.116 +    return 0;
 263.117 +}
 263.118 +
 263.119 +/* Look for gzip header, set up for inflate or copy.  state->have must be zero.
 263.120 +   If this is the first time in, allocate required memory.  state->how will be
 263.121 +   left unchanged if there is no more input data available, will be set to COPY
 263.122 +   if there is no gzip header and direct copying will be performed, or it will
 263.123 +   be set to GZIP for decompression, and the gzip header will be skipped so
 263.124 +   that the next available input data is the raw deflate stream.  If direct
 263.125 +   copying, then leftover input data from the input buffer will be copied to
 263.126 +   the output buffer.  In that case, all further file reads will be directly to
 263.127 +   either the output buffer or a user buffer.  If decompressing, the inflate
 263.128 +   state and the check value will be initialized.  gz_head() will return 0 on
 263.129 +   success or -1 on failure.  Failures may include read errors or gzip header
 263.130 +   errors.  */
 263.131 +local int gz_head(state)
 263.132 +    gz_statep state;
 263.133 +{
 263.134 +    z_streamp strm = &(state->strm);
 263.135 +    int flags;
 263.136 +    unsigned len;
 263.137 +
 263.138 +    /* allocate read buffers and inflate memory */
 263.139 +    if (state->size == 0) {
 263.140 +        /* allocate buffers */
 263.141 +        state->in = malloc(state->want);
 263.142 +        state->out = malloc(state->want << 1);
 263.143 +        if (state->in == NULL || state->out == NULL) {
 263.144 +            if (state->out != NULL)
 263.145 +                free(state->out);
 263.146 +            if (state->in != NULL)
 263.147 +                free(state->in);
 263.148 +            gz_error(state, Z_MEM_ERROR, "out of memory");
 263.149 +            return -1;
 263.150 +        }
 263.151 +        state->size = state->want;
 263.152 +
 263.153 +        /* allocate inflate memory */
 263.154 +        state->strm.zalloc = Z_NULL;
 263.155 +        state->strm.zfree = Z_NULL;
 263.156 +        state->strm.opaque = Z_NULL;
 263.157 +        state->strm.avail_in = 0;
 263.158 +        state->strm.next_in = Z_NULL;
 263.159 +        if (inflateInit2(&(state->strm), -15) != Z_OK) {    /* raw inflate */
 263.160 +            free(state->out);
 263.161 +            free(state->in);
 263.162 +            state->size = 0;
 263.163 +            gz_error(state, Z_MEM_ERROR, "out of memory");
 263.164 +            return -1;
 263.165 +        }
 263.166 +    }
 263.167 +
 263.168 +    /* get some data in the input buffer */
 263.169 +    if (strm->avail_in == 0) {
 263.170 +        if (gz_avail(state) == -1)
 263.171 +            return -1;
 263.172 +        if (strm->avail_in == 0)
 263.173 +            return 0;
 263.174 +    }
 263.175 +
 263.176 +    /* look for the gzip magic header bytes 31 and 139 */
 263.177 +    if (strm->next_in[0] == 31) {
 263.178 +        strm->avail_in--;
 263.179 +        strm->next_in++;
 263.180 +        if (strm->avail_in == 0 && gz_avail(state) == -1)
 263.181 +            return -1;
 263.182 +        if (strm->avail_in && strm->next_in[0] == 139) {
 263.183 +            /* we have a gzip header, woo hoo! */
 263.184 +            strm->avail_in--;
 263.185 +            strm->next_in++;
 263.186 +
 263.187 +            /* skip rest of header */
 263.188 +            if (NEXT() != 8) {      /* compression method */
 263.189 +                gz_error(state, Z_DATA_ERROR, "unknown compression method");
 263.190 +                return -1;
 263.191 +            }
 263.192 +            flags = NEXT();
 263.193 +            if (flags & 0xe0) {     /* reserved flag bits */
 263.194 +                gz_error(state, Z_DATA_ERROR, "unknown header flags set");
 263.195 +                return -1;
 263.196 +            }
 263.197 +            NEXT();                 /* modification time */
 263.198 +            NEXT();
 263.199 +            NEXT();
 263.200 +            NEXT();
 263.201 +            NEXT();                 /* extra flags */
 263.202 +            NEXT();                 /* operating system */
 263.203 +            if (flags & 4) {        /* extra field */
 263.204 +                len = (unsigned)NEXT();
 263.205 +                len += (unsigned)NEXT() << 8;
 263.206 +                while (len--)
 263.207 +                    if (NEXT() < 0)
 263.208 +                        break;
 263.209 +            }
 263.210 +            if (flags & 8)          /* file name */
 263.211 +                while (NEXT() > 0)
 263.212 +                    ;
 263.213 +            if (flags & 16)         /* comment */
 263.214 +                while (NEXT() > 0)
 263.215 +                    ;
 263.216 +            if (flags & 2) {        /* header crc */
 263.217 +                NEXT();
 263.218 +                NEXT();
 263.219 +            }
 263.220 +            /* an unexpected end of file is not checked for here -- it will be
 263.221 +               noticed on the first request for uncompressed data */
 263.222 +
 263.223 +            /* set up for decompression */
 263.224 +            inflateReset(strm);
 263.225 +            strm->adler = crc32(0L, Z_NULL, 0);
 263.226 +            state->how = GZIP;
 263.227 +            state->direct = 0;
 263.228 +            return 0;
 263.229 +        }
 263.230 +        else {
 263.231 +            /* not a gzip file -- save first byte (31) and fall to raw i/o */
 263.232 +            state->out[0] = 31;
 263.233 +            state->have = 1;
 263.234 +        }
 263.235 +    }
 263.236 +
 263.237 +    /* doing raw i/o, save start of raw data for seeking, copy any leftover
 263.238 +       input to output -- this assumes that the output buffer is larger than
 263.239 +       the input buffer, which also assures space for gzungetc() */
 263.240 +    state->raw = state->pos;
 263.241 +    state->next = state->out;
 263.242 +    if (strm->avail_in) {
 263.243 +        memcpy(state->next + state->have, strm->next_in, strm->avail_in);
 263.244 +        state->have += strm->avail_in;
 263.245 +        strm->avail_in = 0;
 263.246 +    }
 263.247 +    state->how = COPY;
 263.248 +    state->direct = 1;
 263.249 +    return 0;
 263.250 +}
 263.251 +
 263.252 +/* Decompress from input to the provided next_out and avail_out in the state.
 263.253 +   If the end of the compressed data is reached, then verify the gzip trailer
 263.254 +   check value and length (modulo 2^32).  state->have and state->next are set
 263.255 +   to point to the just decompressed data, and the crc is updated.  If the
 263.256 +   trailer is verified, state->how is reset to LOOK to look for the next gzip
 263.257 +   stream or raw data, once state->have is depleted.  Returns 0 on success, -1
 263.258 +   on failure.  Failures may include invalid compressed data or a failed gzip
 263.259 +   trailer verification. */
 263.260 +local int gz_decomp(state)
 263.261 +    gz_statep state;
 263.262 +{
 263.263 +    int ret;
 263.264 +    unsigned had;
 263.265 +    unsigned long crc, len;
 263.266 +    z_streamp strm = &(state->strm);
 263.267 +
 263.268 +    /* fill output buffer up to end of deflate stream */
 263.269 +    had = strm->avail_out;
 263.270 +    do {
 263.271 +        /* get more input for inflate() */
 263.272 +        if (strm->avail_in == 0 && gz_avail(state) == -1)
 263.273 +            return -1;
 263.274 +        if (strm->avail_in == 0) {
 263.275 +            gz_error(state, Z_DATA_ERROR, "unexpected end of file");
 263.276 +            return -1;
 263.277 +        }
 263.278 +
 263.279 +        /* decompress and handle errors */
 263.280 +        ret = inflate(strm, Z_NO_FLUSH);
 263.281 +        if (ret == Z_STREAM_ERROR || ret == Z_NEED_DICT) {
 263.282 +            gz_error(state, Z_STREAM_ERROR,
 263.283 +                      "internal error: inflate stream corrupt");
 263.284 +            return -1;
 263.285 +        }
 263.286 +        if (ret == Z_MEM_ERROR) {
 263.287 +            gz_error(state, Z_MEM_ERROR, "out of memory");
 263.288 +            return -1;
 263.289 +        }
 263.290 +        if (ret == Z_DATA_ERROR) {              /* deflate stream invalid */
 263.291 +            gz_error(state, Z_DATA_ERROR,
 263.292 +                      strm->msg == NULL ? "compressed data error" : strm->msg);
 263.293 +            return -1;
 263.294 +        }
 263.295 +    } while (strm->avail_out && ret != Z_STREAM_END);
 263.296 +
 263.297 +    /* update available output and crc check value */
 263.298 +    state->have = had - strm->avail_out;
 263.299 +    state->next = strm->next_out - state->have;
 263.300 +    strm->adler = crc32(strm->adler, state->next, state->have);
 263.301 +
 263.302 +    /* check gzip trailer if at end of deflate stream */
 263.303 +    if (ret == Z_STREAM_END) {
 263.304 +        if (gz_next4(state, &crc) == -1 || gz_next4(state, &len) == -1) {
 263.305 +            gz_error(state, Z_DATA_ERROR, "unexpected end of file");
 263.306 +            return -1;
 263.307 +        }
 263.308 +        if (crc != strm->adler) {
 263.309 +            gz_error(state, Z_DATA_ERROR, "incorrect data check");
 263.310 +            return -1;
 263.311 +        }
 263.312 +        if (len != (strm->total_out & 0xffffffffL)) {
 263.313 +            gz_error(state, Z_DATA_ERROR, "incorrect length check");
 263.314 +            return -1;
 263.315 +        }
 263.316 +        state->how = LOOK;      /* ready for next stream, once have is 0 (leave
 263.317 +                                   state->direct unchanged to remember how) */
 263.318 +    }
 263.319 +
 263.320 +    /* good decompression */
 263.321 +    return 0;
 263.322 +}
 263.323 +
 263.324 +/* Make data and put in the output buffer.  Assumes that state->have == 0.
 263.325 +   Data is either copied from the input file or decompressed from the input
 263.326 +   file depending on state->how.  If state->how is LOOK, then a gzip header is
 263.327 +   looked for (and skipped if found) to determine wither to copy or decompress.
 263.328 +   Returns -1 on error, otherwise 0.  gz_make() will leave state->have as COPY
 263.329 +   or GZIP unless the end of the input file has been reached and all data has
 263.330 +   been processed.  */
 263.331 +local int gz_make(state)
 263.332 +    gz_statep state;
 263.333 +{
 263.334 +    z_streamp strm = &(state->strm);
 263.335 +
 263.336 +    if (state->how == LOOK) {           /* look for gzip header */
 263.337 +        if (gz_head(state) == -1)
 263.338 +            return -1;
 263.339 +        if (state->have)                /* got some data from gz_head() */
 263.340 +            return 0;
 263.341 +    }
 263.342 +    if (state->how == COPY) {           /* straight copy */
 263.343 +        if (gz_load(state, state->out, state->size << 1, &(state->have)) == -1)
 263.344 +            return -1;
 263.345 +        state->next = state->out;
 263.346 +    }
 263.347 +    else if (state->how == GZIP) {      /* decompress */
 263.348 +        strm->avail_out = state->size << 1;
 263.349 +        strm->next_out = state->out;
 263.350 +        if (gz_decomp(state) == -1)
 263.351 +            return -1;
 263.352 +    }
 263.353 +    return 0;
 263.354 +}
 263.355 +
 263.356 +/* Skip len uncompressed bytes of output.  Return -1 on error, 0 on success. */
 263.357 +local int gz_skip(state, len)
 263.358 +    gz_statep state;
 263.359 +    z_off64_t len;
 263.360 +{
 263.361 +    unsigned n;
 263.362 +
 263.363 +    /* skip over len bytes or reach end-of-file, whichever comes first */
 263.364 +    while (len)
 263.365 +        /* skip over whatever is in output buffer */
 263.366 +        if (state->have) {
 263.367 +            n = GT_OFF(state->have) || (z_off64_t)state->have > len ?
 263.368 +                (unsigned)len : state->have;
 263.369 +            state->have -= n;
 263.370 +            state->next += n;
 263.371 +            state->pos += n;
 263.372 +            len -= n;
 263.373 +        }
 263.374 +
 263.375 +        /* output buffer empty -- return if we're at the end of the input */
 263.376 +        else if (state->eof && state->strm.avail_in == 0)
 263.377 +            break;
 263.378 +
 263.379 +        /* need more data to skip -- load up output buffer */
 263.380 +        else {
 263.381 +            /* get more output, looking for header if required */
 263.382 +            if (gz_make(state) == -1)
 263.383 +                return -1;
 263.384 +        }
 263.385 +    return 0;
 263.386 +}
 263.387 +
 263.388 +/* -- see zlib.h -- */
 263.389 +int ZEXPORT gzread(file, buf, len)
 263.390 +    gzFile file;
 263.391 +    voidp buf;
 263.392 +    unsigned len;
 263.393 +{
 263.394 +    unsigned got, n;
 263.395 +    gz_statep state;
 263.396 +    z_streamp strm;
 263.397 +
 263.398 +    /* get internal structure */
 263.399 +    if (file == NULL)
 263.400 +        return -1;
 263.401 +    state = (gz_statep)file;
 263.402 +    strm = &(state->strm);
 263.403 +
 263.404 +    /* check that we're reading and that there's no error */
 263.405 +    if (state->mode != GZ_READ || state->err != Z_OK)
 263.406 +        return -1;
 263.407 +
 263.408 +    /* since an int is returned, make sure len fits in one, otherwise return
 263.409 +       with an error (this avoids the flaw in the interface) */
 263.410 +    if ((int)len < 0) {
 263.411 +        gz_error(state, Z_BUF_ERROR, "requested length does not fit in int");
 263.412 +        return -1;
 263.413 +    }
 263.414 +
 263.415 +    /* if len is zero, avoid unnecessary operations */
 263.416 +    if (len == 0)
 263.417 +        return 0;
 263.418 +
 263.419 +    /* process a skip request */
 263.420 +    if (state->seek) {
 263.421 +        state->seek = 0;
 263.422 +        if (gz_skip(state, state->skip) == -1)
 263.423 +            return -1;
 263.424 +    }
 263.425 +
 263.426 +    /* get len bytes to buf, or less than len if at the end */
 263.427 +    got = 0;
 263.428 +    do {
 263.429 +        /* first just try copying data from the output buffer */
 263.430 +        if (state->have) {
 263.431 +            n = state->have > len ? len : state->have;
 263.432 +            memcpy(buf, state->next, n);
 263.433 +            state->next += n;
 263.434 +            state->have -= n;
 263.435 +        }
 263.436 +
 263.437 +        /* output buffer empty -- return if we're at the end of the input */
 263.438 +        else if (state->eof && strm->avail_in == 0)
 263.439 +            break;
 263.440 +
 263.441 +        /* need output data -- for small len or new stream load up our output
 263.442 +           buffer */
 263.443 +        else if (state->how == LOOK || len < (state->size << 1)) {
 263.444 +            /* get more output, looking for header if required */
 263.445 +            if (gz_make(state) == -1)
 263.446 +                return -1;
 263.447 +            continue;       /* no progress yet -- go back to memcpy() above */
 263.448 +            /* the copy above assures that we will leave with space in the
 263.449 +               output buffer, allowing at least one gzungetc() to succeed */
 263.450 +        }
 263.451 +
 263.452 +        /* large len -- read directly into user buffer */
 263.453 +        else if (state->how == COPY) {      /* read directly */
 263.454 +            if (gz_load(state, buf, len, &n) == -1)
 263.455 +                return -1;
 263.456 +        }
 263.457 +
 263.458 +        /* large len -- decompress directly into user buffer */
 263.459 +        else {  /* state->how == GZIP */
 263.460 +            strm->avail_out = len;
 263.461 +            strm->next_out = buf;
 263.462 +            if (gz_decomp(state) == -1)
 263.463 +                return -1;
 263.464 +            n = state->have;
 263.465 +            state->have = 0;
 263.466 +        }
 263.467 +
 263.468 +        /* update progress */
 263.469 +        len -= n;
 263.470 +        buf = (char *)buf + n;
 263.471 +        got += n;
 263.472 +        state->pos += n;
 263.473 +    } while (len);
 263.474 +
 263.475 +    /* return number of bytes read into user buffer (will fit in int) */
 263.476 +    return (int)got;
 263.477 +}
 263.478 +
 263.479 +/* -- see zlib.h -- */
 263.480 +int ZEXPORT gzgetc(file)
 263.481 +    gzFile file;
 263.482 +{
 263.483 +    int ret;
 263.484 +    unsigned char buf[1];
 263.485 +    gz_statep state;
 263.486 +
 263.487 +    /* get internal structure */
 263.488 +    if (file == NULL)
 263.489 +        return -1;
 263.490 +    state = (gz_statep)file;
 263.491 +
 263.492 +    /* check that we're reading and that there's no error */
 263.493 +    if (state->mode != GZ_READ || state->err != Z_OK)
 263.494 +        return -1;
 263.495 +
 263.496 +    /* try output buffer (no need to check for skip request) */
 263.497 +    if (state->have) {
 263.498 +        state->have--;
 263.499 +        state->pos++;
 263.500 +        return *(state->next)++;
 263.501 +    }
 263.502 +
 263.503 +    /* nothing there -- try gzread() */
 263.504 +    ret = gzread(file, buf, 1);
 263.505 +    return ret < 1 ? -1 : buf[0];
 263.506 +}
 263.507 +
 263.508 +/* -- see zlib.h -- */
 263.509 +int ZEXPORT gzungetc(c, file)
 263.510 +    int c;
 263.511 +    gzFile file;
 263.512 +{
 263.513 +    gz_statep state;
 263.514 +
 263.515 +    /* get internal structure */
 263.516 +    if (file == NULL)
 263.517 +        return -1;
 263.518 +    state = (gz_statep)file;
 263.519 +
 263.520 +    /* check that we're reading and that there's no error */
 263.521 +    if (state->mode != GZ_READ || state->err != Z_OK)
 263.522 +        return -1;
 263.523 +
 263.524 +    /* process a skip request */
 263.525 +    if (state->seek) {
 263.526 +        state->seek = 0;
 263.527 +        if (gz_skip(state, state->skip) == -1)
 263.528 +            return -1;
 263.529 +    }
 263.530 +
 263.531 +    /* can't push EOF */
 263.532 +    if (c < 0)
 263.533 +        return -1;
 263.534 +
 263.535 +    /* if output buffer empty, put byte at end (allows more pushing) */
 263.536 +    if (state->have == 0) {
 263.537 +        state->have = 1;
 263.538 +        state->next = state->out + (state->size << 1) - 1;
 263.539 +        state->next[0] = c;
 263.540 +        state->pos--;
 263.541 +        return c;
 263.542 +    }
 263.543 +
 263.544 +    /* if no room, give up (must have already done a gzungetc()) */
 263.545 +    if (state->have == (state->size << 1)) {
 263.546 +        gz_error(state, Z_BUF_ERROR, "out of room to push characters");
 263.547 +        return -1;
 263.548 +    }
 263.549 +
 263.550 +    /* slide output data if needed and insert byte before existing data */
 263.551 +    if (state->next == state->out) {
 263.552 +        unsigned char *src = state->out + state->have;
 263.553 +        unsigned char *dest = state->out + (state->size << 1);
 263.554 +        while (src > state->out)
 263.555 +            *--dest = *--src;
 263.556 +        state->next = dest;
 263.557 +    }
 263.558 +    state->have++;
 263.559 +    state->next--;
 263.560 +    state->next[0] = c;
 263.561 +    state->pos--;
 263.562 +    return c;
 263.563 +}
 263.564 +
 263.565 +/* -- see zlib.h -- */
 263.566 +char * ZEXPORT gzgets(file, buf, len)
 263.567 +    gzFile file;
 263.568 +    char *buf;
 263.569 +    int len;
 263.570 +{
 263.571 +    unsigned left, n;
 263.572 +    char *str;
 263.573 +    unsigned char *eol;
 263.574 +    gz_statep state;
 263.575 +
 263.576 +    /* check parameters and get internal structure */
 263.577 +    if (file == NULL || buf == NULL || len < 1)
 263.578 +        return NULL;
 263.579 +    state = (gz_statep)file;
 263.580 +
 263.581 +    /* check that we're reading and that there's no error */
 263.582 +    if (state->mode != GZ_READ || state->err != Z_OK)
 263.583 +        return NULL;
 263.584 +
 263.585 +    /* process a skip request */
 263.586 +    if (state->seek) {
 263.587 +        state->seek = 0;
 263.588 +        if (gz_skip(state, state->skip) == -1)
 263.589 +            return NULL;
 263.590 +    }
 263.591 +
 263.592 +    /* copy output bytes up to new line or len - 1, whichever comes first --
 263.593 +       append a terminating zero to the string (we don't check for a zero in
 263.594 +       the contents, let the user worry about that) */
 263.595 +    str = buf;
 263.596 +    left = (unsigned)len - 1;
 263.597 +    if (left) do {
 263.598 +        /* assure that something is in the output buffer */
 263.599 +        if (state->have == 0) {
 263.600 +            if (gz_make(state) == -1)
 263.601 +                return NULL;            /* error */
 263.602 +            if (state->have == 0) {     /* end of file */
 263.603 +                if (buf == str)         /* got bupkus */
 263.604 +                    return NULL;
 263.605 +                break;                  /* got something -- return it */
 263.606 +            }
 263.607 +        }
 263.608 +
 263.609 +        /* look for end-of-line in current output buffer */
 263.610 +        n = state->have > left ? left : state->have;
 263.611 +        eol = memchr(state->next, '\n', n);
 263.612 +        if (eol != NULL)
 263.613 +            n = (unsigned)(eol - state->next) + 1;
 263.614 +
 263.615 +        /* copy through end-of-line, or remainder if not found */
 263.616 +        memcpy(buf, state->next, n);
 263.617 +        state->have -= n;
 263.618 +        state->next += n;
 263.619 +        state->pos += n;
 263.620 +        left -= n;
 263.621 +        buf += n;
 263.622 +    } while (left && eol == NULL);
 263.623 +
 263.624 +    /* found end-of-line or out of space -- terminate string and return it */
 263.625 +    buf[0] = 0;
 263.626 +    return str;
 263.627 +}
 263.628 +
 263.629 +/* -- see zlib.h -- */
 263.630 +int ZEXPORT gzdirect(file)
 263.631 +    gzFile file;
 263.632 +{
 263.633 +    gz_statep state;
 263.634 +
 263.635 +    /* get internal structure */
 263.636 +    if (file == NULL)
 263.637 +        return 0;
 263.638 +    state = (gz_statep)file;
 263.639 +
 263.640 +    /* check that we're reading */
 263.641 +    if (state->mode != GZ_READ)
 263.642 +        return 0;
 263.643 +
 263.644 +    /* if the state is not known, but we can find out, then do so (this is
 263.645 +       mainly for right after a gzopen() or gzdopen()) */
 263.646 +    if (state->how == LOOK && state->have == 0)
 263.647 +        (void)gz_head(state);
 263.648 +
 263.649 +    /* return 1 if reading direct, 0 if decompressing a gzip stream */
 263.650 +    return state->direct;
 263.651 +}
 263.652 +
 263.653 +/* -- see zlib.h -- */
 263.654 +int ZEXPORT gzclose_r(file)
 263.655 +    gzFile file;
 263.656 +{
 263.657 +    int ret;
 263.658 +    gz_statep state;
 263.659 +
 263.660 +    /* get internal structure */
 263.661 +    if (file == NULL)
 263.662 +        return Z_STREAM_ERROR;
 263.663 +    state = (gz_statep)file;
 263.664 +
 263.665 +    /* check that we're reading */
 263.666 +    if (state->mode != GZ_READ)
 263.667 +        return Z_STREAM_ERROR;
 263.668 +
 263.669 +    /* free memory and close file */
 263.670 +    if (state->size) {
 263.671 +        inflateEnd(&(state->strm));
 263.672 +        free(state->out);
 263.673 +        free(state->in);
 263.674 +    }
 263.675 +    gz_error(state, Z_OK, NULL);
 263.676 +    free(state->path);
 263.677 +    ret = close(state->fd);
 263.678 +    free(state);
 263.679 +    return ret ? Z_ERRNO : Z_OK;
 263.680 +}
   264.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   264.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/gzwrite.c	Mon Dec 19 10:06:23 2011 -0800
   264.3 @@ -0,0 +1,555 @@
   264.4 +/*
   264.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   264.6 + *
   264.7 + * This code is free software; you can redistribute it and/or modify it
   264.8 + * under the terms of the GNU General Public License version 2 only, as
   264.9 + * published by the Free Software Foundation.  Oracle designates this
  264.10 + * particular file as subject to the "Classpath" exception as provided
  264.11 + * by Oracle in the LICENSE file that accompanied this code.
  264.12 + *
  264.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
  264.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  264.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  264.16 + * version 2 for more details (a copy is included in the LICENSE file that
  264.17 + * accompanied this code).
  264.18 + *
  264.19 + * You should have received a copy of the GNU General Public License version
  264.20 + * 2 along with this work; if not, write to the Free Software Foundation,
  264.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  264.22 + *
  264.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  264.24 + * or visit www.oracle.com if you need additional information or have any
  264.25 + * questions.
  264.26 + */
  264.27 +
  264.28 +/* gzwrite.c -- zlib functions for writing gzip files
  264.29 + * Copyright (C) 2004, 2005, 2010 Mark Adler
  264.30 + * For conditions of distribution and use, see copyright notice in zlib.h
  264.31 + */
  264.32 +
  264.33 +#include "gzguts.h"
  264.34 +
  264.35 +/* Local functions */
  264.36 +local int gz_init OF((gz_statep));
  264.37 +local int gz_comp OF((gz_statep, int));
  264.38 +local int gz_zero OF((gz_statep, z_off64_t));
  264.39 +
  264.40 +/* Initialize state for writing a gzip file.  Mark initialization by setting
  264.41 +   state->size to non-zero.  Return -1 on failure or 0 on success. */
  264.42 +local int gz_init(state)
  264.43 +    gz_statep state;
  264.44 +{
  264.45 +    int ret;
  264.46 +    z_streamp strm = &(state->strm);
  264.47 +
  264.48 +    /* allocate input and output buffers */
  264.49 +    state->in = malloc(state->want);
  264.50 +    state->out = malloc(state->want);
  264.51 +    if (state->in == NULL || state->out == NULL) {
  264.52 +        if (state->out != NULL)
  264.53 +            free(state->out);
  264.54 +        if (state->in != NULL)
  264.55 +            free(state->in);
  264.56 +        gz_error(state, Z_MEM_ERROR, "out of memory");
  264.57 +        return -1;
  264.58 +    }
  264.59 +
  264.60 +    /* allocate deflate memory, set up for gzip compression */
  264.61 +    strm->zalloc = Z_NULL;
  264.62 +    strm->zfree = Z_NULL;
  264.63 +    strm->opaque = Z_NULL;
  264.64 +    ret = deflateInit2(strm, state->level, Z_DEFLATED,
  264.65 +                       15 + 16, 8, state->strategy);
  264.66 +    if (ret != Z_OK) {
  264.67 +        free(state->in);
  264.68 +        gz_error(state, Z_MEM_ERROR, "out of memory");
  264.69 +        return -1;
  264.70 +    }
  264.71 +
  264.72 +    /* mark state as initialized */
  264.73 +    state->size = state->want;
  264.74 +
  264.75 +    /* initialize write buffer */
  264.76 +    strm->avail_out = state->size;
  264.77 +    strm->next_out = state->out;
  264.78 +    state->next = strm->next_out;
  264.79 +    return 0;
  264.80 +}
  264.81 +
  264.82 +/* Compress whatever is at avail_in and next_in and write to the output file.
  264.83 +   Return -1 if there is an error writing to the output file, otherwise 0.
  264.84 +   flush is assumed to be a valid deflate() flush value.  If flush is Z_FINISH,
  264.85 +   then the deflate() state is reset to start a new gzip stream. */
  264.86 +local int gz_comp(state, flush)
  264.87 +    gz_statep state;
  264.88 +    int flush;
  264.89 +{
  264.90 +    int ret, got;
  264.91 +    unsigned have;
  264.92 +    z_streamp strm = &(state->strm);
  264.93 +
  264.94 +    /* allocate memory if this is the first time through */
  264.95 +    if (state->size == 0 && gz_init(state) == -1)
  264.96 +        return -1;
  264.97 +
  264.98 +    /* run deflate() on provided input until it produces no more output */
  264.99 +    ret = Z_OK;
 264.100 +    do {
 264.101 +        /* write out current buffer contents if full, or if flushing, but if
 264.102 +           doing Z_FINISH then don't write until we get to Z_STREAM_END */
 264.103 +        if (strm->avail_out == 0 || (flush != Z_NO_FLUSH &&
 264.104 +            (flush != Z_FINISH || ret == Z_STREAM_END))) {
 264.105 +            have = (unsigned)(strm->next_out - state->next);
 264.106 +            if (have && ((got = write(state->fd, state->next, have)) < 0 ||
 264.107 +                         (unsigned)got != have)) {
 264.108 +                gz_error(state, Z_ERRNO, zstrerror());
 264.109 +                return -1;
 264.110 +            }
 264.111 +            if (strm->avail_out == 0) {
 264.112 +                strm->avail_out = state->size;
 264.113 +                strm->next_out = state->out;
 264.114 +            }
 264.115 +            state->next = strm->next_out;
 264.116 +        }
 264.117 +
 264.118 +        /* compress */
 264.119 +        have = strm->avail_out;
 264.120 +        ret = deflate(strm, flush);
 264.121 +        if (ret == Z_STREAM_ERROR) {
 264.122 +            gz_error(state, Z_STREAM_ERROR,
 264.123 +                      "internal error: deflate stream corrupt");
 264.124 +            return -1;
 264.125 +        }
 264.126 +        have -= strm->avail_out;
 264.127 +    } while (have);
 264.128 +
 264.129 +    /* if that completed a deflate stream, allow another to start */
 264.130 +    if (flush == Z_FINISH)
 264.131 +        deflateReset(strm);
 264.132 +
 264.133 +    /* all done, no errors */
 264.134 +    return 0;
 264.135 +}
 264.136 +
 264.137 +/* Compress len zeros to output.  Return -1 on error, 0 on success. */
 264.138 +local int gz_zero(state, len)
 264.139 +    gz_statep state;
 264.140 +    z_off64_t len;
 264.141 +{
 264.142 +    int first;
 264.143 +    unsigned n;
 264.144 +    z_streamp strm = &(state->strm);
 264.145 +
 264.146 +    /* consume whatever's left in the input buffer */
 264.147 +    if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
 264.148 +        return -1;
 264.149 +
 264.150 +    /* compress len zeros (len guaranteed > 0) */
 264.151 +    first = 1;
 264.152 +    while (len) {
 264.153 +        n = GT_OFF(state->size) || (z_off64_t)state->size > len ?
 264.154 +            (unsigned)len : state->size;
 264.155 +        if (first) {
 264.156 +            memset(state->in, 0, n);
 264.157 +            first = 0;
 264.158 +        }
 264.159 +        strm->avail_in = n;
 264.160 +        strm->next_in = state->in;
 264.161 +        state->pos += n;
 264.162 +        if (gz_comp(state, Z_NO_FLUSH) == -1)
 264.163 +            return -1;
 264.164 +        len -= n;
 264.165 +    }
 264.166 +    return 0;
 264.167 +}
 264.168 +
 264.169 +/* -- see zlib.h -- */
 264.170 +int ZEXPORT gzwrite(file, buf, len)
 264.171 +    gzFile file;
 264.172 +    voidpc buf;
 264.173 +    unsigned len;
 264.174 +{
 264.175 +    unsigned put = len;
 264.176 +    unsigned n;
 264.177 +    gz_statep state;
 264.178 +    z_streamp strm;
 264.179 +
 264.180 +    /* get internal structure */
 264.181 +    if (file == NULL)
 264.182 +        return 0;
 264.183 +    state = (gz_statep)file;
 264.184 +    strm = &(state->strm);
 264.185 +
 264.186 +    /* check that we're writing and that there's no error */
 264.187 +    if (state->mode != GZ_WRITE || state->err != Z_OK)
 264.188 +        return 0;
 264.189 +
 264.190 +    /* since an int is returned, make sure len fits in one, otherwise return
 264.191 +       with an error (this avoids the flaw in the interface) */
 264.192 +    if ((int)len < 0) {
 264.193 +        gz_error(state, Z_BUF_ERROR, "requested length does not fit in int");
 264.194 +        return 0;
 264.195 +    }
 264.196 +
 264.197 +    /* if len is zero, avoid unnecessary operations */
 264.198 +    if (len == 0)
 264.199 +        return 0;
 264.200 +
 264.201 +    /* allocate memory if this is the first time through */
 264.202 +    if (state->size == 0 && gz_init(state) == -1)
 264.203 +        return 0;
 264.204 +
 264.205 +    /* check for seek request */
 264.206 +    if (state->seek) {
 264.207 +        state->seek = 0;
 264.208 +        if (gz_zero(state, state->skip) == -1)
 264.209 +            return 0;
 264.210 +    }
 264.211 +
 264.212 +    /* for small len, copy to input buffer, otherwise compress directly */
 264.213 +    if (len < state->size) {
 264.214 +        /* copy to input buffer, compress when full */
 264.215 +        do {
 264.216 +            if (strm->avail_in == 0)
 264.217 +                strm->next_in = state->in;
 264.218 +            n = state->size - strm->avail_in;
 264.219 +            if (n > len)
 264.220 +                n = len;
 264.221 +            memcpy(strm->next_in + strm->avail_in, buf, n);
 264.222 +            strm->avail_in += n;
 264.223 +            state->pos += n;
 264.224 +            buf = (char *)buf + n;
 264.225 +            len -= n;
 264.226 +            if (len && gz_comp(state, Z_NO_FLUSH) == -1)
 264.227 +                return 0;
 264.228 +        } while (len);
 264.229 +    }
 264.230 +    else {
 264.231 +        /* consume whatever's left in the input buffer */
 264.232 +        if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
 264.233 +            return 0;
 264.234 +
 264.235 +        /* directly compress user buffer to file */
 264.236 +        strm->avail_in = len;
 264.237 +        strm->next_in = (voidp)buf;
 264.238 +        state->pos += len;
 264.239 +        if (gz_comp(state, Z_NO_FLUSH) == -1)
 264.240 +            return 0;
 264.241 +    }
 264.242 +
 264.243 +    /* input was all buffered or compressed (put will fit in int) */
 264.244 +    return (int)put;
 264.245 +}
 264.246 +
 264.247 +/* -- see zlib.h -- */
 264.248 +int ZEXPORT gzputc(file, c)
 264.249 +    gzFile file;
 264.250 +    int c;
 264.251 +{
 264.252 +    unsigned char buf[1];
 264.253 +    gz_statep state;
 264.254 +    z_streamp strm;
 264.255 +
 264.256 +    /* get internal structure */
 264.257 +    if (file == NULL)
 264.258 +        return -1;
 264.259 +    state = (gz_statep)file;
 264.260 +    strm = &(state->strm);
 264.261 +
 264.262 +    /* check that we're writing and that there's no error */
 264.263 +    if (state->mode != GZ_WRITE || state->err != Z_OK)
 264.264 +        return -1;
 264.265 +
 264.266 +    /* check for seek request */
 264.267 +    if (state->seek) {
 264.268 +        state->seek = 0;
 264.269 +        if (gz_zero(state, state->skip) == -1)
 264.270 +            return -1;
 264.271 +    }
 264.272 +
 264.273 +    /* try writing to input buffer for speed (state->size == 0 if buffer not
 264.274 +       initialized) */
 264.275 +    if (strm->avail_in < state->size) {
 264.276 +        if (strm->avail_in == 0)
 264.277 +            strm->next_in = state->in;
 264.278 +        strm->next_in[strm->avail_in++] = c;
 264.279 +        state->pos++;
 264.280 +        return c;
 264.281 +    }
 264.282 +
 264.283 +    /* no room in buffer or not initialized, use gz_write() */
 264.284 +    buf[0] = c;
 264.285 +    if (gzwrite(file, buf, 1) != 1)
 264.286 +        return -1;
 264.287 +    return c;
 264.288 +}
 264.289 +
 264.290 +/* -- see zlib.h -- */
 264.291 +int ZEXPORT gzputs(file, str)
 264.292 +    gzFile file;
 264.293 +    const char *str;
 264.294 +{
 264.295 +    int ret;
 264.296 +    unsigned len;
 264.297 +
 264.298 +    /* write string */
 264.299 +    len = (unsigned)strlen(str);
 264.300 +    ret = gzwrite(file, str, len);
 264.301 +    return ret == 0 && len != 0 ? -1 : ret;
 264.302 +}
 264.303 +
 264.304 +#ifdef STDC
 264.305 +#include <stdarg.h>
 264.306 +
 264.307 +/* -- see zlib.h -- */
 264.308 +int ZEXPORTVA gzprintf (gzFile file, const char *format, ...)
 264.309 +{
 264.310 +    int size, len;
 264.311 +    gz_statep state;
 264.312 +    z_streamp strm;
 264.313 +    va_list va;
 264.314 +
 264.315 +    /* get internal structure */
 264.316 +    if (file == NULL)
 264.317 +        return -1;
 264.318 +    state = (gz_statep)file;
 264.319 +    strm = &(state->strm);
 264.320 +
 264.321 +    /* check that we're writing and that there's no error */
 264.322 +    if (state->mode != GZ_WRITE || state->err != Z_OK)
 264.323 +        return 0;
 264.324 +
 264.325 +    /* make sure we have some buffer space */
 264.326 +    if (state->size == 0 && gz_init(state) == -1)
 264.327 +        return 0;
 264.328 +
 264.329 +    /* check for seek request */
 264.330 +    if (state->seek) {
 264.331 +        state->seek = 0;
 264.332 +        if (gz_zero(state, state->skip) == -1)
 264.333 +            return 0;
 264.334 +    }
 264.335 +
 264.336 +    /* consume whatever's left in the input buffer */
 264.337 +    if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
 264.338 +        return 0;
 264.339 +
 264.340 +    /* do the printf() into the input buffer, put length in len */
 264.341 +    size = (int)(state->size);
 264.342 +    state->in[size - 1] = 0;
 264.343 +    va_start(va, format);
 264.344 +#ifdef NO_vsnprintf
 264.345 +#  ifdef HAS_vsprintf_void
 264.346 +    (void)vsprintf(state->in, format, va);
 264.347 +    va_end(va);
 264.348 +    for (len = 0; len < size; len++)
 264.349 +        if (state->in[len] == 0) break;
 264.350 +#  else
 264.351 +    len = vsprintf(state->in, format, va);
 264.352 +    va_end(va);
 264.353 +#  endif
 264.354 +#else
 264.355 +#  ifdef HAS_vsnprintf_void
 264.356 +    (void)vsnprintf(state->in, size, format, va);
 264.357 +    va_end(va);
 264.358 +    len = strlen(state->in);
 264.359 +#  else
 264.360 +    len = vsnprintf((char *)(state->in), size, format, va);
 264.361 +    va_end(va);
 264.362 +#  endif
 264.363 +#endif
 264.364 +
 264.365 +    /* check that printf() results fit in buffer */
 264.366 +    if (len <= 0 || len >= (int)size || state->in[size - 1] != 0)
 264.367 +        return 0;
 264.368 +
 264.369 +    /* update buffer and position, defer compression until needed */
 264.370 +    strm->avail_in = (unsigned)len;
 264.371 +    strm->next_in = state->in;
 264.372 +    state->pos += len;
 264.373 +    return len;
 264.374 +}
 264.375 +
 264.376 +#else /* !STDC */
 264.377 +
 264.378 +/* -- see zlib.h -- */
 264.379 +int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
 264.380 +                       a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
 264.381 +    gzFile file;
 264.382 +    const char *format;
 264.383 +    int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
 264.384 +        a11, a12, a13, a14, a15, a16, a17, a18, a19, a20;
 264.385 +{
 264.386 +    int size, len;
 264.387 +    gz_statep state;
 264.388 +    z_streamp strm;
 264.389 +
 264.390 +    /* get internal structure */
 264.391 +    if (file == NULL)
 264.392 +        return -1;
 264.393 +    state = (gz_statep)file;
 264.394 +    strm = &(state->strm);
 264.395 +
 264.396 +    /* check that we're writing and that there's no error */
 264.397 +    if (state->mode != GZ_WRITE || state->err != Z_OK)
 264.398 +        return 0;
 264.399 +
 264.400 +    /* make sure we have some buffer space */
 264.401 +    if (state->size == 0 && gz_init(state) == -1)
 264.402 +        return 0;
 264.403 +
 264.404 +    /* check for seek request */
 264.405 +    if (state->seek) {
 264.406 +        state->seek = 0;
 264.407 +        if (gz_zero(state, state->skip) == -1)
 264.408 +            return 0;
 264.409 +    }
 264.410 +
 264.411 +    /* consume whatever's left in the input buffer */
 264.412 +    if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
 264.413 +        return 0;
 264.414 +
 264.415 +    /* do the printf() into the input buffer, put length in len */
 264.416 +    size = (int)(state->size);
 264.417 +    state->in[size - 1] = 0;
 264.418 +#ifdef NO_snprintf
 264.419 +#  ifdef HAS_sprintf_void
 264.420 +    sprintf(state->in, format, a1, a2, a3, a4, a5, a6, a7, a8,
 264.421 +            a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
 264.422 +    for (len = 0; len < size; len++)
 264.423 +        if (state->in[len] == 0) break;
 264.424 +#  else
 264.425 +    len = sprintf(state->in, format, a1, a2, a3, a4, a5, a6, a7, a8,
 264.426 +                a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
 264.427 +#  endif
 264.428 +#else
 264.429 +#  ifdef HAS_snprintf_void
 264.430 +    snprintf(state->in, size, format, a1, a2, a3, a4, a5, a6, a7, a8,
 264.431 +             a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
 264.432 +    len = strlen(state->in);
 264.433 +#  else
 264.434 +    len = snprintf(state->in, size, format, a1, a2, a3, a4, a5, a6, a7, a8,
 264.435 +                 a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
 264.436 +#  endif
 264.437 +#endif
 264.438 +
 264.439 +    /* check that printf() results fit in buffer */
 264.440 +    if (len <= 0 || len >= (int)size || state->in[size - 1] != 0)
 264.441 +        return 0;
 264.442 +
 264.443 +    /* update buffer and position, defer compression until needed */
 264.444 +    strm->avail_in = (unsigned)len;
 264.445 +    strm->next_in = state->in;
 264.446 +    state->pos += len;
 264.447 +    return len;
 264.448 +}
 264.449 +
 264.450 +#endif
 264.451 +
 264.452 +/* -- see zlib.h -- */
 264.453 +int ZEXPORT gzflush(file, flush)
 264.454 +    gzFile file;
 264.455 +    int flush;
 264.456 +{
 264.457 +    gz_statep state;
 264.458 +
 264.459 +    /* get internal structure */
 264.460 +    if (file == NULL)
 264.461 +        return -1;
 264.462 +    state = (gz_statep)file;
 264.463 +
 264.464 +    /* check that we're writing and that there's no error */
 264.465 +    if (state->mode != GZ_WRITE || state->err != Z_OK)
 264.466 +        return Z_STREAM_ERROR;
 264.467 +
 264.468 +    /* check flush parameter */
 264.469 +    if (flush < 0 || flush > Z_FINISH)
 264.470 +        return Z_STREAM_ERROR;
 264.471 +
 264.472 +    /* check for seek request */
 264.473 +    if (state->seek) {
 264.474 +        state->seek = 0;
 264.475 +        if (gz_zero(state, state->skip) == -1)
 264.476 +            return -1;
 264.477 +    }
 264.478 +
 264.479 +    /* compress remaining data with requested flush */
 264.480 +    gz_comp(state, flush);
 264.481 +    return state->err;
 264.482 +}
 264.483 +
 264.484 +/* -- see zlib.h -- */
 264.485 +int ZEXPORT gzsetparams(file, level, strategy)
 264.486 +    gzFile file;
 264.487 +    int level;
 264.488 +    int strategy;
 264.489 +{
 264.490 +    gz_statep state;
 264.491 +    z_streamp strm;
 264.492 +
 264.493 +    /* get internal structure */
 264.494 +    if (file == NULL)
 264.495 +        return Z_STREAM_ERROR;
 264.496 +    state = (gz_statep)file;
 264.497 +    strm = &(state->strm);
 264.498 +
 264.499 +    /* check that we're writing and that there's no error */
 264.500 +    if (state->mode != GZ_WRITE || state->err != Z_OK)
 264.501 +        return Z_STREAM_ERROR;
 264.502 +
 264.503 +    /* if no change is requested, then do nothing */
 264.504 +    if (level == state->level && strategy == state->strategy)
 264.505 +        return Z_OK;
 264.506 +
 264.507 +    /* check for seek request */
 264.508 +    if (state->seek) {
 264.509 +        state->seek = 0;
 264.510 +        if (gz_zero(state, state->skip) == -1)
 264.511 +            return -1;
 264.512 +    }
 264.513 +
 264.514 +    /* change compression parameters for subsequent input */
 264.515 +    if (state->size) {
 264.516 +        /* flush previous input with previous parameters before changing */
 264.517 +        if (strm->avail_in && gz_comp(state, Z_PARTIAL_FLUSH) == -1)
 264.518 +            return state->err;
 264.519 +        deflateParams(strm, level, strategy);
 264.520 +    }
 264.521 +    state->level = level;
 264.522 +    state->strategy = strategy;
 264.523 +    return Z_OK;
 264.524 +}
 264.525 +
 264.526 +/* -- see zlib.h -- */
 264.527 +int ZEXPORT gzclose_w(file)
 264.528 +    gzFile file;
 264.529 +{
 264.530 +    int ret = 0;
 264.531 +    gz_statep state;
 264.532 +
 264.533 +    /* get internal structure */
 264.534 +    if (file == NULL)
 264.535 +        return Z_STREAM_ERROR;
 264.536 +    state = (gz_statep)file;
 264.537 +
 264.538 +    /* check that we're writing */
 264.539 +    if (state->mode != GZ_WRITE)
 264.540 +        return Z_STREAM_ERROR;
 264.541 +
 264.542 +    /* check for seek request */
 264.543 +    if (state->seek) {
 264.544 +        state->seek = 0;
 264.545 +        ret += gz_zero(state, state->skip);
 264.546 +    }
 264.547 +
 264.548 +    /* flush, free memory, and close file */
 264.549 +    ret += gz_comp(state, Z_FINISH);
 264.550 +    (void)deflateEnd(&(state->strm));
 264.551 +    free(state->out);
 264.552 +    free(state->in);
 264.553 +    gz_error(state, Z_OK, NULL);
 264.554 +    free(state->path);
 264.555 +    ret += close(state->fd);
 264.556 +    free(state);
 264.557 +    return ret ? Z_ERRNO : Z_OK;
 264.558 +}
   265.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   265.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/infback.c	Mon Dec 19 10:06:23 2011 -0800
   265.3 @@ -0,0 +1,656 @@
   265.4 +/*
   265.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   265.6 + *
   265.7 + * This code is free software; you can redistribute it and/or modify it
   265.8 + * under the terms of the GNU General Public License version 2 only, as
   265.9 + * published by the Free Software Foundation.  Oracle designates this
  265.10 + * particular file as subject to the "Classpath" exception as provided
  265.11 + * by Oracle in the LICENSE file that accompanied this code.
  265.12 + *
  265.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
  265.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  265.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  265.16 + * version 2 for more details (a copy is included in the LICENSE file that
  265.17 + * accompanied this code).
  265.18 + *
  265.19 + * You should have received a copy of the GNU General Public License version
  265.20 + * 2 along with this work; if not, write to the Free Software Foundation,
  265.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  265.22 + *
  265.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  265.24 + * or visit www.oracle.com if you need additional information or have any
  265.25 + * questions.
  265.26 + */
  265.27 +
  265.28 +/* infback.c -- inflate using a call-back interface
  265.29 + * Copyright (C) 1995-2009 Mark Adler
  265.30 + * For conditions of distribution and use, see copyright notice in zlib.h
  265.31 + */
  265.32 +
  265.33 +/*
  265.34 +   This code is largely copied from inflate.c.  Normally either infback.o or
  265.35 +   inflate.o would be linked into an application--not both.  The interface
  265.36 +   with inffast.c is retained so that optimized assembler-coded versions of
  265.37 +   inflate_fast() can be used with either inflate.c or infback.c.
  265.38 + */
  265.39 +
  265.40 +#include "zutil.h"
  265.41 +#include "inftrees.h"
  265.42 +#include "inflate.h"
  265.43 +#include "inffast.h"
  265.44 +
  265.45 +/* function prototypes */
  265.46 +local void fixedtables OF((struct inflate_state FAR *state));
  265.47 +
  265.48 +/*
  265.49 +   strm provides memory allocation functions in zalloc and zfree, or
  265.50 +   Z_NULL to use the library memory allocation functions.
  265.51 +
  265.52 +   windowBits is in the range 8..15, and window is a user-supplied
  265.53 +   window and output buffer that is 2**windowBits bytes.
  265.54 + */
  265.55 +int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size)
  265.56 +z_streamp strm;
  265.57 +int windowBits;
  265.58 +unsigned char FAR *window;
  265.59 +const char *version;
  265.60 +int stream_size;
  265.61 +{
  265.62 +    struct inflate_state FAR *state;
  265.63 +
  265.64 +    if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
  265.65 +        stream_size != (int)(sizeof(z_stream)))
  265.66 +        return Z_VERSION_ERROR;
  265.67 +    if (strm == Z_NULL || window == Z_NULL ||
  265.68 +        windowBits < 8 || windowBits > 15)
  265.69 +        return Z_STREAM_ERROR;
  265.70 +    strm->msg = Z_NULL;                 /* in case we return an error */
  265.71 +    if (strm->zalloc == (alloc_func)0) {
  265.72 +        strm->zalloc = zcalloc;
  265.73 +        strm->opaque = (voidpf)0;
  265.74 +    }
  265.75 +    if (strm->zfree == (free_func)0) strm->zfree = zcfree;
  265.76 +    state = (struct inflate_state FAR *)ZALLOC(strm, 1,
  265.77 +                                               sizeof(struct inflate_state));
  265.78 +    if (state == Z_NULL) return Z_MEM_ERROR;
  265.79 +    Tracev((stderr, "inflate: allocated\n"));
  265.80 +    strm->state = (struct internal_state FAR *)state;
  265.81 +    state->dmax = 32768U;
  265.82 +    state->wbits = windowBits;
  265.83 +    state->wsize = 1U << windowBits;
  265.84 +    state->window = window;
  265.85 +    state->wnext = 0;
  265.86 +    state->whave = 0;
  265.87 +    return Z_OK;
  265.88 +}
  265.89 +
  265.90 +/*
  265.91 +   Return state with length and distance decoding tables and index sizes set to
  265.92 +   fixed code decoding.  Normally this returns fixed tables from inffixed.h.
  265.93 +   If BUILDFIXED is defined, then instead this routine builds the tables the
  265.94 +   first time it's called, and returns those tables the first time and
  265.95 +   thereafter.  This reduces the size of the code by about 2K bytes, in
  265.96 +   exchange for a little execution time.  However, BUILDFIXED should not be
  265.97 +   used for threaded applications, since the rewriting of the tables and virgin
  265.98 +   may not be thread-safe.
  265.99 + */
 265.100 +local void fixedtables(state)
 265.101 +struct inflate_state FAR *state;
 265.102 +{
 265.103 +#ifdef BUILDFIXED
 265.104 +    static int virgin = 1;
 265.105 +    static code *lenfix, *distfix;
 265.106 +    static code fixed[544];
 265.107 +
 265.108 +    /* build fixed huffman tables if first call (may not be thread safe) */
 265.109 +    if (virgin) {
 265.110 +        unsigned sym, bits;
 265.111 +        static code *next;
 265.112 +
 265.113 +        /* literal/length table */
 265.114 +        sym = 0;
 265.115 +        while (sym < 144) state->lens[sym++] = 8;
 265.116 +        while (sym < 256) state->lens[sym++] = 9;
 265.117 +        while (sym < 280) state->lens[sym++] = 7;
 265.118 +        while (sym < 288) state->lens[sym++] = 8;
 265.119 +        next = fixed;
 265.120 +        lenfix = next;
 265.121 +        bits = 9;
 265.122 +        inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
 265.123 +
 265.124 +        /* distance table */
 265.125 +        sym = 0;
 265.126 +        while (sym < 32) state->lens[sym++] = 5;
 265.127 +        distfix = next;
 265.128 +        bits = 5;
 265.129 +        inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
 265.130 +
 265.131 +        /* do this just once */
 265.132 +        virgin = 0;
 265.133 +    }
 265.134 +#else /* !BUILDFIXED */
 265.135 +#   include "inffixed.h"
 265.136 +#endif /* BUILDFIXED */
 265.137 +    state->lencode = lenfix;
 265.138 +    state->lenbits = 9;
 265.139 +    state->distcode = distfix;
 265.140 +    state->distbits = 5;
 265.141 +}
 265.142 +
 265.143 +/* Macros for inflateBack(): */
 265.144 +
 265.145 +/* Load returned state from inflate_fast() */
 265.146 +#define LOAD() \
 265.147 +    do { \
 265.148 +        put = strm->next_out; \
 265.149 +        left = strm->avail_out; \
 265.150 +        next = strm->next_in; \
 265.151 +        have = strm->avail_in; \
 265.152 +        hold = state->hold; \
 265.153 +        bits = state->bits; \
 265.154 +    } while (0)
 265.155 +
 265.156 +/* Set state from registers for inflate_fast() */
 265.157 +#define RESTORE() \
 265.158 +    do { \
 265.159 +        strm->next_out = put; \
 265.160 +        strm->avail_out = left; \
 265.161 +        strm->next_in = next; \
 265.162 +        strm->avail_in = have; \
 265.163 +        state->hold = hold; \
 265.164 +        state->bits = bits; \
 265.165 +    } while (0)
 265.166 +
 265.167 +/* Clear the input bit accumulator */
 265.168 +#define INITBITS() \
 265.169 +    do { \
 265.170 +        hold = 0; \
 265.171 +        bits = 0; \
 265.172 +    } while (0)
 265.173 +
 265.174 +/* Assure that some input is available.  If input is requested, but denied,
 265.175 +   then return a Z_BUF_ERROR from inflateBack(). */
 265.176 +#define PULL() \
 265.177 +    do { \
 265.178 +        if (have == 0) { \
 265.179 +            have = in(in_desc, &next); \
 265.180 +            if (have == 0) { \
 265.181 +                next = Z_NULL; \
 265.182 +                ret = Z_BUF_ERROR; \
 265.183 +                goto inf_leave; \
 265.184 +            } \
 265.185 +        } \
 265.186 +    } while (0)
 265.187 +
 265.188 +/* Get a byte of input into the bit accumulator, or return from inflateBack()
 265.189 +   with an error if there is no input available. */
 265.190 +#define PULLBYTE() \
 265.191 +    do { \
 265.192 +        PULL(); \
 265.193 +        have--; \
 265.194 +        hold += (unsigned long)(*next++) << bits; \
 265.195 +        bits += 8; \
 265.196 +    } while (0)
 265.197 +
 265.198 +/* Assure that there are at least n bits in the bit accumulator.  If there is
 265.199 +   not enough available input to do that, then return from inflateBack() with
 265.200 +   an error. */
 265.201 +#define NEEDBITS(n) \
 265.202 +    do { \
 265.203 +        while (bits < (unsigned)(n)) \
 265.204 +            PULLBYTE(); \
 265.205 +    } while (0)
 265.206 +
 265.207 +/* Return the low n bits of the bit accumulator (n < 16) */
 265.208 +#define BITS(n) \
 265.209 +    ((unsigned)hold & ((1U << (n)) - 1))
 265.210 +
 265.211 +/* Remove n bits from the bit accumulator */
 265.212 +#define DROPBITS(n) \
 265.213 +    do { \
 265.214 +        hold >>= (n); \
 265.215 +        bits -= (unsigned)(n); \
 265.216 +    } while (0)
 265.217 +
 265.218 +/* Remove zero to seven bits as needed to go to a byte boundary */
 265.219 +#define BYTEBITS() \
 265.220 +    do { \
 265.221 +        hold >>= bits & 7; \
 265.222 +        bits -= bits & 7; \
 265.223 +    } while (0)
 265.224 +
 265.225 +/* Assure that some output space is available, by writing out the window
 265.226 +   if it's full.  If the write fails, return from inflateBack() with a
 265.227 +   Z_BUF_ERROR. */
 265.228 +#define ROOM() \
 265.229 +    do { \
 265.230 +        if (left == 0) { \
 265.231 +            put = state->window; \
 265.232 +            left = state->wsize; \
 265.233 +            state->whave = left; \
 265.234 +            if (out(out_desc, put, left)) { \
 265.235 +                ret = Z_BUF_ERROR; \
 265.236 +                goto inf_leave; \
 265.237 +            } \
 265.238 +        } \
 265.239 +    } while (0)
 265.240 +
 265.241 +/*
 265.242 +   strm provides the memory allocation functions and window buffer on input,
 265.243 +   and provides information on the unused input on return.  For Z_DATA_ERROR
 265.244 +   returns, strm will also provide an error message.
 265.245 +
 265.246 +   in() and out() are the call-back input and output functions.  When
 265.247 +   inflateBack() needs more input, it calls in().  When inflateBack() has
 265.248 +   filled the window with output, or when it completes with data in the
 265.249 +   window, it calls out() to write out the data.  The application must not
 265.250 +   change the provided input until in() is called again or inflateBack()
 265.251 +   returns.  The application must not change the window/output buffer until
 265.252 +   inflateBack() returns.
 265.253 +
 265.254 +   in() and out() are called with a descriptor parameter provided in the
 265.255 +   inflateBack() call.  This parameter can be a structure that provides the
 265.256 +   information required to do the read or write, as well as accumulated
 265.257 +   information on the input and output such as totals and check values.
 265.258 +
 265.259 +   in() should return zero on failure.  out() should return non-zero on
 265.260 +   failure.  If either in() or out() fails, than inflateBack() returns a
 265.261 +   Z_BUF_ERROR.  strm->next_in can be checked for Z_NULL to see whether it
 265.262 +   was in() or out() that caused in the error.  Otherwise,  inflateBack()
 265.263 +   returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format
 265.264 +   error, or Z_MEM_ERROR if it could not allocate memory for the state.
 265.265 +   inflateBack() can also return Z_STREAM_ERROR if the input parameters
 265.266 +   are not correct, i.e. strm is Z_NULL or the state was not initialized.
 265.267 + */
 265.268 +int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc)
 265.269 +z_streamp strm;
 265.270 +in_func in;
 265.271 +void FAR *in_desc;
 265.272 +out_func out;
 265.273 +void FAR *out_desc;
 265.274 +{
 265.275 +    struct inflate_state FAR *state;
 265.276 +    unsigned char FAR *next;    /* next input */
 265.277 +    unsigned char FAR *put;     /* next output */
 265.278 +    unsigned have, left;        /* available input and output */
 265.279 +    unsigned long hold;         /* bit buffer */
 265.280 +    unsigned bits;              /* bits in bit buffer */
 265.281 +    unsigned copy;              /* number of stored or match bytes to copy */
 265.282 +    unsigned char FAR *from;    /* where to copy match bytes from */
 265.283 +    code here;                  /* current decoding table entry */
 265.284 +    code last;                  /* parent table entry */
 265.285 +    unsigned len;               /* length to copy for repeats, bits to drop */
 265.286 +    int ret;                    /* return code */
 265.287 +    static const unsigned short order[19] = /* permutation of code lengths */
 265.288 +        {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
 265.289 +
 265.290 +    /* Check that the strm exists and that the state was initialized */
 265.291 +    if (strm == Z_NULL || strm->state == Z_NULL)
 265.292 +        return Z_STREAM_ERROR;
 265.293 +    state = (struct inflate_state FAR *)strm->state;
 265.294 +
 265.295 +    /* Reset the state */
 265.296 +    strm->msg = Z_NULL;
 265.297 +    state->mode = TYPE;
 265.298 +    state->last = 0;
 265.299 +    state->whave = 0;
 265.300 +    next = strm->next_in;
 265.301 +    have = next != Z_NULL ? strm->avail_in : 0;
 265.302 +    hold = 0;
 265.303 +    bits = 0;
 265.304 +    put = state->window;
 265.305 +    left = state->wsize;
 265.306 +
 265.307 +    /* Inflate until end of block marked as last */
 265.308 +    for (;;)
 265.309 +        switch (state->mode) {
 265.310 +        case TYPE:
 265.311 +            /* determine and dispatch block type */
 265.312 +            if (state->last) {
 265.313 +                BYTEBITS();
 265.314 +                state->mode = DONE;
 265.315 +                break;
 265.316 +            }
 265.317 +            NEEDBITS(3);
 265.318 +            state->last = BITS(1);
 265.319 +            DROPBITS(1);
 265.320 +            switch (BITS(2)) {
 265.321 +            case 0:                             /* stored block */
 265.322 +                Tracev((stderr, "inflate:     stored block%s\n",
 265.323 +                        state->last ? " (last)" : ""));
 265.324 +                state->mode = STORED;
 265.325 +                break;
 265.326 +            case 1:                             /* fixed block */
 265.327 +                fixedtables(state);
 265.328 +                Tracev((stderr, "inflate:     fixed codes block%s\n",
 265.329 +                        state->last ? " (last)" : ""));
 265.330 +                state->mode = LEN;              /* decode codes */
 265.331 +                break;
 265.332 +            case 2:                             /* dynamic block */
 265.333 +                Tracev((stderr, "inflate:     dynamic codes block%s\n",
 265.334 +                        state->last ? " (last)" : ""));
 265.335 +                state->mode = TABLE;
 265.336 +                break;
 265.337 +            case 3:
 265.338 +                strm->msg = (char *)"invalid block type";
 265.339 +                state->mode = BAD;
 265.340 +            }
 265.341 +            DROPBITS(2);
 265.342 +            break;
 265.343 +
 265.344 +        case STORED:
 265.345 +            /* get and verify stored block length */
 265.346 +            BYTEBITS();                         /* go to byte boundary */
 265.347 +            NEEDBITS(32);
 265.348 +            if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
 265.349 +                strm->msg = (char *)"invalid stored block lengths";
 265.350 +                state->mode = BAD;
 265.351 +                break;
 265.352 +            }
 265.353 +            state->length = (unsigned)hold & 0xffff;
 265.354 +            Tracev((stderr, "inflate:       stored length %u\n",
 265.355 +                    state->length));
 265.356 +            INITBITS();
 265.357 +
 265.358 +            /* copy stored block from input to output */
 265.359 +            while (state->length != 0) {
 265.360 +                copy = state->length;
 265.361 +                PULL();
 265.362 +                ROOM();
 265.363 +                if (copy > have) copy = have;
 265.364 +                if (copy > left) copy = left;
 265.365 +                zmemcpy(put, next, copy);
 265.366 +                have -= copy;
 265.367 +                next += copy;
 265.368 +                left -= copy;
 265.369 +                put += copy;
 265.370 +                state->length -= copy;
 265.371 +            }
 265.372 +            Tracev((stderr, "inflate:       stored end\n"));
 265.373 +            state->mode = TYPE;
 265.374 +            break;
 265.375 +
 265.376 +        case TABLE:
 265.377 +            /* get dynamic table entries descriptor */
 265.378 +            NEEDBITS(14);
 265.379 +            state->nlen = BITS(5) + 257;
 265.380 +            DROPBITS(5);
 265.381 +            state->ndist = BITS(5) + 1;
 265.382 +            DROPBITS(5);
 265.383 +            state->ncode = BITS(4) + 4;
 265.384 +            DROPBITS(4);
 265.385 +#ifndef PKZIP_BUG_WORKAROUND
 265.386 +            if (state->nlen > 286 || state->ndist > 30) {
 265.387 +                strm->msg = (char *)"too many length or distance symbols";
 265.388 +                state->mode = BAD;
 265.389 +                break;
 265.390 +            }
 265.391 +#endif
 265.392 +            Tracev((stderr, "inflate:       table sizes ok\n"));
 265.393 +
 265.394 +            /* get code length code lengths (not a typo) */
 265.395 +            state->have = 0;
 265.396 +            while (state->have < state->ncode) {
 265.397 +                NEEDBITS(3);
 265.398 +                state->lens[order[state->have++]] = (unsigned short)BITS(3);
 265.399 +                DROPBITS(3);
 265.400 +            }
 265.401 +            while (state->have < 19)
 265.402 +                state->lens[order[state->have++]] = 0;
 265.403 +            state->next = state->codes;
 265.404 +            state->lencode = (code const FAR *)(state->next);
 265.405 +            state->lenbits = 7;
 265.406 +            ret = inflate_table(CODES, state->lens, 19, &(state->next),
 265.407 +                                &(state->lenbits), state->work);
 265.408 +            if (ret) {
 265.409 +                strm->msg = (char *)"invalid code lengths set";
 265.410 +                state->mode = BAD;
 265.411 +                break;
 265.412 +            }
 265.413 +            Tracev((stderr, "inflate:       code lengths ok\n"));
 265.414 +
 265.415 +            /* get length and distance code code lengths */
 265.416 +            state->have = 0;
 265.417 +            while (state->have < state->nlen + state->ndist) {
 265.418 +                for (;;) {
 265.419 +                    here = state->lencode[BITS(state->lenbits)];
 265.420 +                    if ((unsigned)(here.bits) <= bits) break;
 265.421 +                    PULLBYTE();
 265.422 +                }
 265.423 +                if (here.val < 16) {
 265.424 +                    NEEDBITS(here.bits);
 265.425 +                    DROPBITS(here.bits);
 265.426 +                    state->lens[state->have++] = here.val;
 265.427 +                }
 265.428 +                else {
 265.429 +                    if (here.val == 16) {
 265.430 +                        NEEDBITS(here.bits + 2);
 265.431 +                        DROPBITS(here.bits);
 265.432 +                        if (state->have == 0) {
 265.433 +                            strm->msg = (char *)"invalid bit length repeat";
 265.434 +                            state->mode = BAD;
 265.435 +                            break;
 265.436 +                        }
 265.437 +                        len = (unsigned)(state->lens[state->have - 1]);
 265.438 +                        copy = 3 + BITS(2);
 265.439 +                        DROPBITS(2);
 265.440 +                    }
 265.441 +                    else if (here.val == 17) {
 265.442 +                        NEEDBITS(here.bits + 3);
 265.443 +                        DROPBITS(here.bits);
 265.444 +                        len = 0;
 265.445 +                        copy = 3 + BITS(3);
 265.446 +                        DROPBITS(3);
 265.447 +                    }
 265.448 +                    else {
 265.449 +                        NEEDBITS(here.bits + 7);
 265.450 +                        DROPBITS(here.bits);
 265.451 +                        len = 0;
 265.452 +                        copy = 11 + BITS(7);
 265.453 +                        DROPBITS(7);
 265.454 +                    }
 265.455 +                    if (state->have + copy > state->nlen + state->ndist) {
 265.456 +                        strm->msg = (char *)"invalid bit length repeat";
 265.457 +                        state->mode = BAD;
 265.458 +                        break;
 265.459 +                    }
 265.460 +                    while (copy--)
 265.461 +                        state->lens[state->have++] = (unsigned short)len;
 265.462 +                }
 265.463 +            }
 265.464 +
 265.465 +            /* handle error breaks in while */
 265.466 +            if (state->mode == BAD) break;
 265.467 +
 265.468 +            /* check for end-of-block code (better have one) */
 265.469 +            if (state->lens[256] == 0) {
 265.470 +                strm->msg = (char *)"invalid code -- missing end-of-block";
 265.471 +                state->mode = BAD;
 265.472 +                break;
 265.473 +            }
 265.474 +
 265.475 +            /* build code tables -- note: do not change the lenbits or distbits
 265.476 +               values here (9 and 6) without reading the comments in inftrees.h
 265.477 +               concerning the ENOUGH constants, which depend on those values */
 265.478 +            state->next = state->codes;
 265.479 +            state->lencode = (code const FAR *)(state->next);
 265.480 +            state->lenbits = 9;
 265.481 +            ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
 265.482 +                                &(state->lenbits), state->work);
 265.483 +            if (ret) {
 265.484 +                strm->msg = (char *)"invalid literal/lengths set";
 265.485 +                state->mode = BAD;
 265.486 +                break;
 265.487 +            }
 265.488 +            state->distcode = (code const FAR *)(state->next);
 265.489 +            state->distbits = 6;
 265.490 +            ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
 265.491 +                            &(state->next), &(state->distbits), state->work);
 265.492 +            if (ret) {
 265.493 +                strm->msg = (char *)"invalid distances set";
 265.494 +                state->mode = BAD;
 265.495 +                break;
 265.496 +            }
 265.497 +            Tracev((stderr, "inflate:       codes ok\n"));
 265.498 +            state->mode = LEN;
 265.499 +
 265.500 +        case LEN:
 265.501 +            /* use inflate_fast() if we have enough input and output */
 265.502 +            if (have >= 6 && left >= 258) {
 265.503 +                RESTORE();
 265.504 +                if (state->whave < state->wsize)
 265.505 +                    state->whave = state->wsize - left;
 265.506 +                inflate_fast(strm, state->wsize);
 265.507 +                LOAD();
 265.508 +                break;
 265.509 +            }
 265.510 +
 265.511 +            /* get a literal, length, or end-of-block code */
 265.512 +            for (;;) {
 265.513 +                here = state->lencode[BITS(state->lenbits)];
 265.514 +                if ((unsigned)(here.bits) <= bits) break;
 265.515 +                PULLBYTE();
 265.516 +            }
 265.517 +            if (here.op && (here.op & 0xf0) == 0) {
 265.518 +                last = here;
 265.519 +                for (;;) {
 265.520 +                    here = state->lencode[last.val +
 265.521 +                            (BITS(last.bits + last.op) >> last.bits)];
 265.522 +                    if ((unsigned)(last.bits + here.bits) <= bits) break;
 265.523 +                    PULLBYTE();
 265.524 +                }
 265.525 +                DROPBITS(last.bits);
 265.526 +            }
 265.527 +            DROPBITS(here.bits);
 265.528 +            state->length = (unsigned)here.val;
 265.529 +
 265.530 +            /* process literal */
 265.531 +            if (here.op == 0) {
 265.532 +                Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
 265.533 +                        "inflate:         literal '%c'\n" :
 265.534 +                        "inflate:         literal 0x%02x\n", here.val));
 265.535 +                ROOM();
 265.536 +                *put++ = (unsigned char)(state->length);
 265.537 +                left--;
 265.538 +                state->mode = LEN;
 265.539 +                break;
 265.540 +            }
 265.541 +
 265.542 +            /* process end of block */
 265.543 +            if (here.op & 32) {
 265.544 +                Tracevv((stderr, "inflate:         end of block\n"));
 265.545 +                state->mode = TYPE;
 265.546 +                break;
 265.547 +            }
 265.548 +
 265.549 +            /* invalid code */
 265.550 +            if (here.op & 64) {
 265.551 +                strm->msg = (char *)"invalid literal/length code";
 265.552 +                state->mode = BAD;
 265.553 +                break;
 265.554 +            }
 265.555 +
 265.556 +            /* length code -- get extra bits, if any */
 265.557 +            state->extra = (unsigned)(here.op) & 15;
 265.558 +            if (state->extra != 0) {
 265.559 +                NEEDBITS(state->extra);
 265.560 +                state->length += BITS(state->extra);
 265.561 +                DROPBITS(state->extra);
 265.562 +            }
 265.563 +            Tracevv((stderr, "inflate:         length %u\n", state->length));
 265.564 +
 265.565 +            /* get distance code */
 265.566 +            for (;;) {
 265.567 +                here = state->distcode[BITS(state->distbits)];
 265.568 +                if ((unsigned)(here.bits) <= bits) break;
 265.569 +                PULLBYTE();
 265.570 +            }
 265.571 +            if ((here.op & 0xf0) == 0) {
 265.572 +                last = here;
 265.573 +                for (;;) {
 265.574 +                    here = state->distcode[last.val +
 265.575 +                            (BITS(last.bits + last.op) >> last.bits)];
 265.576 +                    if ((unsigned)(last.bits + here.bits) <= bits) break;
 265.577 +                    PULLBYTE();
 265.578 +                }
 265.579 +                DROPBITS(last.bits);
 265.580 +            }
 265.581 +            DROPBITS(here.bits);
 265.582 +            if (here.op & 64) {
 265.583 +                strm->msg = (char *)"invalid distance code";
 265.584 +                state->mode = BAD;
 265.585 +                break;
 265.586 +            }
 265.587 +            state->offset = (unsigned)here.val;
 265.588 +
 265.589 +            /* get distance extra bits, if any */
 265.590 +            state->extra = (unsigned)(here.op) & 15;
 265.591 +            if (state->extra != 0) {
 265.592 +                NEEDBITS(state->extra);
 265.593 +                state->offset += BITS(state->extra);
 265.594 +                DROPBITS(state->extra);
 265.595 +            }
 265.596 +            if (state->offset > state->wsize - (state->whave < state->wsize ?
 265.597 +                                                left : 0)) {
 265.598 +                strm->msg = (char *)"invalid distance too far back";
 265.599 +                state->mode = BAD;
 265.600 +                break;
 265.601 +            }
 265.602 +            Tracevv((stderr, "inflate:         distance %u\n", state->offset));
 265.603 +
 265.604 +            /* copy match from window to output */
 265.605 +            do {
 265.606 +                ROOM();
 265.607 +                copy = state->wsize - state->offset;
 265.608 +                if (copy < left) {
 265.609 +                    from = put + copy;
 265.610 +                    copy = left - copy;
 265.611 +                }
 265.612 +                else {
 265.613 +                    from = put - state->offset;
 265.614 +                    copy = left;
 265.615 +                }
 265.616 +                if (copy > state->length) copy = state->length;
 265.617 +                state->length -= copy;
 265.618 +                left -= copy;
 265.619 +                do {
 265.620 +                    *put++ = *from++;
 265.621 +                } while (--copy);
 265.622 +            } while (state->length != 0);
 265.623 +            break;
 265.624 +
 265.625 +        case DONE:
 265.626 +            /* inflate stream terminated properly -- write leftover output */
 265.627 +            ret = Z_STREAM_END;
 265.628 +            if (left < state->wsize) {
 265.629 +                if (out(out_desc, state->window, state->wsize - left))
 265.630 +                    ret = Z_BUF_ERROR;
 265.631 +            }
 265.632 +            goto inf_leave;
 265.633 +
 265.634 +        case BAD:
 265.635 +            ret = Z_DATA_ERROR;
 265.636 +            goto inf_leave;
 265.637 +
 265.638 +        default:                /* can't happen, but makes compilers happy */
 265.639 +            ret = Z_STREAM_ERROR;
 265.640 +            goto inf_leave;
 265.641 +        }
 265.642 +
 265.643 +    /* Return unused input */
 265.644 +  inf_leave:
 265.645 +    strm->next_in = next;
 265.646 +    strm->avail_in = have;
 265.647 +    return ret;
 265.648 +}
 265.649 +
 265.650 +int ZEXPORT inflateBackEnd(strm)
 265.651 +z_streamp strm;
 265.652 +{
 265.653 +    if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
 265.654 +        return Z_STREAM_ERROR;
 265.655 +    ZFREE(strm, strm->state);
 265.656 +    strm->state = Z_NULL;
 265.657 +    Tracev((stderr, "inflate: end\n"));
 265.658 +    return Z_OK;
 265.659 +}
   266.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   266.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/inffast.c	Mon Dec 19 10:06:23 2011 -0800
   266.3 @@ -0,0 +1,364 @@
   266.4 +/*
   266.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   266.6 + *
   266.7 + * This code is free software; you can redistribute it and/or modify it
   266.8 + * under the terms of the GNU General Public License version 2 only, as
   266.9 + * published by the Free Software Foundation.  Oracle designates this
  266.10 + * particular file as subject to the "Classpath" exception as provided
  266.11 + * by Oracle in the LICENSE file that accompanied this code.
  266.12 + *
  266.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
  266.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  266.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  266.16 + * version 2 for more details (a copy is included in the LICENSE file that
  266.17 + * accompanied this code).
  266.18 + *
  266.19 + * You should have received a copy of the GNU General Public License version
  266.20 + * 2 along with this work; if not, write to the Free Software Foundation,
  266.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  266.22 + *
  266.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  266.24 + * or visit www.oracle.com if you need additional information or have any
  266.25 + * questions.
  266.26 + */
  266.27 +
  266.28 +/* inffast.c -- fast decoding
  266.29 + * Copyright (C) 1995-2008, 2010 Mark Adler
  266.30 + * For conditions of distribution and use, see copyright notice in zlib.h
  266.31 + */
  266.32 +
  266.33 +#include "zutil.h"
  266.34 +#include "inftrees.h"
  266.35 +#include "inflate.h"
  266.36 +#include "inffast.h"
  266.37 +
  266.38 +#ifndef ASMINF
  266.39 +
  266.40 +/* Allow machine dependent optimization for post-increment or pre-increment.
  266.41 +   Based on testing to date,
  266.42 +   Pre-increment preferred for:
  266.43 +   - PowerPC G3 (Adler)
  266.44 +   - MIPS R5000 (Randers-Pehrson)
  266.45 +   Post-increment preferred for:
  266.46 +   - none
  266.47 +   No measurable difference:
  266.48 +   - Pentium III (Anderson)
  266.49 +   - M68060 (Nikl)
  266.50 + */
  266.51 +#ifdef POSTINC
  266.52 +#  define OFF 0
  266.53 +#  define PUP(a) *(a)++
  266.54 +#else
  266.55 +#  define OFF 1
  266.56 +#  define PUP(a) *++(a)
  266.57 +#endif
  266.58 +
  266.59 +/*
  266.60 +   Decode literal, length, and distance codes and write out the resulting
  266.61 +   literal and match bytes until either not enough input or output is
  266.62 +   available, an end-of-block is encountered, or a data error is encountered.
  266.63 +   When large enough input and output buffers are supplied to inflate(), for
  266.64 +   example, a 16K input buffer and a 64K output buffer, more than 95% of the
  266.65 +   inflate execution time is spent in this routine.
  266.66 +
  266.67 +   Entry assumptions:
  266.68 +
  266.69 +        state->mode == LEN
  266.70 +        strm->avail_in >= 6
  266.71 +        strm->avail_out >= 258
  266.72 +        start >= strm->avail_out
  266.73 +        state->bits < 8
  266.74 +
  266.75 +   On return, state->mode is one of:
  266.76 +
  266.77 +        LEN -- ran out of enough output space or enough available input
  266.78 +        TYPE -- reached end of block code, inflate() to interpret next block
  266.79 +        BAD -- error in block data
  266.80 +
  266.81 +   Notes:
  266.82 +
  266.83 +    - The maximum input bits used by a length/distance pair is 15 bits for the
  266.84 +      length code, 5 bits for the length extra, 15 bits for the distance code,
  266.85 +      and 13 bits for the distance extra.  This totals 48 bits, or six bytes.
  266.86 +      Therefore if strm->avail_in >= 6, then there is enough input to avoid
  266.87 +      checking for available input while decoding.
  266.88 +
  266.89 +    - The maximum bytes that a single length/distance pair can output is 258
  266.90 +      bytes, which is the maximum length that can be coded.  inflate_fast()
  266.91 +      requires strm->avail_out >= 258 for each loop to avoid checking for
  266.92 +      output space.
  266.93 + */
  266.94 +void ZLIB_INTERNAL inflate_fast(strm, start)
  266.95 +z_streamp strm;
  266.96 +unsigned start;         /* inflate()'s starting value for strm->avail_out */
  266.97 +{
  266.98 +    struct inflate_state FAR *state;
  266.99 +    unsigned char FAR *in;      /* local strm->next_in */
 266.100 +    unsigned char FAR *last;    /* while in < last, enough input available */
 266.101 +    unsigned char FAR *out;     /* local strm->next_out */
 266.102 +    unsigned char FAR *beg;     /* inflate()'s initial strm->next_out */
 266.103 +    unsigned char FAR *end;     /* while out < end, enough space available */
 266.104 +#ifdef INFLATE_STRICT
 266.105 +    unsigned dmax;              /* maximum distance from zlib header */
 266.106 +#endif
 266.107 +    unsigned wsize;             /* window size or zero if not using window */
 266.108 +    unsigned whave;             /* valid bytes in the window */
 266.109 +    unsigned wnext;             /* window write index */
 266.110 +    unsigned char FAR *window;  /* allocated sliding window, if wsize != 0 */
 266.111 +    unsigned long hold;         /* local strm->hold */
 266.112 +    unsigned bits;              /* local strm->bits */
 266.113 +    code const FAR *lcode;      /* local strm->lencode */
 266.114 +    code const FAR *dcode;      /* local strm->distcode */
 266.115 +    unsigned lmask;             /* mask for first level of length codes */
 266.116 +    unsigned dmask;             /* mask for first level of distance codes */
 266.117 +    code here;                  /* retrieved table entry */
 266.118 +    unsigned op;                /* code bits, operation, extra bits, or */
 266.119 +                                /*  window position, window bytes to copy */
 266.120 +    unsigned len;               /* match length, unused bytes */
 266.121 +    unsigned dist;              /* match distance */
 266.122 +    unsigned char FAR *from;    /* where to copy match from */
 266.123 +
 266.124 +    /* copy state to local variables */
 266.125 +    state = (struct inflate_state FAR *)strm->state;
 266.126 +    in = strm->next_in - OFF;
 266.127 +    last = in + (strm->avail_in - 5);
 266.128 +    out = strm->next_out - OFF;
 266.129 +    beg = out - (start - strm->avail_out);
 266.130 +    end = out + (strm->avail_out - 257);
 266.131 +#ifdef INFLATE_STRICT
 266.132 +    dmax = state->dmax;
 266.133 +#endif
 266.134 +    wsize = state->wsize;
 266.135 +    whave = state->whave;
 266.136 +    wnext = state->wnext;
 266.137 +    window = state->window;
 266.138 +    hold = state->hold;
 266.139 +    bits = state->bits;
 266.140 +    lcode = state->lencode;
 266.141 +    dcode = state->distcode;
 266.142 +    lmask = (1U << state->lenbits) - 1;
 266.143 +    dmask = (1U << state->distbits) - 1;
 266.144 +
 266.145 +    /* decode literals and length/distances until end-of-block or not enough
 266.146 +       input data or output space */
 266.147 +    do {
 266.148 +        if (bits < 15) {
 266.149 +            hold += (unsigned long)(PUP(in)) << bits;
 266.150 +            bits += 8;
 266.151 +            hold += (unsigned long)(PUP(in)) << bits;
 266.152 +            bits += 8;
 266.153 +        }
 266.154 +        here = lcode[hold & lmask];
 266.155 +      dolen:
 266.156 +        op = (unsigned)(here.bits);
 266.157 +        hold >>= op;
 266.158 +        bits -= op;
 266.159 +        op = (unsigned)(here.op);
 266.160 +        if (op == 0) {                          /* literal */
 266.161 +            Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
 266.162 +                    "inflate:         literal '%c'\n" :
 266.163 +                    "inflate:         literal 0x%02x\n", here.val));
 266.164 +            PUP(out) = (unsigned char)(here.val);
 266.165 +        }
 266.166 +        else if (op & 16) {                     /* length base */
 266.167 +            len = (unsigned)(here.val);
 266.168 +            op &= 15;                           /* number of extra bits */
 266.169 +            if (op) {
 266.170 +                if (bits < op) {
 266.171 +                    hold += (unsigned long)(PUP(in)) << bits;
 266.172 +                    bits += 8;
 266.173 +                }
 266.174 +                len += (unsigned)hold & ((1U << op) - 1);
 266.175 +                hold >>= op;
 266.176 +                bits -= op;
 266.177 +            }
 266.178 +            Tracevv((stderr, "inflate:         length %u\n", len));
 266.179 +            if (bits < 15) {
 266.180 +                hold += (unsigned long)(PUP(in)) << bits;
 266.181 +                bits += 8;
 266.182 +                hold += (unsigned long)(PUP(in)) << bits;
 266.183 +                bits += 8;
 266.184 +            }
 266.185 +            here = dcode[hold & dmask];
 266.186 +          dodist:
 266.187 +            op = (unsigned)(here.bits);
 266.188 +            hold >>= op;
 266.189 +            bits -= op;
 266.190 +            op = (unsigned)(here.op);
 266.191 +            if (op & 16) {                      /* distance base */
 266.192 +                dist = (unsigned)(here.val);
 266.193 +                op &= 15;                       /* number of extra bits */
 266.194 +                if (bits < op) {
 266.195 +                    hold += (unsigned long)(PUP(in)) << bits;
 266.196 +                    bits += 8;
 266.197 +                    if (bits < op) {
 266.198 +                        hold += (unsigned long)(PUP(in)) << bits;
 266.199 +                        bits += 8;
 266.200 +                    }
 266.201 +                }
 266.202 +                dist += (unsigned)hold & ((1U << op) - 1);
 266.203 +#ifdef INFLATE_STRICT
 266.204 +                if (dist > dmax) {
 266.205 +                    strm->msg = (char *)"invalid distance too far back";
 266.206 +                    state->mode = BAD;
 266.207 +                    break;
 266.208 +                }
 266.209 +#endif
 266.210 +                hold >>= op;
 266.211 +                bits -= op;
 266.212 +                Tracevv((stderr, "inflate:         distance %u\n", dist));
 266.213 +                op = (unsigned)(out - beg);     /* max distance in output */
 266.214 +                if (dist > op) {                /* see if copy from window */
 266.215 +                    op = dist - op;             /* distance back in window */
 266.216 +                    if (op > whave) {
 266.217 +                        if (state->sane) {
 266.218 +                            strm->msg =
 266.219 +                                (char *)"invalid distance too far back";
 266.220 +                            state->mode = BAD;
 266.221 +                            break;
 266.222 +                        }
 266.223 +#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
 266.224 +                        if (len <= op - whave) {
 266.225 +                            do {
 266.226 +                                PUP(out) = 0;
 266.227 +                            } while (--len);
 266.228 +                            continue;
 266.229 +                        }
 266.230 +                        len -= op - whave;
 266.231 +                        do {
 266.232 +                            PUP(out) = 0;
 266.233 +                        } while (--op > whave);
 266.234 +                        if (op == 0) {
 266.235 +                            from = out - dist;
 266.236 +                            do {
 266.237 +                                PUP(out) = PUP(from);
 266.238 +                            } while (--len);
 266.239 +                            continue;
 266.240 +                        }
 266.241 +#endif
 266.242 +                    }
 266.243 +                    from = window - OFF;
 266.244 +                    if (wnext == 0) {           /* very common case */
 266.245 +                        from += wsize - op;
 266.246 +                        if (op < len) {         /* some from window */
 266.247 +                            len -= op;
 266.248 +                            do {
 266.249 +                                PUP(out) = PUP(from);
 266.250 +                            } while (--op);
 266.251 +                            from = out - dist;  /* rest from output */
 266.252 +                        }
 266.253 +                    }
 266.254 +                    else if (wnext < op) {      /* wrap around window */
 266.255 +                        from += wsize + wnext - op;
 266.256 +                        op -= wnext;
 266.257 +                        if (op < len) {         /* some from end of window */
 266.258 +                            len -= op;
 266.259 +                            do {
 266.260 +                                PUP(out) = PUP(from);
 266.261 +                            } while (--op);
 266.262 +                            from = window - OFF;
 266.263 +                            if (wnext < len) {  /* some from start of window */
 266.264 +                                op = wnext;
 266.265 +                                len -= op;
 266.266 +                                do {
 266.267 +                                    PUP(out) = PUP(from);
 266.268 +                                } while (--op);
 266.269 +                                from = out - dist;      /* rest from output */
 266.270 +                            }
 266.271 +                        }
 266.272 +                    }
 266.273 +                    else {                      /* contiguous in window */
 266.274 +                        from += wnext - op;
 266.275 +                        if (op < len) {         /* some from window */
 266.276 +                            len -= op;
 266.277 +                            do {
 266.278 +                                PUP(out) = PUP(from);
 266.279 +                            } while (--op);
 266.280 +                            from = out - dist;  /* rest from output */
 266.281 +                        }
 266.282 +                    }
 266.283 +                    while (len > 2) {
 266.284 +                        PUP(out) = PUP(from);
 266.285 +                        PUP(out) = PUP(from);
 266.286 +                        PUP(out) = PUP(from);
 266.287 +                        len -= 3;
 266.288 +                    }
 266.289 +                    if (len) {
 266.290 +                        PUP(out) = PUP(from);
 266.291 +                        if (len > 1)
 266.292 +                            PUP(out) = PUP(from);
 266.293 +                    }
 266.294 +                }
 266.295 +                else {
 266.296 +                    from = out - dist;          /* copy direct from output */
 266.297 +                    do {                        /* minimum length is three */
 266.298 +                        PUP(out) = PUP(from);
 266.299 +                        PUP(out) = PUP(from);
 266.300 +                        PUP(out) = PUP(from);
 266.301 +                        len -= 3;
 266.302 +                    } while (len > 2);
 266.303 +                    if (len) {
 266.304 +                        PUP(out) = PUP(from);
 266.305 +                        if (len > 1)
 266.306 +                            PUP(out) = PUP(from);
 266.307 +                    }
 266.308 +                }
 266.309 +            }
 266.310 +            else if ((op & 64) == 0) {          /* 2nd level distance code */
 266.311 +                here = dcode[here.val + (hold & ((1U << op) - 1))];
 266.312 +                goto dodist;
 266.313 +            }
 266.314 +            else {
 266.315 +                strm->msg = (char *)"invalid distance code";
 266.316 +                state->mode = BAD;
 266.317 +                break;
 266.318 +            }
 266.319 +        }
 266.320 +        else if ((op & 64) == 0) {              /* 2nd level length code */
 266.321 +            here = lcode[here.val + (hold & ((1U << op) - 1))];
 266.322 +            goto dolen;
 266.323 +        }
 266.324 +        else if (op & 32) {                     /* end-of-block */
 266.325 +            Tracevv((stderr, "inflate:         end of block\n"));
 266.326 +            state->mode = TYPE;
 266.327 +            break;
 266.328 +        }
 266.329 +        else {
 266.330 +            strm->msg = (char *)"invalid literal/length code";
 266.331 +            state->mode = BAD;
 266.332 +            break;
 266.333 +        }
 266.334 +    } while (in < last && out < end);
 266.335 +
 266.336 +    /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
 266.337 +    len = bits >> 3;
 266.338 +    in -= len;
 266.339 +    bits -= len << 3;
 266.340 +    hold &= (1U << bits) - 1;
 266.341 +
 266.342 +    /* update state and return */
 266.343 +    strm->next_in = in + OFF;
 266.344 +    strm->next_out = out + OFF;
 266.345 +    strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
 266.346 +    strm->avail_out = (unsigned)(out < end ?
 266.347 +                                 257 + (end - out) : 257 - (out - end));
 266.348 +    state->hold = hold;
 266.349 +    state->bits = bits;
 266.350 +    return;
 266.351 +}
 266.352 +
 266.353 +/*
 266.354 +   inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe):
 266.355 +   - Using bit fields for code structure
 266.356 +   - Different op definition to avoid & for extra bits (do & for table bits)
 266.357 +   - Three separate decoding do-loops for direct, window, and wnext == 0
 266.358 +   - Special case for distance > 1 copies to do overlapped load and store copy
 266.359 +   - Explicit branch predictions (based on measured branch probabilities)
 266.360 +   - Deferring match copy and interspersed it with decoding subsequent codes
 266.361 +   - Swapping literal/length else
 266.362 +   - Swapping window/direct else
 266.363 +   - Larger unrolled copy loops (three is about right)
 266.364 +   - Moving len -= 3 statement into middle of loop
 266.365 + */
 266.366 +
 266.367 +#endif /* !ASMINF */
   267.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   267.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/inffast.h	Mon Dec 19 10:06:23 2011 -0800
   267.3 @@ -0,0 +1,35 @@
   267.4 +/*
   267.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   267.6 + *
   267.7 + * This code is free software; you can redistribute it and/or modify it
   267.8 + * under the terms of the GNU General Public License version 2 only, as
   267.9 + * published by the Free Software Foundation.  Oracle designates this
  267.10 + * particular file as subject to the "Classpath" exception as provided
  267.11 + * by Oracle in the LICENSE file that accompanied this code.
  267.12 + *
  267.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
  267.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  267.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  267.16 + * version 2 for more details (a copy is included in the LICENSE file that
  267.17 + * accompanied this code).
  267.18 + *
  267.19 + * You should have received a copy of the GNU General Public License version
  267.20 + * 2 along with this work; if not, write to the Free Software Foundation,
  267.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  267.22 + *
  267.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  267.24 + * or visit www.oracle.com if you need additional information or have any
  267.25 + * questions.
  267.26 + */
  267.27 +
  267.28 +/* inffast.h -- header to use inffast.c
  267.29 + * Copyright (C) 1995-2003, 2010 Mark Adler
  267.30 + * For conditions of distribution and use, see copyright notice in zlib.h
  267.31 + */
  267.32 +
  267.33 +/* WARNING: this file should *not* be used by applications. It is
  267.34 +   part of the implementation of the compression library and is
  267.35 +   subject to change. Applications should only use zlib.h.
  267.36 + */
  267.37 +
  267.38 +void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));
   268.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   268.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/inffixed.h	Mon Dec 19 10:06:23 2011 -0800
   268.3 @@ -0,0 +1,118 @@
   268.4 +/*
   268.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   268.6 + *
   268.7 + * This code is free software; you can redistribute it and/or modify it
   268.8 + * under the terms of the GNU General Public License version 2 only, as
   268.9 + * published by the Free Software Foundation.  Oracle designates this
  268.10 + * particular file as subject to the "Classpath" exception as provided
  268.11 + * by Oracle in the LICENSE file that accompanied this code.
  268.12 + *
  268.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
  268.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  268.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  268.16 + * version 2 for more details (a copy is included in the LICENSE file that
  268.17 + * accompanied this code).
  268.18 + *
  268.19 + * You should have received a copy of the GNU General Public License version
  268.20 + * 2 along with this work; if not, write to the Free Software Foundation,
  268.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  268.22 + *
  268.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  268.24 + * or visit www.oracle.com if you need additional information or have any
  268.25 + * questions.
  268.26 + */
  268.27 +
  268.28 +    /* inffixed.h -- table for decoding fixed codes
  268.29 +     * Generated automatically by makefixed().
  268.30 +     */
  268.31 +
  268.32 +    /* WARNING: this file should *not* be used by applications. It
  268.33 +       is part of the implementation of the compression library and
  268.34 +       is subject to change. Applications should only use zlib.h.
  268.35 +     */
  268.36 +
  268.37 +    static const code lenfix[512] = {
  268.38 +        {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48},
  268.39 +        {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128},
  268.40 +        {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59},
  268.41 +        {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176},
  268.42 +        {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20},
  268.43 +        {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100},
  268.44 +        {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8},
  268.45 +        {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216},
  268.46 +        {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76},
  268.47 +        {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114},
  268.48 +        {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},
  268.49 +        {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148},
  268.50 +        {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42},
  268.51 +        {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86},
  268.52 +        {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15},
  268.53 +        {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236},
  268.54 +        {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62},
  268.55 +        {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},
  268.56 +        {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31},
  268.57 +        {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162},
  268.58 +        {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25},
  268.59 +        {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105},
  268.60 +        {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4},
  268.61 +        {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202},
  268.62 +        {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69},
  268.63 +        {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125},
  268.64 +        {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13},
  268.65 +        {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195},
  268.66 +        {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35},
  268.67 +        {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91},
  268.68 +        {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19},
  268.69 +        {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246},
  268.70 +        {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55},
  268.71 +        {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135},
  268.72 +        {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99},
  268.73 +        {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190},
  268.74 +        {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16},
  268.75 +        {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96},
  268.76 +        {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6},
  268.77 +        {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209},
  268.78 +        {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},
  268.79 +        {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116},
  268.80 +        {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4},
  268.81 +        {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153},
  268.82 +        {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44},
  268.83 +        {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82},
  268.84 +        {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11},
  268.85 +        {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},
  268.86 +        {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58},
  268.87 +        {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138},
  268.88 +        {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51},
  268.89 +        {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173},
  268.90 +        {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30},
  268.91 +        {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110},
  268.92 +        {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0},
  268.93 +        {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195},
  268.94 +        {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65},
  268.95 +        {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121},
  268.96 +        {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},
  268.97 +        {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258},
  268.98 +        {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37},
  268.99 +        {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93},
 268.100 +        {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23},
 268.101 +        {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251},
 268.102 +        {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51},
 268.103 +        {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},
 268.104 +        {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67},
 268.105 +        {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183},
 268.106 +        {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23},
 268.107 +        {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103},
 268.108 +        {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9},
 268.109 +        {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223},
 268.110 +        {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79},
 268.111 +        {0,9,255}
 268.112 +    };
 268.113 +
 268.114 +    static const code distfix[32] = {
 268.115 +        {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025},
 268.116 +        {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193},
 268.117 +        {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385},
 268.118 +        {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577},
 268.119 +        {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073},
 268.120 +        {22,5,193},{64,5,0}
 268.121 +    };
   269.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   269.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/inflate.c	Mon Dec 19 10:06:23 2011 -0800
   269.3 @@ -0,0 +1,1504 @@
   269.4 +/*
   269.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   269.6 + *
   269.7 + * This code is free software; you can redistribute it and/or modify it
   269.8 + * under the terms of the GNU General Public License version 2 only, as
   269.9 + * published by the Free Software Foundation.  Oracle designates this
  269.10 + * particular file as subject to the "Classpath" exception as provided
  269.11 + * by Oracle in the LICENSE file that accompanied this code.
  269.12 + *
  269.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
  269.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  269.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  269.16 + * version 2 for more details (a copy is included in the LICENSE file that
  269.17 + * accompanied this code).
  269.18 + *
  269.19 + * You should have received a copy of the GNU General Public License version
  269.20 + * 2 along with this work; if not, write to the Free Software Foundation,
  269.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  269.22 + *
  269.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  269.24 + * or visit www.oracle.com if you need additional information or have any
  269.25 + * questions.
  269.26 + */
  269.27 +
  269.28 +/* inflate.c -- zlib decompression
  269.29 + * Copyright (C) 1995-2010 Mark Adler
  269.30 + * For conditions of distribution and use, see copyright notice in zlib.h
  269.31 + */
  269.32 +
  269.33 +/*
  269.34 + * Change history:
  269.35 + *
  269.36 + * 1.2.beta0    24 Nov 2002
  269.37 + * - First version -- complete rewrite of inflate to simplify code, avoid
  269.38 + *   creation of window when not needed, minimize use of window when it is
  269.39 + *   needed, make inffast.c even faster, implement gzip decoding, and to
  269.40 + *   improve code readability and style over the previous zlib inflate code
  269.41 + *
  269.42 + * 1.2.beta1    25 Nov 2002
  269.43 + * - Use pointers for available input and output checking in inffast.c
  269.44 + * - Remove input and output counters in inffast.c
  269.45 + * - Change inffast.c entry and loop from avail_in >= 7 to >= 6
  269.46 + * - Remove unnecessary second byte pull from length extra in inffast.c
  269.47 + * - Unroll direct copy to three copies per loop in inffast.c
  269.48 + *
  269.49 + * 1.2.beta2    4 Dec 2002
  269.50 + * - Change external routine names to reduce potential conflicts
  269.51 + * - Correct filename to inffixed.h for fixed tables in inflate.c
  269.52 + * - Make hbuf[] unsigned char to match parameter type in inflate.c
  269.53 + * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset)
  269.54 + *   to avoid negation problem on Alphas (64 bit) in inflate.c
  269.55 + *
  269.56 + * 1.2.beta3    22 Dec 2002
  269.57 + * - Add comments on state->bits assertion in inffast.c
  269.58 + * - Add comments on op field in inftrees.h
  269.59 + * - Fix bug in reuse of allocated window after inflateReset()
  269.60 + * - Remove bit fields--back to byte structure for speed
  269.61 + * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths
  269.62 + * - Change post-increments to pre-increments in inflate_fast(), PPC biased?
  269.63 + * - Add compile time option, POSTINC, to use post-increments instead (Intel?)
  269.64 + * - Make MATCH copy in inflate() much faster for when inflate_fast() not used
  269.65 + * - Use local copies of stream next and avail values, as well as local bit
  269.66 + *   buffer and bit count in inflate()--for speed when inflate_fast() not used
  269.67 + *
  269.68 + * 1.2.beta4    1 Jan 2003
  269.69 + * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings
  269.70 + * - Move a comment on output buffer sizes from inffast.c to inflate.c
  269.71 + * - Add comments in inffast.c to introduce the inflate_fast() routine
  269.72 + * - Rearrange window copies in inflate_fast() for speed and simplification
  269.73 + * - Unroll last copy for window match in inflate_fast()
  269.74 + * - Use local copies of window variables in inflate_fast() for speed
  269.75 + * - Pull out common wnext == 0 case for speed in inflate_fast()
  269.76 + * - Make op and len in inflate_fast() unsigned for consistency
  269.77 + * - Add FAR to lcode and dcode declarations in inflate_fast()
  269.78 + * - Simplified bad distance check in inflate_fast()
  269.79 + * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new
  269.80 + *   source file infback.c to provide a call-back interface to inflate for
  269.81 + *   programs like gzip and unzip -- uses window as output buffer to avoid
  269.82 + *   window copying
  269.83 + *
  269.84 + * 1.2.beta5    1 Jan 2003
  269.85 + * - Improved inflateBack() interface to allow the caller to provide initial
  269.86 + *   input in strm.
  269.87 + * - Fixed stored blocks bug in inflateBack()
  269.88 + *
  269.89 + * 1.2.beta6    4 Jan 2003
  269.90 + * - Added comments in inffast.c on effectiveness of POSTINC
  269.91 + * - Typecasting all around to reduce compiler warnings
  269.92 + * - Changed loops from while (1) or do {} while (1) to for (;;), again to
  269.93 + *   make compilers happy
  269.94 + * - Changed type of window in inflateBackInit() to unsigned char *
  269.95 + *
  269.96 + * 1.2.beta7    27 Jan 2003
  269.97 + * - Changed many types to unsigned or unsigned short to avoid warnings
  269.98 + * - Added inflateCopy() function
  269.99 + *
 269.100 + * 1.2.0        9 Mar 2003
 269.101 + * - Changed inflateBack() interface to provide separate opaque descriptors
 269.102 + *   for the in() and out() functions
 269.103 + * - Changed inflateBack() argument and in_func typedef to swap the length
 269.104 + *   and buffer address return values for the input function
 269.105 + * - Check next_in and next_out for Z_NULL on entry to inflate()
 269.106 + *
 269.107 + * The history for versions after 1.2.0 are in ChangeLog in zlib distribution.
 269.108 + */
 269.109 +
 269.110 +#include "zutil.h"
 269.111 +#include "inftrees.h"
 269.112 +#include "inflate.h"
 269.113 +#include "inffast.h"
 269.114 +
 269.115 +#ifdef MAKEFIXED
 269.116 +#  ifndef BUILDFIXED
 269.117 +#    define BUILDFIXED
 269.118 +#  endif
 269.119 +#endif
 269.120 +
 269.121 +/* function prototypes */
 269.122 +local void fixedtables OF((struct inflate_state FAR *state));
 269.123 +local int updatewindow OF((z_streamp strm, unsigned out));
 269.124 +#ifdef BUILDFIXED
 269.125 +   void makefixed OF((void));
 269.126 +#endif
 269.127 +local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf,
 269.128 +                              unsigned len));
 269.129 +
 269.130 +int ZEXPORT inflateReset(strm)
 269.131 +z_streamp strm;
 269.132 +{
 269.133 +    struct inflate_state FAR *state;
 269.134 +
 269.135 +    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
 269.136 +    state = (struct inflate_state FAR *)strm->state;
 269.137 +    strm->total_in = strm->total_out = state->total = 0;
 269.138 +    strm->msg = Z_NULL;
 269.139 +    strm->adler = 1;        /* to support ill-conceived Java test suite */
 269.140 +    state->mode = HEAD;
 269.141 +    state->last = 0;
 269.142 +    state->havedict = 0;
 269.143 +    state->dmax = 32768U;
 269.144 +    state->head = Z_NULL;
 269.145 +    state->wsize = 0;
 269.146 +    state->whave = 0;
 269.147 +    state->wnext = 0;
 269.148 +    state->hold = 0;
 269.149 +    state->bits = 0;
 269.150 +    state->lencode = state->distcode = state->next = state->codes;
 269.151 +    state->sane = 1;
 269.152 +    state->back = -1;
 269.153 +    Tracev((stderr, "inflate: reset\n"));
 269.154 +    return Z_OK;
 269.155 +}
 269.156 +
 269.157 +int ZEXPORT inflateReset2(strm, windowBits)
 269.158 +z_streamp strm;
 269.159 +int windowBits;
 269.160 +{
 269.161 +    int wrap;
 269.162 +    struct inflate_state FAR *state;
 269.163 +
 269.164 +    /* get the state */
 269.165 +    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
 269.166 +    state = (struct inflate_state FAR *)strm->state;
 269.167 +
 269.168 +    /* extract wrap request from windowBits parameter */
 269.169 +    if (windowBits < 0) {
 269.170 +        wrap = 0;
 269.171 +        windowBits = -windowBits;
 269.172 +    }
 269.173 +    else {
 269.174 +        wrap = (windowBits >> 4) + 1;
 269.175 +#ifdef GUNZIP
 269.176 +        if (windowBits < 48)
 269.177 +            windowBits &= 15;
 269.178 +#endif
 269.179 +    }
 269.180 +
 269.181 +    /* set number of window bits, free window if different */
 269.182 +    if (windowBits && (windowBits < 8 || windowBits > 15))
 269.183 +        return Z_STREAM_ERROR;
 269.184 +    if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
 269.185 +        ZFREE(strm, state->window);
 269.186 +        state->window = Z_NULL;
 269.187 +    }
 269.188 +
 269.189 +    /* update state and reset the rest of it */
 269.190 +    state->wrap = wrap;
 269.191 +    state->wbits = (unsigned)windowBits;
 269.192 +    return inflateReset(strm);
 269.193 +}
 269.194 +
 269.195 +int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size)
 269.196 +z_streamp strm;
 269.197 +int windowBits;
 269.198 +const char *version;
 269.199 +int stream_size;
 269.200 +{
 269.201 +    int ret;
 269.202 +    struct inflate_state FAR *state;
 269.203 +
 269.204 +    if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
 269.205 +        stream_size != (int)(sizeof(z_stream)))
 269.206 +        return Z_VERSION_ERROR;
 269.207 +    if (strm == Z_NULL) return Z_STREAM_ERROR;
 269.208 +    strm->msg = Z_NULL;                 /* in case we return an error */
 269.209 +    if (strm->zalloc == (alloc_func)0) {
 269.210 +        strm->zalloc = zcalloc;
 269.211 +        strm->opaque = (voidpf)0;
 269.212 +    }
 269.213 +    if (strm->zfree == (free_func)0) strm->zfree = zcfree;
 269.214 +    state = (struct inflate_state FAR *)
 269.215 +            ZALLOC(strm, 1, sizeof(struct inflate_state));
 269.216 +    if (state == Z_NULL) return Z_MEM_ERROR;
 269.217 +    Tracev((stderr, "inflate: allocated\n"));
 269.218 +    strm->state = (struct internal_state FAR *)state;
 269.219 +    state->window = Z_NULL;
 269.220 +    ret = inflateReset2(strm, windowBits);
 269.221 +    if (ret != Z_OK) {
 269.222 +        ZFREE(strm, state);
 269.223 +        strm->state = Z_NULL;
 269.224 +    }
 269.225 +    return ret;
 269.226 +}
 269.227 +
 269.228 +int ZEXPORT inflateInit_(strm, version, stream_size)
 269.229 +z_streamp strm;
 269.230 +const char *version;
 269.231 +int stream_size;
 269.232 +{
 269.233 +    return inflateInit2_(strm, DEF_WBITS, version, stream_size);
 269.234 +}
 269.235 +
 269.236 +int ZEXPORT inflatePrime(strm, bits, value)
 269.237 +z_streamp strm;
 269.238 +int bits;
 269.239 +int value;
 269.240 +{
 269.241 +    struct inflate_state FAR *state;
 269.242 +
 269.243 +    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
 269.244 +    state = (struct inflate_state FAR *)strm->state;
 269.245 +    if (bits < 0) {
 269.246 +        state->hold = 0;
 269.247 +        state->bits = 0;
 269.248 +        return Z_OK;
 269.249 +    }
 269.250 +    if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR;
 269.251 +    value &= (1L << bits) - 1;
 269.252 +    state->hold += value << state->bits;
 269.253 +    state->bits += bits;
 269.254 +    return Z_OK;
 269.255 +}
 269.256 +
 269.257 +/*
 269.258 +   Return state with length and distance decoding tables and index sizes set to
 269.259 +   fixed code decoding.  Normally this returns fixed tables from inffixed.h.
 269.260 +   If BUILDFIXED is defined, then instead this routine builds the tables the
 269.261 +   first time it's called, and returns those tables the first time and
 269.262 +   thereafter.  This reduces the size of the code by about 2K bytes, in
 269.263 +   exchange for a little execution time.  However, BUILDFIXED should not be
 269.264 +   used for threaded applications, since the rewriting of the tables and virgin
 269.265 +   may not be thread-safe.
 269.266 + */
 269.267 +local void fixedtables(state)
 269.268 +struct inflate_state FAR *state;
 269.269 +{
 269.270 +#ifdef BUILDFIXED
 269.271 +    static int virgin = 1;
 269.272 +    static code *lenfix, *distfix;
 269.273 +    static code fixed[544];
 269.274 +
 269.275 +    /* build fixed huffman tables if first call (may not be thread safe) */
 269.276 +    if (virgin) {
 269.277 +        unsigned sym, bits;
 269.278 +        static code *next;
 269.279 +
 269.280 +        /* literal/length table */
 269.281 +        sym = 0;
 269.282 +        while (sym < 144) state->lens[sym++] = 8;
 269.283 +        while (sym < 256) state->lens[sym++] = 9;
 269.284 +        while (sym < 280) state->lens[sym++] = 7;
 269.285 +        while (sym < 288) state->lens[sym++] = 8;
 269.286 +        next = fixed;
 269.287 +        lenfix = next;
 269.288 +        bits = 9;
 269.289 +        inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
 269.290 +
 269.291 +        /* distance table */
 269.292 +        sym = 0;
 269.293 +        while (sym < 32) state->lens[sym++] = 5;
 269.294 +        distfix = next;
 269.295 +        bits = 5;
 269.296 +        inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
 269.297 +
 269.298 +        /* do this just once */
 269.299 +        virgin = 0;
 269.300 +    }
 269.301 +#else /* !BUILDFIXED */
 269.302 +#   include "inffixed.h"
 269.303 +#endif /* BUILDFIXED */
 269.304 +    state->lencode = lenfix;
 269.305 +    state->lenbits = 9;
 269.306 +    state->distcode = distfix;
 269.307 +    state->distbits = 5;
 269.308 +}
 269.309 +
 269.310 +#ifdef MAKEFIXED
 269.311 +#include <stdio.h>
 269.312 +
 269.313 +/*
 269.314 +   Write out the inffixed.h that is #include'd above.  Defining MAKEFIXED also
 269.315 +   defines BUILDFIXED, so the tables are built on the fly.  makefixed() writes
 269.316 +   those tables to stdout, which would be piped to inffixed.h.  A small program
 269.317 +   can simply call makefixed to do this:
 269.318 +
 269.319 +    void makefixed(void);
 269.320 +
 269.321 +    int main(void)
 269.322 +    {
 269.323 +        makefixed();
 269.324 +        return 0;
 269.325 +    }
 269.326 +
 269.327 +   Then that can be linked with zlib built with MAKEFIXED defined and run:
 269.328 +
 269.329 +    a.out > inffixed.h
 269.330 + */
 269.331 +void makefixed()
 269.332 +{
 269.333 +    unsigned low, size;
 269.334 +    struct inflate_state state;
 269.335 +
 269.336 +    fixedtables(&state);
 269.337 +    puts("    /* inffixed.h -- table for decoding fixed codes");
 269.338 +    puts("     * Generated automatically by makefixed().");
 269.339 +    puts("     */");
 269.340 +    puts("");
 269.341 +    puts("    /* WARNING: this file should *not* be used by applications.");
 269.342 +    puts("       It is part of the implementation of this library and is");
 269.343 +    puts("       subject to change. Applications should only use zlib.h.");
 269.344 +    puts("     */");
 269.345 +    puts("");
 269.346 +    size = 1U << 9;
 269.347 +    printf("    static const code lenfix[%u] = {", size);
 269.348 +    low = 0;
 269.349 +    for (;;) {
 269.350 +        if ((low % 7) == 0) printf("\n        ");
 269.351 +        printf("{%u,%u,%d}", state.lencode[low].op, state.lencode[low].bits,
 269.352 +               state.lencode[low].val);
 269.353 +        if (++low == size) break;
 269.354 +        putchar(',');
 269.355 +    }
 269.356 +    puts("\n    };");
 269.357 +    size = 1U << 5;
 269.358 +    printf("\n    static const code distfix[%u] = {", size);
 269.359 +    low = 0;
 269.360 +    for (;;) {
 269.361 +        if ((low % 6) == 0) printf("\n        ");
 269.362 +        printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits,
 269.363 +               state.distcode[low].val);
 269.364 +        if (++low == size) break;
 269.365 +        putchar(',');
 269.366 +    }
 269.367 +    puts("\n    };");
 269.368 +}
 269.369 +#endif /* MAKEFIXED */
 269.370 +
 269.371 +/*
 269.372 +   Update the window with the last wsize (normally 32K) bytes written before
 269.373 +   returning.  If window does not exist yet, create it.  This is only called
 269.374 +   when a window is already in use, or when output has been written during this
 269.375 +   inflate call, but the end of the deflate stream has not been reached yet.
 269.376 +   It is also called to create a window for dictionary data when a dictionary
 269.377 +   is loaded.
 269.378 +
 269.379 +   Providing output buffers larger than 32K to inflate() should provide a speed
 269.380 +   advantage, since only the last 32K of output is copied to the sliding window
 269.381 +   upon return from inflate(), and since all distances after the first 32K of
 269.382 +   output will fall in the output data, making match copies simpler and faster.
 269.383 +   The advantage may be dependent on the size of the processor's data caches.
 269.384 + */
 269.385 +local int updatewindow(strm, out)
 269.386 +z_streamp strm;
 269.387 +unsigned out;
 269.388 +{
 269.389 +    struct inflate_state FAR *state;
 269.390 +    unsigned copy, dist;
 269.391 +
 269.392 +    state = (struct inflate_state FAR *)strm->state;
 269.393 +
 269.394 +    /* if it hasn't been done already, allocate space for the window */
 269.395 +    if (state->window == Z_NULL) {
 269.396 +        state->window = (unsigned char FAR *)
 269.397 +                        ZALLOC(strm, 1U << state->wbits,
 269.398 +                               sizeof(unsigned char));
 269.399 +        if (state->window == Z_NULL) return 1;
 269.400 +    }
 269.401 +
 269.402 +    /* if window not in use yet, initialize */
 269.403 +    if (state->wsize == 0) {
 269.404 +        state->wsize = 1U << state->wbits;
 269.405 +        state->wnext = 0;
 269.406 +        state->whave = 0;
 269.407 +    }
 269.408 +
 269.409 +    /* copy state->wsize or less output bytes into the circular window */
 269.410 +    copy = out - strm->avail_out;
 269.411 +    if (copy >= state->wsize) {
 269.412 +        zmemcpy(state->window, strm->next_out - state->wsize, state->wsize);
 269.413 +        state->wnext = 0;
 269.414 +        state->whave = state->wsize;
 269.415 +    }
 269.416 +    else {
 269.417 +        dist = state->wsize - state->wnext;
 269.418 +        if (dist > copy) dist = copy;
 269.419 +        zmemcpy(state->window + state->wnext, strm->next_out - copy, dist);
 269.420 +        copy -= dist;
 269.421 +        if (copy) {
 269.422 +            zmemcpy(state->window, strm->next_out - copy, copy);
 269.423 +            state->wnext = copy;
 269.424 +            state->whave = state->wsize;
 269.425 +        }
 269.426 +        else {
 269.427 +            state->wnext += dist;
 269.428 +            if (state->wnext == state->wsize) state->wnext = 0;
 269.429 +            if (state->whave < state->wsize) state->whave += dist;
 269.430 +        }
 269.431 +    }
 269.432 +    return 0;
 269.433 +}
 269.434 +
 269.435 +/* Macros for inflate(): */
 269.436 +
 269.437 +/* check function to use adler32() for zlib or crc32() for gzip */
 269.438 +#ifdef GUNZIP
 269.439 +#  define UPDATE(check, buf, len) \
 269.440 +    (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
 269.441 +#else
 269.442 +#  define UPDATE(check, buf, len) adler32(check, buf, len)
 269.443 +#endif
 269.444 +
 269.445 +/* check macros for header crc */
 269.446 +#ifdef GUNZIP
 269.447 +#  define CRC2(check, word) \
 269.448 +    do { \
 269.449 +        hbuf[0] = (unsigned char)(word); \
 269.450 +        hbuf[1] = (unsigned char)((word) >> 8); \
 269.451 +        check = crc32(check, hbuf, 2); \
 269.452 +    } while (0)
 269.453 +
 269.454 +#  define CRC4(check, word) \
 269.455 +    do { \
 269.456 +        hbuf[0] = (unsigned char)(word); \
 269.457 +        hbuf[1] = (unsigned char)((word) >> 8); \
 269.458 +        hbuf[2] = (unsigned char)((word) >> 16); \
 269.459 +        hbuf[3] = (unsigned char)((word) >> 24); \
 269.460 +        check = crc32(check, hbuf, 4); \
 269.461 +    } while (0)
 269.462 +#endif
 269.463 +
 269.464 +/* Load registers with state in inflate() for speed */
 269.465 +#define LOAD() \
 269.466 +    do { \
 269.467 +        put = strm->next_out; \
 269.468 +        left = strm->avail_out; \
 269.469 +        next = strm->next_in; \
 269.470 +        have = strm->avail_in; \
 269.471 +        hold = state->hold; \
 269.472 +        bits = state->bits; \
 269.473 +    } while (0)
 269.474 +
 269.475 +/* Restore state from registers in inflate() */
 269.476 +#define RESTORE() \
 269.477 +    do { \
 269.478 +        strm->next_out = put; \
 269.479 +        strm->avail_out = left; \
 269.480 +        strm->next_in = next; \
 269.481 +        strm->avail_in = have; \
 269.482 +        state->hold = hold; \
 269.483 +        state->bits = bits; \
 269.484 +    } while (0)
 269.485 +
 269.486 +/* Clear the input bit accumulator */
 269.487 +#define INITBITS() \
 269.488 +    do { \
 269.489 +        hold = 0; \
 269.490 +        bits = 0; \
 269.491 +    } while (0)
 269.492 +
 269.493 +/* Get a byte of input into the bit accumulator, or return from inflate()
 269.494 +   if there is no input available. */
 269.495 +#define PULLBYTE() \
 269.496 +    do { \
 269.497 +        if (have == 0) goto inf_leave; \
 269.498 +        have--; \
 269.499 +        hold += (unsigned long)(*next++) << bits; \
 269.500 +        bits += 8; \
 269.501 +    } while (0)
 269.502 +
 269.503 +/* Assure that there are at least n bits in the bit accumulator.  If there is
 269.504 +   not enough available input to do that, then return from inflate(). */
 269.505 +#define NEEDBITS(n) \
 269.506 +    do { \
 269.507 +        while (bits < (unsigned)(n)) \
 269.508 +            PULLBYTE(); \
 269.509 +    } while (0)
 269.510 +
 269.511 +/* Return the low n bits of the bit accumulator (n < 16) */
 269.512 +#define BITS(n) \
 269.513 +    ((unsigned)hold & ((1U << (n)) - 1))
 269.514 +
 269.515 +/* Remove n bits from the bit accumulator */
 269.516 +#define DROPBITS(n) \
 269.517 +    do { \
 269.518 +        hold >>= (n); \
 269.519 +        bits -= (unsigned)(n); \
 269.520 +    } while (0)
 269.521 +
 269.522 +/* Remove zero to seven bits as needed to go to a byte boundary */
 269.523 +#define BYTEBITS() \
 269.524 +    do { \
 269.525 +        hold >>= bits & 7; \
 269.526 +        bits -= bits & 7; \
 269.527 +    } while (0)
 269.528 +
 269.529 +/* Reverse the bytes in a 32-bit value */
 269.530 +#define REVERSE(q) \
 269.531 +    ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
 269.532 +     (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
 269.533 +
 269.534 +/*
 269.535 +   inflate() uses a state machine to process as much input data and generate as
 269.536 +   much output data as possible before returning.  The state machine is
 269.537 +   structured roughly as follows:
 269.538 +
 269.539 +    for (;;) switch (state) {
 269.540 +    ...
 269.541 +    case STATEn:
 269.542 +        if (not enough input data or output space to make progress)
 269.543 +            return;
 269.544 +        ... make progress ...
 269.545 +        state = STATEm;
 269.546 +        break;
 269.547 +    ...
 269.548 +    }
 269.549 +
 269.550 +   so when inflate() is called again, the same case is attempted again, and
 269.551 +   if the appropriate resources are provided, the machine proceeds to the
 269.552 +   next state.  The NEEDBITS() macro is usually the way the state evaluates
 269.553 +   whether it can proceed or should return.  NEEDBITS() does the return if
 269.554 +   the requested bits are not available.  The typical use of the BITS macros
 269.555 +   is:
 269.556 +
 269.557 +        NEEDBITS(n);
 269.558 +        ... do something with BITS(n) ...
 269.559 +        DROPBITS(n);
 269.560 +
 269.561 +   where NEEDBITS(n) either returns from inflate() if there isn't enough
 269.562 +   input left to load n bits into the accumulator, or it continues.  BITS(n)
 269.563 +   gives the low n bits in the accumulator.  When done, DROPBITS(n) drops
 269.564 +   the low n bits off the accumulator.  INITBITS() clears the accumulator
 269.565 +   and sets the number of available bits to zero.  BYTEBITS() discards just
 269.566 +   enough bits to put the accumulator on a byte boundary.  After BYTEBITS()
 269.567 +   and a NEEDBITS(8), then BITS(8) would return the next byte in the stream.
 269.568 +
 269.569 +   NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return
 269.570 +   if there is no input available.  The decoding of variable length codes uses
 269.571 +   PULLBYTE() directly in order to pull just enough bytes to decode the next
 269.572 +   code, and no more.
 269.573 +
 269.574 +   Some states loop until they get enough input, making sure that enough
 269.575 +   state information is maintained to continue the loop where it left off
 269.576 +   if NEEDBITS() returns in the loop.  For example, want, need, and keep
 269.577 +   would all have to actually be part of the saved state in case NEEDBITS()
 269.578 +   returns:
 269.579 +
 269.580 +    case STATEw:
 269.581 +        while (want < need) {
 269.582 +            NEEDBITS(n);
 269.583 +            keep[want++] = BITS(n);
 269.584 +            DROPBITS(n);
 269.585 +        }
 269.586 +        state = STATEx;
 269.587 +    case STATEx:
 269.588 +
 269.589 +   As shown above, if the next state is also the next case, then the break
 269.590 +   is omitted.
 269.591 +
 269.592 +   A state may also return if there is not enough output space available to
 269.593 +   complete that state.  Those states are copying stored data, writing a
 269.594 +   literal byte, and copying a matching string.
 269.595 +
 269.596 +   When returning, a "goto inf_leave" is used to update the total counters,
 269.597 +   update the check value, and determine whether any progress has been made
 269.598 +   during that inflate() call in order to return the proper return code.
 269.599 +   Progress is defined as a change in either strm->avail_in or strm->avail_out.
 269.600 +   When there is a window, goto inf_leave will update the window with the last
 269.601 +   output written.  If a goto inf_leave occurs in the middle of decompression
 269.602 +   and there is no window currently, goto inf_leave will create one and copy
 269.603 +   output to the window for the next call of inflate().
 269.604 +
 269.605 +   In this implementation, the flush parameter of inflate() only affects the
 269.606 +   return code (per zlib.h).  inflate() always writes as much as possible to
 269.607 +   strm->next_out, given the space available and the provided input--the effect
 269.608 +   documented in zlib.h of Z_SYNC_FLUSH.  Furthermore, inflate() always defers
 269.609 +   the allocation of and copying into a sliding window until necessary, which
 269.610 +   provides the effect documented in zlib.h for Z_FINISH when the entire input
 269.611 +   stream available.  So the only thing the flush parameter actually does is:
 269.612 +   when flush is set to Z_FINISH, inflate() cannot return Z_OK.  Instead it
 269.613 +   will return Z_BUF_ERROR if it has not reached the end of the stream.
 269.614 + */
 269.615 +
 269.616 +int ZEXPORT inflate(strm, flush)
 269.617 +z_streamp strm;
 269.618 +int flush;
 269.619 +{
 269.620 +    struct inflate_state FAR *state;
 269.621 +    unsigned char FAR *next;    /* next input */
 269.622 +    unsigned char FAR *put;     /* next output */
 269.623 +    unsigned have, left;        /* available input and output */
 269.624 +    unsigned long hold;         /* bit buffer */
 269.625 +    unsigned bits;              /* bits in bit buffer */
 269.626 +    unsigned in, out;           /* save starting available input and output */
 269.627 +    unsigned copy;              /* number of stored or match bytes to copy */
 269.628 +    unsigned char FAR *from;    /* where to copy match bytes from */
 269.629 +    code here;                  /* current decoding table entry */
 269.630 +    code last;                  /* parent table entry */
 269.631 +    unsigned len;               /* length to copy for repeats, bits to drop */
 269.632 +    int ret;                    /* return code */
 269.633 +#ifdef GUNZIP
 269.634 +    unsigned char hbuf[4];      /* buffer for gzip header crc calculation */
 269.635 +#endif
 269.636 +    static const unsigned short order[19] = /* permutation of code lengths */
 269.637 +        {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
 269.638 +
 269.639 +    if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL ||
 269.640 +        (strm->next_in == Z_NULL && strm->avail_in != 0))
 269.641 +        return Z_STREAM_ERROR;
 269.642 +
 269.643 +    state = (struct inflate_state FAR *)strm->state;
 269.644 +    if (state->mode == TYPE) state->mode = TYPEDO;      /* skip check */
 269.645 +    LOAD();
 269.646 +    in = have;
 269.647 +    out = left;
 269.648 +    ret = Z_OK;
 269.649 +    for (;;)
 269.650 +        switch (state->mode) {
 269.651 +        case HEAD:
 269.652 +            if (state->wrap == 0) {
 269.653 +                state->mode = TYPEDO;
 269.654 +                break;
 269.655 +            }
 269.656 +            NEEDBITS(16);
 269.657 +#ifdef GUNZIP
 269.658 +            if ((state->wrap & 2) && hold == 0x8b1f) {  /* gzip header */
 269.659 +                state->check = crc32(0L, Z_NULL, 0);
 269.660 +                CRC2(state->check, hold);
 269.661 +                INITBITS();
 269.662 +                state->mode = FLAGS;
 269.663 +                break;
 269.664 +            }
 269.665 +            state->flags = 0;           /* expect zlib header */
 269.666 +            if (state->head != Z_NULL)
 269.667 +                state->head->done = -1;
 269.668 +            if (!(state->wrap & 1) ||   /* check if zlib header allowed */
 269.669 +#else
 269.670 +            if (
 269.671 +#endif
 269.672 +                ((BITS(8) << 8) + (hold >> 8)) % 31) {
 269.673 +                strm->msg = (char *)"incorrect header check";
 269.674 +                state->mode = BAD;
 269.675 +                break;
 269.676 +            }
 269.677 +            if (BITS(4) != Z_DEFLATED) {
 269.678 +                strm->msg = (char *)"unknown compression method";
 269.679 +                state->mode = BAD;
 269.680 +                break;
 269.681 +            }
 269.682 +            DROPBITS(4);
 269.683 +            len = BITS(4) + 8;
 269.684 +            if (state->wbits == 0)
 269.685 +                state->wbits = len;
 269.686 +            else if (len > state->wbits) {
 269.687 +                strm->msg = (char *)"invalid window size";
 269.688 +                state->mode = BAD;
 269.689 +                break;
 269.690 +            }
 269.691 +            state->dmax = 1U << len;
 269.692 +            Tracev((stderr, "inflate:   zlib header ok\n"));
 269.693 +            strm->adler = state->check = adler32(0L, Z_NULL, 0);
 269.694 +            state->mode = hold & 0x200 ? DICTID : TYPE;
 269.695 +            INITBITS();
 269.696 +            break;
 269.697 +#ifdef GUNZIP
 269.698 +        case FLAGS:
 269.699 +            NEEDBITS(16);
 269.700 +            state->flags = (int)(hold);
 269.701 +            if ((state->flags & 0xff) != Z_DEFLATED) {
 269.702 +                strm->msg = (char *)"unknown compression method";
 269.703 +                state->mode = BAD;
 269.704 +                break;
 269.705 +            }
 269.706 +            if (state->flags & 0xe000) {
 269.707 +                strm->msg = (char *)"unknown header flags set";
 269.708 +                state->mode = BAD;
 269.709 +                break;
 269.710 +            }
 269.711 +            if (state->head != Z_NULL)
 269.712 +                state->head->text = (int)((hold >> 8) & 1);
 269.713 +            if (state->flags & 0x0200) CRC2(state->check, hold);
 269.714 +            INITBITS();
 269.715 +            state->mode = TIME;
 269.716 +        case TIME:
 269.717 +            NEEDBITS(32);
 269.718 +            if (state->head != Z_NULL)
 269.719 +                state->head->time = hold;
 269.720 +            if (state->flags & 0x0200) CRC4(state->check, hold);
 269.721 +            INITBITS();
 269.722 +            state->mode = OS;
 269.723 +        case OS:
 269.724 +            NEEDBITS(16);
 269.725 +            if (state->head != Z_NULL) {
 269.726 +                state->head->xflags = (int)(hold & 0xff);
 269.727 +                state->head->os = (int)(hold >> 8);
 269.728 +            }
 269.729 +            if (state->flags & 0x0200) CRC2(state->check, hold);
 269.730 +            INITBITS();
 269.731 +            state->mode = EXLEN;
 269.732 +        case EXLEN:
 269.733 +            if (state->flags & 0x0400) {
 269.734 +                NEEDBITS(16);
 269.735 +                state->length = (unsigned)(hold);
 269.736 +                if (state->head != Z_NULL)
 269.737 +                    state->head->extra_len = (unsigned)hold;
 269.738 +                if (state->flags & 0x0200) CRC2(state->check, hold);
 269.739 +                INITBITS();
 269.740 +            }
 269.741 +            else if (state->head != Z_NULL)
 269.742 +                state->head->extra = Z_NULL;
 269.743 +            state->mode = EXTRA;
 269.744 +        case EXTRA:
 269.745 +            if (state->flags & 0x0400) {
 269.746 +                copy = state->length;
 269.747 +                if (copy > have) copy = have;
 269.748 +                if (copy) {
 269.749 +                    if (state->head != Z_NULL &&
 269.750 +                        state->head->extra != Z_NULL) {
 269.751 +                        len = state->head->extra_len - state->length;
 269.752 +                        zmemcpy(state->head->extra + len, next,
 269.753 +                                len + copy > state->head->extra_max ?
 269.754 +                                state->head->extra_max - len : copy);
 269.755 +                    }
 269.756 +                    if (state->flags & 0x0200)
 269.757 +                        state->check = crc32(state->check, next, copy);
 269.758 +                    have -= copy;
 269.759 +                    next += copy;
 269.760 +                    state->length -= copy;
 269.761 +                }
 269.762 +                if (state->length) goto inf_leave;
 269.763 +            }
 269.764 +            state->length = 0;
 269.765 +            state->mode = NAME;
 269.766 +        case NAME:
 269.767 +            if (state->flags & 0x0800) {
 269.768 +                if (have == 0) goto inf_leave;
 269.769 +                copy = 0;
 269.770 +                do {
 269.771 +                    len = (unsigned)(next[copy++]);
 269.772 +                    if (state->head != Z_NULL &&
 269.773 +                            state->head->name != Z_NULL &&
 269.774 +                            state->length < state->head->name_max)
 269.775 +                        state->head->name[state->length++] = len;
 269.776 +                } while (len && copy < have);
 269.777 +                if (state->flags & 0x0200)
 269.778 +                    state->check = crc32(state->check, next, copy);
 269.779 +                have -= copy;
 269.780 +                next += copy;
 269.781 +                if (len) goto inf_leave;
 269.782 +            }
 269.783 +            else if (state->head != Z_NULL)
 269.784 +                state->head->name = Z_NULL;
 269.785 +            state->length = 0;
 269.786 +            state->mode = COMMENT;
 269.787 +        case COMMENT:
 269.788 +            if (state->flags & 0x1000) {
 269.789 +                if (have == 0) goto inf_leave;
 269.790 +                copy = 0;
 269.791 +                do {
 269.792 +                    len = (unsigned)(next[copy++]);
 269.793 +                    if (state->head != Z_NULL &&
 269.794 +                            state->head->comment != Z_NULL &&
 269.795 +                            state->length < state->head->comm_max)
 269.796 +                        state->head->comment[state->length++] = len;
 269.797 +                } while (len && copy < have);
 269.798 +                if (state->flags & 0x0200)
 269.799 +                    state->check = crc32(state->check, next, copy);
 269.800 +                have -= copy;
 269.801 +                next += copy;
 269.802 +                if (len) goto inf_leave;
 269.803 +            }
 269.804 +            else if (state->head != Z_NULL)
 269.805 +                state->head->comment = Z_NULL;
 269.806 +            state->mode = HCRC;
 269.807 +        case HCRC:
 269.808 +            if (state->flags & 0x0200) {
 269.809 +                NEEDBITS(16);
 269.810 +                if (hold != (state->check & 0xffff)) {
 269.811 +                    strm->msg = (char *)"header crc mismatch";
 269.812 +                    state->mode = BAD;
 269.813 +                    break;
 269.814 +                }
 269.815 +                INITBITS();
 269.816 +            }
 269.817 +            if (state->head != Z_NULL) {
 269.818 +                state->head->hcrc = (int)((state->flags >> 9) & 1);
 269.819 +                state->head->done = 1;
 269.820 +            }
 269.821 +            strm->adler = state->check = crc32(0L, Z_NULL, 0);
 269.822 +            state->mode = TYPE;
 269.823 +            break;
 269.824 +#endif
 269.825 +        case DICTID:
 269.826 +            NEEDBITS(32);
 269.827 +            strm->adler = state->check = REVERSE(hold);
 269.828 +            INITBITS();
 269.829 +            state->mode = DICT;
 269.830 +        case DICT:
 269.831 +            if (state->havedict == 0) {
 269.832 +                RESTORE();
 269.833 +                return Z_NEED_DICT;
 269.834 +            }
 269.835 +            strm->adler = state->check = adler32(0L, Z_NULL, 0);
 269.836 +            state->mode = TYPE;
 269.837 +        case TYPE:
 269.838 +            if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
 269.839 +        case TYPEDO:
 269.840 +            if (state->last) {
 269.841 +                BYTEBITS();
 269.842 +                state->mode = CHECK;
 269.843 +                break;
 269.844 +            }
 269.845 +            NEEDBITS(3);
 269.846 +            state->last = BITS(1);
 269.847 +            DROPBITS(1);
 269.848 +            switch (BITS(2)) {
 269.849 +            case 0:                             /* stored block */
 269.850 +                Tracev((stderr, "inflate:     stored block%s\n",
 269.851 +                        state->last ? " (last)" : ""));
 269.852 +                state->mode = STORED;
 269.853 +                break;
 269.854 +            case 1:                             /* fixed block */
 269.855 +                fixedtables(state);
 269.856 +                Tracev((stderr, "inflate:     fixed codes block%s\n",
 269.857 +                        state->last ? " (last)" : ""));
 269.858 +                state->mode = LEN_;             /* decode codes */
 269.859 +                if (flush == Z_TREES) {
 269.860 +                    DROPBITS(2);
 269.861 +                    goto inf_leave;
 269.862 +                }
 269.863 +                break;
 269.864 +            case 2:                             /* dynamic block */
 269.865 +                Tracev((stderr, "inflate:     dynamic codes block%s\n",
 269.866 +                        state->last ? " (last)" : ""));
 269.867 +                state->mode = TABLE;
 269.868 +                break;
 269.869 +            case 3:
 269.870 +                strm->msg = (char *)"invalid block type";
 269.871 +                state->mode = BAD;
 269.872 +            }
 269.873 +            DROPBITS(2);
 269.874 +            break;
 269.875 +        case STORED:
 269.876 +            BYTEBITS();                         /* go to byte boundary */
 269.877 +            NEEDBITS(32);
 269.878 +            if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
 269.879 +                strm->msg = (char *)"invalid stored block lengths";
 269.880 +                state->mode = BAD;
 269.881 +                break;
 269.882 +            }
 269.883 +            state->length = (unsigned)hold & 0xffff;
 269.884 +            Tracev((stderr, "inflate:       stored length %u\n",
 269.885 +                    state->length));
 269.886 +            INITBITS();
 269.887 +            state->mode = COPY_;
 269.888 +            if (flush == Z_TREES) goto inf_leave;
 269.889 +        case COPY_:
 269.890 +            state->mode = COPY;
 269.891 +        case COPY:
 269.892 +            copy = state->length;
 269.893 +            if (copy) {
 269.894 +                if (copy > have) copy = have;
 269.895 +                if (copy > left) copy = left;
 269.896 +                if (copy == 0) goto inf_leave;
 269.897 +                zmemcpy(put, next, copy);
 269.898 +                have -= copy;
 269.899 +                next += copy;
 269.900 +                left -= copy;
 269.901 +                put += copy;
 269.902 +                state->length -= copy;
 269.903 +                break;
 269.904 +            }
 269.905 +            Tracev((stderr, "inflate:       stored end\n"));
 269.906 +            state->mode = TYPE;
 269.907 +            break;
 269.908 +        case TABLE:
 269.909 +            NEEDBITS(14);
 269.910 +            state->nlen = BITS(5) + 257;
 269.911 +            DROPBITS(5);
 269.912 +            state->ndist = BITS(5) + 1;
 269.913 +            DROPBITS(5);
 269.914 +            state->ncode = BITS(4) + 4;
 269.915 +            DROPBITS(4);
 269.916 +#ifndef PKZIP_BUG_WORKAROUND
 269.917 +            if (state->nlen > 286 || state->ndist > 30) {
 269.918 +                strm->msg = (char *)"too many length or distance symbols";
 269.919 +                state->mode = BAD;
 269.920 +                break;
 269.921 +            }
 269.922 +#endif
 269.923 +            Tracev((stderr, "inflate:       table sizes ok\n"));
 269.924 +            state->have = 0;
 269.925 +            state->mode = LENLENS;
 269.926 +        case LENLENS:
 269.927 +            while (state->have < state->ncode) {
 269.928 +                NEEDBITS(3);
 269.929 +                state->lens[order[state->have++]] = (unsigned short)BITS(3);
 269.930 +                DROPBITS(3);
 269.931 +            }
 269.932 +            while (state->have < 19)
 269.933 +                state->lens[order[state->have++]] = 0;
 269.934 +            state->next = state->codes;
 269.935 +            state->lencode = (code const FAR *)(state->next);
 269.936 +            state->lenbits = 7;
 269.937 +            ret = inflate_table(CODES, state->lens, 19, &(state->next),
 269.938 +                                &(state->lenbits), state->work);
 269.939 +            if (ret) {
 269.940 +                strm->msg = (char *)"invalid code lengths set";
 269.941 +                state->mode = BAD;
 269.942 +                break;
 269.943 +            }
 269.944 +            Tracev((stderr, "inflate:       code lengths ok\n"));
 269.945 +            state->have = 0;
 269.946 +            state->mode = CODELENS;
 269.947 +        case CODELENS:
 269.948 +            while (state->have < state->nlen + state->ndist) {
 269.949 +                for (;;) {
 269.950 +                    here = state->lencode[BITS(state->lenbits)];
 269.951 +                    if ((unsigned)(here.bits) <= bits) break;
 269.952 +                    PULLBYTE();
 269.953 +                }
 269.954 +                if (here.val < 16) {
 269.955 +                    NEEDBITS(here.bits);
 269.956 +                    DROPBITS(here.bits);
 269.957 +                    state->lens[state->have++] = here.val;
 269.958 +                }
 269.959 +                else {
 269.960 +                    if (here.val == 16) {
 269.961 +                        NEEDBITS(here.bits + 2);
 269.962 +                        DROPBITS(here.bits);
 269.963 +                        if (state->have == 0) {
 269.964 +                            strm->msg = (char *)"invalid bit length repeat";
 269.965 +                            state->mode = BAD;
 269.966 +                            break;
 269.967 +                        }
 269.968 +                        len = state->lens[state->have - 1];
 269.969 +                        copy = 3 + BITS(2);
 269.970 +                        DROPBITS(2);
 269.971 +                    }
 269.972 +                    else if (here.val == 17) {
 269.973 +                        NEEDBITS(here.bits + 3);
 269.974 +                        DROPBITS(here.bits);
 269.975 +                        len = 0;
 269.976 +                        copy = 3 + BITS(3);
 269.977 +                        DROPBITS(3);
 269.978 +                    }
 269.979 +                    else {
 269.980 +                        NEEDBITS(here.bits + 7);
 269.981 +                        DROPBITS(here.bits);
 269.982 +                        len = 0;
 269.983 +                        copy = 11 + BITS(7);
 269.984 +                        DROPBITS(7);
 269.985 +                    }
 269.986 +                    if (state->have + copy > state->nlen + state->ndist) {
 269.987 +                        strm->msg = (char *)"invalid bit length repeat";
 269.988 +                        state->mode = BAD;
 269.989 +                        break;
 269.990 +                    }
 269.991 +                    while (copy--)
 269.992 +                        state->lens[state->have++] = (unsigned short)len;
 269.993 +                }
 269.994 +            }
 269.995 +
 269.996 +            /* handle error breaks in while */
 269.997 +            if (state->mode == BAD) break;
 269.998 +
 269.999 +            /* check for end-of-block code (better have one) */
269.1000 +            if (state->lens[256] == 0) {
269.1001 +                strm->msg = (char *)"invalid code -- missing end-of-block";
269.1002 +                state->mode = BAD;
269.1003 +                break;
269.1004 +            }
269.1005 +
269.1006 +            /* build code tables -- note: do not change the lenbits or distbits
269.1007 +               values here (9 and 6) without reading the comments in inftrees.h
269.1008 +               concerning the ENOUGH constants, which depend on those values */
269.1009 +            state->next = state->codes;
269.1010 +            state->lencode = (code const FAR *)(state->next);
269.1011 +            state->lenbits = 9;
269.1012 +            ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
269.1013 +                                &(state->lenbits), state->work);
269.1014 +            if (ret) {
269.1015 +                strm->msg = (char *)"invalid literal/lengths set";
269.1016 +                state->mode = BAD;
269.1017 +                break;
269.1018 +            }
269.1019 +            state->distcode = (code const FAR *)(state->next);
269.1020 +            state->distbits = 6;
269.1021 +            ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
269.1022 +                            &(state->next), &(state->distbits), state->work);
269.1023 +            if (ret) {
269.1024 +                strm->msg = (char *)"invalid distances set";
269.1025 +                state->mode = BAD;
269.1026 +                break;
269.1027 +            }
269.1028 +            Tracev((stderr, "inflate:       codes ok\n"));
269.1029 +            state->mode = LEN_;
269.1030 +            if (flush == Z_TREES) goto inf_leave;
269.1031 +        case LEN_:
269.1032 +            state->mode = LEN;
269.1033 +        case LEN:
269.1034 +            if (have >= 6 && left >= 258) {
269.1035 +                RESTORE();
269.1036 +                inflate_fast(strm, out);
269.1037 +                LOAD();
269.1038 +                if (state->mode == TYPE)
269.1039 +                    state->back = -1;
269.1040 +                break;
269.1041 +            }
269.1042 +            state->back = 0;
269.1043 +            for (;;) {
269.1044 +                here = state->lencode[BITS(state->lenbits)];
269.1045 +                if ((unsigned)(here.bits) <= bits) break;
269.1046 +                PULLBYTE();
269.1047 +            }
269.1048 +            if (here.op && (here.op & 0xf0) == 0) {
269.1049 +                last = here;
269.1050 +                for (;;) {
269.1051 +                    here = state->lencode[last.val +
269.1052 +                            (BITS(last.bits + last.op) >> last.bits)];
269.1053 +                    if ((unsigned)(last.bits + here.bits) <= bits) break;
269.1054 +                    PULLBYTE();
269.1055 +                }
269.1056 +                DROPBITS(last.bits);
269.1057 +                state->back += last.bits;
269.1058 +            }
269.1059 +            DROPBITS(here.bits);
269.1060 +            state->back += here.bits;
269.1061 +            state->length = (unsigned)here.val;
269.1062 +            if ((int)(here.op) == 0) {
269.1063 +                Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
269.1064 +                        "inflate:         literal '%c'\n" :
269.1065 +                        "inflate:         literal 0x%02x\n", here.val));
269.1066 +                state->mode = LIT;
269.1067 +                break;
269.1068 +            }
269.1069 +            if (here.op & 32) {
269.1070 +                Tracevv((stderr, "inflate:         end of block\n"));
269.1071 +                state->back = -1;
269.1072 +                state->mode = TYPE;
269.1073 +                break;
269.1074 +            }
269.1075 +            if (here.op & 64) {
269.1076 +                strm->msg = (char *)"invalid literal/length code";
269.1077 +                state->mode = BAD;
269.1078 +                break;
269.1079 +            }
269.1080 +            state->extra = (unsigned)(here.op) & 15;
269.1081 +            state->mode = LENEXT;
269.1082 +        case LENEXT:
269.1083 +            if (state->extra) {
269.1084 +                NEEDBITS(state->extra);
269.1085 +                state->length += BITS(state->extra);
269.1086 +                DROPBITS(state->extra);
269.1087 +                state->back += state->extra;
269.1088 +            }
269.1089 +            Tracevv((stderr, "inflate:         length %u\n", state->length));
269.1090 +            state->was = state->length;
269.1091 +            state->mode = DIST;
269.1092 +        case DIST:
269.1093 +            for (;;) {
269.1094 +                here = state->distcode[BITS(state->distbits)];
269.1095 +                if ((unsigned)(here.bits) <= bits) break;
269.1096 +                PULLBYTE();
269.1097 +            }
269.1098 +            if ((here.op & 0xf0) == 0) {
269.1099 +                last = here;
269.1100 +                for (;;) {
269.1101 +                    here = state->distcode[last.val +
269.1102 +                            (BITS(last.bits + last.op) >> last.bits)];
269.1103 +                    if ((unsigned)(last.bits + here.bits) <= bits) break;
269.1104 +                    PULLBYTE();
269.1105 +                }
269.1106 +                DROPBITS(last.bits);
269.1107 +                state->back += last.bits;
269.1108 +            }
269.1109 +            DROPBITS(here.bits);
269.1110 +            state->back += here.bits;
269.1111 +            if (here.op & 64) {
269.1112 +                strm->msg = (char *)"invalid distance code";
269.1113 +                state->mode = BAD;
269.1114 +                break;
269.1115 +            }
269.1116 +            state->offset = (unsigned)here.val;
269.1117 +            state->extra = (unsigned)(here.op) & 15;
269.1118 +            state->mode = DISTEXT;
269.1119 +        case DISTEXT:
269.1120 +            if (state->extra) {
269.1121 +                NEEDBITS(state->extra);
269.1122 +                state->offset += BITS(state->extra);
269.1123 +                DROPBITS(state->extra);
269.1124 +                state->back += state->extra;
269.1125 +            }
269.1126 +#ifdef INFLATE_STRICT
269.1127 +            if (state->offset > state->dmax) {
269.1128 +                strm->msg = (char *)"invalid distance too far back";
269.1129 +                state->mode = BAD;
269.1130 +                break;
269.1131 +            }
269.1132 +#endif
269.1133 +            Tracevv((stderr, "inflate:         distance %u\n", state->offset));
269.1134 +            state->mode = MATCH;
269.1135 +        case MATCH:
269.1136 +            if (left == 0) goto inf_leave;
269.1137 +            copy = out - left;
269.1138 +            if (state->offset > copy) {         /* copy from window */
269.1139 +                copy = state->offset - copy;
269.1140 +                if (copy > state->whave) {
269.1141 +                    if (state->sane) {
269.1142 +                        strm->msg = (char *)"invalid distance too far back";
269.1143 +                        state->mode = BAD;
269.1144 +                        break;
269.1145 +                    }
269.1146 +#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
269.1147 +                    Trace((stderr, "inflate.c too far\n"));
269.1148 +                    copy -= state->whave;
269.1149 +                    if (copy > state->length) copy = state->length;
269.1150 +                    if (copy > left) copy = left;
269.1151 +                    left -= copy;
269.1152 +                    state->length -= copy;
269.1153 +                    do {
269.1154 +                        *put++ = 0;
269.1155 +                    } while (--copy);
269.1156 +                    if (state->length == 0) state->mode = LEN;
269.1157 +                    break;
269.1158 +#endif
269.1159 +                }
269.1160 +                if (copy > state->wnext) {
269.1161 +                    copy -= state->wnext;
269.1162 +                    from = state->window + (state->wsize - copy);
269.1163 +                }
269.1164 +                else
269.1165 +                    from = state->window + (state->wnext - copy);
269.1166 +                if (copy > state->length) copy = state->length;
269.1167 +            }
269.1168 +            else {                              /* copy from output */
269.1169 +                from = put - state->offset;
269.1170 +                copy = state->length;
269.1171 +            }
269.1172 +            if (copy > left) copy = left;
269.1173 +            left -= copy;
269.1174 +            state->length -= copy;
269.1175 +            do {
269.1176 +                *put++ = *from++;
269.1177 +            } while (--copy);
269.1178 +            if (state->length == 0) state->mode = LEN;
269.1179 +            break;
269.1180 +        case LIT:
269.1181 +            if (left == 0) goto inf_leave;
269.1182 +            *put++ = (unsigned char)(state->length);
269.1183 +            left--;
269.1184 +            state->mode = LEN;
269.1185 +            break;
269.1186 +        case CHECK:
269.1187 +            if (state->wrap) {
269.1188 +                NEEDBITS(32);
269.1189 +                out -= left;
269.1190 +                strm->total_out += out;
269.1191 +                state->total += out;
269.1192 +                if (out)
269.1193 +                    strm->adler = state->check =
269.1194 +                        UPDATE(state->check, put - out, out);
269.1195 +                out = left;
269.1196 +                if ((
269.1197 +#ifdef GUNZIP
269.1198 +                     state->flags ? hold :
269.1199 +#endif
269.1200 +                     REVERSE(hold)) != state->check) {
269.1201 +                    strm->msg = (char *)"incorrect data check";
269.1202 +                    state->mode = BAD;
269.1203 +                    break;
269.1204 +                }
269.1205 +                INITBITS();
269.1206 +                Tracev((stderr, "inflate:   check matches trailer\n"));
269.1207 +            }
269.1208 +#ifdef GUNZIP
269.1209 +            state->mode = LENGTH;
269.1210 +        case LENGTH:
269.1211 +            if (state->wrap && state->flags) {
269.1212 +                NEEDBITS(32);
269.1213 +                if (hold != (state->total & 0xffffffffUL)) {
269.1214 +                    strm->msg = (char *)"incorrect length check";
269.1215 +                    state->mode = BAD;
269.1216 +                    break;
269.1217 +                }
269.1218 +                INITBITS();
269.1219 +                Tracev((stderr, "inflate:   length matches trailer\n"));
269.1220 +            }
269.1221 +#endif
269.1222 +            state->mode = DONE;
269.1223 +        case DONE:
269.1224 +            ret = Z_STREAM_END;
269.1225 +            goto inf_leave;
269.1226 +        case BAD:
269.1227 +            ret = Z_DATA_ERROR;
269.1228 +            goto inf_leave;
269.1229 +        case MEM:
269.1230 +            return Z_MEM_ERROR;
269.1231 +        case SYNC:
269.1232 +        default:
269.1233 +            return Z_STREAM_ERROR;
269.1234 +        }
269.1235 +
269.1236 +    /*
269.1237 +       Return from inflate(), updating the total counts and the check value.
269.1238 +       If there was no progress during the inflate() call, return a buffer
269.1239 +       error.  Call updatewindow() to create and/or update the window state.
269.1240 +       Note: a memory error from inflate() is non-recoverable.
269.1241 +     */
269.1242 +  inf_leave:
269.1243 +    RESTORE();
269.1244 +    if (state->wsize || (state->mode < CHECK && out != strm->avail_out))
269.1245 +        if (updatewindow(strm, out)) {
269.1246 +            state->mode = MEM;
269.1247 +            return Z_MEM_ERROR;
269.1248 +        }
269.1249 +    in -= strm->avail_in;
269.1250 +    out -= strm->avail_out;
269.1251 +    strm->total_in += in;
269.1252 +    strm->total_out += out;
269.1253 +    state->total += out;
269.1254 +    if (state->wrap && out)
269.1255 +        strm->adler = state->check =
269.1256 +            UPDATE(state->check, strm->next_out - out, out);
269.1257 +    strm->data_type = state->bits + (state->last ? 64 : 0) +
269.1258 +                      (state->mode == TYPE ? 128 : 0) +
269.1259 +                      (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
269.1260 +    if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
269.1261 +        ret = Z_BUF_ERROR;
269.1262 +    return ret;
269.1263 +}
269.1264 +
269.1265 +int ZEXPORT inflateEnd(strm)
269.1266 +z_streamp strm;
269.1267 +{
269.1268 +    struct inflate_state FAR *state;
269.1269 +    if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
269.1270 +        return Z_STREAM_ERROR;
269.1271 +    state = (struct inflate_state FAR *)strm->state;
269.1272 +    if (state->window != Z_NULL) ZFREE(strm, state->window);
269.1273 +    ZFREE(strm, strm->state);
269.1274 +    strm->state = Z_NULL;
269.1275 +    Tracev((stderr, "inflate: end\n"));
269.1276 +    return Z_OK;
269.1277 +}
269.1278 +
269.1279 +int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength)
269.1280 +z_streamp strm;
269.1281 +const Bytef *dictionary;
269.1282 +uInt dictLength;
269.1283 +{
269.1284 +    struct inflate_state FAR *state;
269.1285 +    unsigned long id;
269.1286 +
269.1287 +    /* check state */
269.1288 +    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
269.1289 +    state = (struct inflate_state FAR *)strm->state;
269.1290 +    if (state->wrap != 0 && state->mode != DICT)
269.1291 +        return Z_STREAM_ERROR;
269.1292 +
269.1293 +    /* check for correct dictionary id */
269.1294 +    if (state->mode == DICT) {
269.1295 +        id = adler32(0L, Z_NULL, 0);
269.1296 +        id = adler32(id, dictionary, dictLength);
269.1297 +        if (id != state->check)
269.1298 +            return Z_DATA_ERROR;
269.1299 +    }
269.1300 +
269.1301 +    /* copy dictionary to window */
269.1302 +    if (updatewindow(strm, strm->avail_out)) {
269.1303 +        state->mode = MEM;
269.1304 +        return Z_MEM_ERROR;
269.1305 +    }
269.1306 +    if (dictLength > state->wsize) {
269.1307 +        zmemcpy(state->window, dictionary + dictLength - state->wsize,
269.1308 +                state->wsize);
269.1309 +        state->whave = state->wsize;
269.1310 +    }
269.1311 +    else {
269.1312 +        zmemcpy(state->window + state->wsize - dictLength, dictionary,
269.1313 +                dictLength);
269.1314 +        state->whave = dictLength;
269.1315 +    }
269.1316 +    state->havedict = 1;
269.1317 +    Tracev((stderr, "inflate:   dictionary set\n"));
269.1318 +    return Z_OK;
269.1319 +}
269.1320 +
269.1321 +int ZEXPORT inflateGetHeader(strm, head)
269.1322 +z_streamp strm;
269.1323 +gz_headerp head;
269.1324 +{
269.1325 +    struct inflate_state FAR *state;
269.1326 +
269.1327 +    /* check state */
269.1328 +    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
269.1329 +    state = (struct inflate_state FAR *)strm->state;
269.1330 +    if ((state->wrap & 2) == 0) return Z_STREAM_ERROR;
269.1331 +
269.1332 +    /* save header structure */
269.1333 +    state->head = head;
269.1334 +    head->done = 0;
269.1335 +    return Z_OK;
269.1336 +}
269.1337 +
269.1338 +/*
269.1339 +   Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff.  Return when found
269.1340 +   or when out of input.  When called, *have is the number of pattern bytes
269.1341 +   found in order so far, in 0..3.  On return *have is updated to the new
269.1342 +   state.  If on return *have equals four, then the pattern was found and the
269.1343 +   return value is how many bytes were read including the last byte of the
269.1344 +   pattern.  If *have is less than four, then the pattern has not been found
269.1345 +   yet and the return value is len.  In the latter case, syncsearch() can be
269.1346 +   called again with more data and the *have state.  *have is initialized to
269.1347 +   zero for the first call.
269.1348 + */
269.1349 +local unsigned syncsearch(have, buf, len)
269.1350 +unsigned FAR *have;
269.1351 +unsigned char FAR *buf;
269.1352 +unsigned len;
269.1353 +{
269.1354 +    unsigned got;
269.1355 +    unsigned next;
269.1356 +
269.1357 +    got = *have;
269.1358 +    next = 0;
269.1359 +    while (next < len && got < 4) {
269.1360 +        if ((int)(buf[next]) == (got < 2 ? 0 : 0xff))
269.1361 +            got++;
269.1362 +        else if (buf[next])
269.1363 +            got = 0;
269.1364 +        else
269.1365 +            got = 4 - got;
269.1366 +        next++;
269.1367 +    }
269.1368 +    *have = got;
269.1369 +    return next;
269.1370 +}
269.1371 +
269.1372 +int ZEXPORT inflateSync(strm)
269.1373 +z_streamp strm;
269.1374 +{
269.1375 +    unsigned len;               /* number of bytes to look at or looked at */
269.1376 +    long long in, out;      /* temporary to save total_in and total_out */
269.1377 +    unsigned char buf[4];       /* to restore bit buffer to byte string */
269.1378 +    struct inflate_state FAR *state;
269.1379 +
269.1380 +    /* check parameters */
269.1381 +    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
269.1382 +    state = (struct inflate_state FAR *)strm->state;
269.1383 +    if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR;
269.1384 +
269.1385 +    /* if first time, start search in bit buffer */
269.1386 +    if (state->mode != SYNC) {
269.1387 +        state->mode = SYNC;
269.1388 +        state->hold <<= state->bits & 7;
269.1389 +        state->bits -= state->bits & 7;
269.1390 +        len = 0;
269.1391 +        while (state->bits >= 8) {
269.1392 +            buf[len++] = (unsigned char)(state->hold);
269.1393 +            state->hold >>= 8;
269.1394 +            state->bits -= 8;
269.1395 +        }
269.1396 +        state->have = 0;
269.1397 +        syncsearch(&(state->have), buf, len);
269.1398 +    }
269.1399 +
269.1400 +    /* search available input */
269.1401 +    len = syncsearch(&(state->have), strm->next_in, strm->avail_in);
269.1402 +    strm->avail_in -= len;
269.1403 +    strm->next_in += len;
269.1404 +    strm->total_in += len;
269.1405 +
269.1406 +    /* return no joy or set up to restart inflate() on a new block */
269.1407 +    if (state->have != 4) return Z_DATA_ERROR;
269.1408 +    in = strm->total_in;  out = strm->total_out;
269.1409 +    inflateReset(strm);
269.1410 +    strm->total_in = in;  strm->total_out = out;
269.1411 +    state->mode = TYPE;
269.1412 +    return Z_OK;
269.1413 +}
269.1414 +
269.1415 +/*
269.1416 +   Returns true if inflate is currently at the end of a block generated by
269.1417 +   Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP
269.1418 +   implementation to provide an additional safety check. PPP uses
269.1419 +   Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored
269.1420 +   block. When decompressing, PPP checks that at the end of input packet,
269.1421 +   inflate is waiting for these length bytes.
269.1422 + */
269.1423 +int ZEXPORT inflateSyncPoint(strm)
269.1424 +z_streamp strm;
269.1425 +{
269.1426 +    struct inflate_state FAR *state;
269.1427 +
269.1428 +    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
269.1429 +    state = (struct inflate_state FAR *)strm->state;
269.1430 +    return state->mode == STORED && state->bits == 0;
269.1431 +}
269.1432 +
269.1433 +int ZEXPORT inflateCopy(dest, source)
269.1434 +z_streamp dest;
269.1435 +z_streamp source;
269.1436 +{
269.1437 +    struct inflate_state FAR *state;
269.1438 +    struct inflate_state FAR *copy;
269.1439 +    unsigned char FAR *window;
269.1440 +    unsigned wsize;
269.1441 +
269.1442 +    /* check input */
269.1443 +    if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL ||
269.1444 +        source->zalloc == (alloc_func)0 || source->zfree == (free_func)0)
269.1445 +        return Z_STREAM_ERROR;
269.1446 +    state = (struct inflate_state FAR *)source->state;
269.1447 +
269.1448 +    /* allocate space */
269.1449 +    copy = (struct inflate_state FAR *)
269.1450 +           ZALLOC(source, 1, sizeof(struct inflate_state));
269.1451 +    if (copy == Z_NULL) return Z_MEM_ERROR;
269.1452 +    window = Z_NULL;
269.1453 +    if (state->window != Z_NULL) {
269.1454 +        window = (unsigned char FAR *)
269.1455 +                 ZALLOC(source, 1U << state->wbits, sizeof(unsigned char));
269.1456 +        if (window == Z_NULL) {
269.1457 +            ZFREE(source, copy);
269.1458 +            return Z_MEM_ERROR;
269.1459 +        }
269.1460 +    }
269.1461 +
269.1462 +    /* copy state */
269.1463 +    zmemcpy(dest, source, sizeof(z_stream));
269.1464 +    zmemcpy(copy, state, sizeof(struct inflate_state));
269.1465 +    if (state->lencode >= state->codes &&
269.1466 +        state->lencode <= state->codes + ENOUGH - 1) {
269.1467 +        copy->lencode = copy->codes + (state->lencode - state->codes);
269.1468 +        copy->distcode = copy->codes + (state->distcode - state->codes);
269.1469 +    }
269.1470 +    copy->next = copy->codes + (state->next - state->codes);
269.1471 +    if (window != Z_NULL) {
269.1472 +        wsize = 1U << state->wbits;
269.1473 +        zmemcpy(window, state->window, wsize);
269.1474 +    }
269.1475 +    copy->window = window;
269.1476 +    dest->state = (struct internal_state FAR *)copy;
269.1477 +    return Z_OK;
269.1478 +}
269.1479 +
269.1480 +int ZEXPORT inflateUndermine(strm, subvert)
269.1481 +z_streamp strm;
269.1482 +int subvert;
269.1483 +{
269.1484 +    struct inflate_state FAR *state;
269.1485 +
269.1486 +    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
269.1487 +    state = (struct inflate_state FAR *)strm->state;
269.1488 +    state->sane = !subvert;
269.1489 +#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
269.1490 +    return Z_OK;
269.1491 +#else
269.1492 +    state->sane = 1;
269.1493 +    return Z_DATA_ERROR;
269.1494 +#endif
269.1495 +}
269.1496 +
269.1497 +long ZEXPORT inflateMark(strm)
269.1498 +z_streamp strm;
269.1499 +{
269.1500 +    struct inflate_state FAR *state;
269.1501 +
269.1502 +    if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16;
269.1503 +    state = (struct inflate_state FAR *)strm->state;
269.1504 +    return ((long)(state->back) << 16) +
269.1505 +        (state->mode == COPY ? state->length :
269.1506 +            (state->mode == MATCH ? state->was - state->length : 0));
269.1507 +}
   270.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   270.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/inflate.h	Mon Dec 19 10:06:23 2011 -0800
   270.3 @@ -0,0 +1,146 @@
   270.4 +/*
   270.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   270.6 + *
   270.7 + * This code is free software; you can redistribute it and/or modify it
   270.8 + * under the terms of the GNU General Public License version 2 only, as
   270.9 + * published by the Free Software Foundation.  Oracle designates this
  270.10 + * particular file as subject to the "Classpath" exception as provided
  270.11 + * by Oracle in the LICENSE file that accompanied this code.
  270.12 + *
  270.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
  270.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  270.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  270.16 + * version 2 for more details (a copy is included in the LICENSE file that
  270.17 + * accompanied this code).
  270.18 + *
  270.19 + * You should have received a copy of the GNU General Public License version
  270.20 + * 2 along with this work; if not, write to the Free Software Foundation,
  270.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  270.22 + *
  270.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  270.24 + * or visit www.oracle.com if you need additional information or have any
  270.25 + * questions.
  270.26 + */
  270.27 +
  270.28 +/* inflate.h -- internal inflate state definition
  270.29 + * Copyright (C) 1995-2009 Mark Adler
  270.30 + * For conditions of distribution and use, see copyright notice in zlib.h
  270.31 + */
  270.32 +
  270.33 +/* WARNING: this file should *not* be used by applications. It is
  270.34 +   part of the implementation of the compression library and is
  270.35 +   subject to change. Applications should only use zlib.h.
  270.36 + */
  270.37 +
  270.38 +/* define NO_GZIP when compiling if you want to disable gzip header and
  270.39 +   trailer decoding by inflate().  NO_GZIP would be used to avoid linking in
  270.40 +   the crc code when it is not needed.  For shared libraries, gzip decoding
  270.41 +   should be left enabled. */
  270.42 +#ifndef NO_GZIP
  270.43 +#  define GUNZIP
  270.44 +#endif
  270.45 +
  270.46 +/* Possible inflate modes between inflate() calls */
  270.47 +typedef enum {
  270.48 +    HEAD,       /* i: waiting for magic header */
  270.49 +    FLAGS,      /* i: waiting for method and flags (gzip) */
  270.50 +    TIME,       /* i: waiting for modification time (gzip) */
  270.51 +    OS,         /* i: waiting for extra flags and operating system (gzip) */
  270.52 +    EXLEN,      /* i: waiting for extra length (gzip) */
  270.53 +    EXTRA,      /* i: waiting for extra bytes (gzip) */
  270.54 +    NAME,       /* i: waiting for end of file name (gzip) */
  270.55 +    COMMENT,    /* i: waiting for end of comment (gzip) */
  270.56 +    HCRC,       /* i: waiting for header crc (gzip) */
  270.57 +    DICTID,     /* i: waiting for dictionary check value */
  270.58 +    DICT,       /* waiting for inflateSetDictionary() call */
  270.59 +        TYPE,       /* i: waiting for type bits, including last-flag bit */
  270.60 +        TYPEDO,     /* i: same, but skip check to exit inflate on new block */
  270.61 +        STORED,     /* i: waiting for stored size (length and complement) */
  270.62 +        COPY_,      /* i/o: same as COPY below, but only first time in */
  270.63 +        COPY,       /* i/o: waiting for input or output to copy stored block */
  270.64 +        TABLE,      /* i: waiting for dynamic block table lengths */
  270.65 +        LENLENS,    /* i: waiting for code length code lengths */
  270.66 +        CODELENS,   /* i: waiting for length/lit and distance code lengths */
  270.67 +            LEN_,       /* i: same as LEN below, but only first time in */
  270.68 +            LEN,        /* i: waiting for length/lit/eob code */
  270.69 +            LENEXT,     /* i: waiting for length extra bits */
  270.70 +            DIST,       /* i: waiting for distance code */
  270.71 +            DISTEXT,    /* i: waiting for distance extra bits */
  270.72 +            MATCH,      /* o: waiting for output space to copy string */
  270.73 +            LIT,        /* o: waiting for output space to write literal */
  270.74 +    CHECK,      /* i: waiting for 32-bit check value */
  270.75 +    LENGTH,     /* i: waiting for 32-bit length (gzip) */
  270.76 +    DONE,       /* finished check, done -- remain here until reset */
  270.77 +    BAD,        /* got a data error -- remain here until reset */
  270.78 +    MEM,        /* got an inflate() memory error -- remain here until reset */
  270.79 +    SYNC        /* looking for synchronization bytes to restart inflate() */
  270.80 +} inflate_mode;
  270.81 +
  270.82 +/*
  270.83 +    State transitions between above modes -
  270.84 +
  270.85 +    (most modes can go to BAD or MEM on error -- not shown for clarity)
  270.86 +
  270.87 +    Process header:
  270.88 +        HEAD -> (gzip) or (zlib) or (raw)
  270.89 +        (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME -> COMMENT ->
  270.90 +                  HCRC -> TYPE
  270.91 +        (zlib) -> DICTID or TYPE
  270.92 +        DICTID -> DICT -> TYPE
  270.93 +        (raw) -> TYPEDO
  270.94 +    Read deflate blocks:
  270.95 +            TYPE -> TYPEDO -> STORED or TABLE or LEN_ or CHECK
  270.96 +            STORED -> COPY_ -> COPY -> TYPE
  270.97 +            TABLE -> LENLENS -> CODELENS -> LEN_
  270.98 +            LEN_ -> LEN
  270.99 +    Read deflate codes in fixed or dynamic block:
 270.100 +                LEN -> LENEXT or LIT or TYPE
 270.101 +                LENEXT -> DIST -> DISTEXT -> MATCH -> LEN
 270.102 +                LIT -> LEN
 270.103 +    Process trailer:
 270.104 +        CHECK -> LENGTH -> DONE
 270.105 + */
 270.106 +
 270.107 +/* state maintained between inflate() calls.  Approximately 10K bytes. */
 270.108 +struct inflate_state {
 270.109 +    inflate_mode mode;          /* current inflate mode */
 270.110 +    int last;                   /* true if processing last block */
 270.111 +    int wrap;                   /* bit 0 true for zlib, bit 1 true for gzip */
 270.112 +    int havedict;               /* true if dictionary provided */
 270.113 +    int flags;                  /* gzip header method and flags (0 if zlib) */
 270.114 +    unsigned dmax;              /* zlib header max distance (INFLATE_STRICT) */
 270.115 +    unsigned long check;        /* protected copy of check value */
 270.116 +    unsigned long total;        /* protected copy of output count */
 270.117 +    gz_headerp head;            /* where to save gzip header information */
 270.118 +        /* sliding window */
 270.119 +    unsigned wbits;             /* log base 2 of requested window size */
 270.120 +    unsigned wsize;             /* window size or zero if not using window */
 270.121 +    unsigned whave;             /* valid bytes in the window */
 270.122 +    unsigned wnext;             /* window write index */
 270.123 +    unsigned char FAR *window;  /* allocated sliding window, if needed */
 270.124 +        /* bit accumulator */
 270.125 +    unsigned long hold;         /* input bit accumulator */
 270.126 +    unsigned bits;              /* number of bits in "in" */
 270.127 +        /* for string and stored block copying */
 270.128 +    unsigned length;            /* literal or length of data to copy */
 270.129 +    unsigned offset;            /* distance back to copy string from */
 270.130 +        /* for table and code decoding */
 270.131 +    unsigned extra;             /* extra bits needed */
 270.132 +        /* fixed and dynamic code tables */
 270.133 +    code const FAR *lencode;    /* starting table for length/literal codes */
 270.134 +    code const FAR *distcode;   /* starting table for distance codes */
 270.135 +    unsigned lenbits;           /* index bits for lencode */
 270.136 +    unsigned distbits;          /* index bits for distcode */
 270.137 +        /* dynamic table building */
 270.138 +    unsigned ncode;             /* number of code length code lengths */
 270.139 +    unsigned nlen;              /* number of length code lengths */
 270.140 +    unsigned ndist;             /* number of distance code lengths */
 270.141 +    unsigned have;              /* number of code lengths in lens[] */
 270.142 +    code FAR *next;             /* next available space in codes[] */
 270.143 +    unsigned short lens[320];   /* temporary storage for code lengths */
 270.144 +    unsigned short work[288];   /* work area for code table building */
 270.145 +    code codes[ENOUGH];         /* space for code tables */
 270.146 +    int sane;                   /* if false, allow invalid distance too far */
 270.147 +    int back;                   /* bits back of last unprocessed length/lit */
 270.148 +    unsigned was;               /* initial length of match */
 270.149 +};
   271.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   271.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/inftrees.c	Mon Dec 19 10:06:23 2011 -0800
   271.3 @@ -0,0 +1,354 @@
   271.4 +/*
   271.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   271.6 + *
   271.7 + * This code is free software; you can redistribute it and/or modify it
   271.8 + * under the terms of the GNU General Public License version 2 only, as
   271.9 + * published by the Free Software Foundation.  Oracle designates this
  271.10 + * particular file as subject to the "Classpath" exception as provided
  271.11 + * by Oracle in the LICENSE file that accompanied this code.
  271.12 + *
  271.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
  271.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  271.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  271.16 + * version 2 for more details (a copy is included in the LICENSE file that
  271.17 + * accompanied this code).
  271.18 + *
  271.19 + * You should have received a copy of the GNU General Public License version
  271.20 + * 2 along with this work; if not, write to the Free Software Foundation,
  271.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  271.22 + *
  271.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  271.24 + * or visit www.oracle.com if you need additional information or have any
  271.25 + * questions.
  271.26 + */
  271.27 +
  271.28 +/* inftrees.c -- generate Huffman trees for efficient decoding
  271.29 + * Copyright (C) 1995-2010 Mark Adler
  271.30 + * For conditions of distribution and use, see copyright notice in zlib.h
  271.31 + */
  271.32 +
  271.33 +#include "zutil.h"
  271.34 +#include "inftrees.h"
  271.35 +
  271.36 +#define MAXBITS 15
  271.37 +
  271.38 +const char inflate_copyright[] =
  271.39 +   " inflate 1.2.5 Copyright 1995-2010 Mark Adler ";
  271.40 +/*
  271.41 +  If you use the zlib library in a product, an acknowledgment is welcome
  271.42 +  in the documentation of your product. If for some reason you cannot
  271.43 +  include such an acknowledgment, I would appreciate that you keep this
  271.44 +  copyright string in the executable of your product.
  271.45 + */
  271.46 +
  271.47 +/*
  271.48 +   Build a set of tables to decode the provided canonical Huffman code.
  271.49 +   The code lengths are lens[0..codes-1].  The result starts at *table,
  271.50 +   whose indices are 0..2^bits-1.  work is a writable array of at least
  271.51 +   lens shorts, which is used as a work area.  type is the type of code
  271.52 +   to be generated, CODES, LENS, or DISTS.  On return, zero is success,
  271.53 +   -1 is an invalid code, and +1 means that ENOUGH isn't enough.  table
  271.54 +   on return points to the next available entry's address.  bits is the
  271.55 +   requested root table index bits, and on return it is the actual root
  271.56 +   table index bits.  It will differ if the request is greater than the
  271.57 +   longest code or if it is less than the shortest code.
  271.58 + */
  271.59 +int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work)
  271.60 +codetype type;
  271.61 +unsigned short FAR *lens;
  271.62 +unsigned codes;
  271.63 +code FAR * FAR *table;
  271.64 +unsigned FAR *bits;
  271.65 +unsigned short FAR *work;
  271.66 +{
  271.67 +    unsigned len;               /* a code's length in bits */
  271.68 +    unsigned sym;               /* index of code symbols */
  271.69 +    unsigned min, max;          /* minimum and maximum code lengths */
  271.70 +    unsigned root;              /* number of index bits for root table */
  271.71 +    unsigned curr;              /* number of index bits for current table */
  271.72 +    unsigned drop;              /* code bits to drop for sub-table */
  271.73 +    int left;                   /* number of prefix codes available */
  271.74 +    unsigned used;              /* code entries in table used */
  271.75 +    unsigned huff;              /* Huffman code */
  271.76 +    unsigned incr;              /* for incrementing code, index */
  271.77 +    unsigned fill;              /* index for replicating entries */
  271.78 +    unsigned low;               /* low bits for current root entry */
  271.79 +    unsigned mask;              /* mask for low root bits */
  271.80 +    code here;                  /* table entry for duplication */
  271.81 +    code FAR *next;             /* next available space in table */
  271.82 +    const unsigned short FAR *base;     /* base value table to use */
  271.83 +    const unsigned short FAR *extra;    /* extra bits table to use */
  271.84 +    int end;                    /* use base and extra for symbol > end */
  271.85 +    unsigned short count[MAXBITS+1];    /* number of codes of each length */
  271.86 +    unsigned short offs[MAXBITS+1];     /* offsets in table for each length */
  271.87 +    static const unsigned short lbase[31] = { /* Length codes 257..285 base */
  271.88 +        3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
  271.89 +        35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
  271.90 +    static const unsigned short lext[31] = { /* Length codes 257..285 extra */
  271.91 +        16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
  271.92 +        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 73, 195};
  271.93 +    static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
  271.94 +        1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
  271.95 +        257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
  271.96 +        8193, 12289, 16385, 24577, 0, 0};
  271.97 +    static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
  271.98 +        16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
  271.99 +        23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
 271.100 +        28, 28, 29, 29, 64, 64};
 271.101 +
 271.102 +    /*
 271.103 +       Process a set of code lengths to create a canonical Huffman code.  The
 271.104 +       code lengths are lens[0..codes-1].  Each length corresponds to the
 271.105 +       symbols 0..codes-1.  The Huffman code is generated by first sorting the
 271.106 +       symbols by length from short to long, and retaining the symbol order
 271.107 +       for codes with equal lengths.  Then the code starts with all zero bits
 271.108 +       for the first code of the shortest length, and the codes are integer
 271.109 +       increments for the same length, and zeros are appended as the length
 271.110 +       increases.  For the deflate format, these bits are stored backwards
 271.111 +       from their more natural integer increment ordering, and so when the
 271.112 +       decoding tables are built in the large loop below, the integer codes
 271.113 +       are incremented backwards.
 271.114 +
 271.115 +       This routine assumes, but does not check, that all of the entries in
 271.116 +       lens[] are in the range 0..MAXBITS.  The caller must assure this.
 271.117 +       1..MAXBITS is interpreted as that code length.  zero means that that
 271.118 +       symbol does not occur in this code.
 271.119 +
 271.120 +       The codes are sorted by computing a count of codes for each length,
 271.121 +       creating from that a table of starting indices for each length in the
 271.122 +       sorted table, and then entering the symbols in order in the sorted
 271.123 +       table.  The sorted table is work[], with that space being provided by
 271.124 +       the caller.
 271.125 +
 271.126 +       The length counts are used for other purposes as well, i.e. finding
 271.127 +       the minimum and maximum length codes, determining if there are any
 271.128 +       codes at all, checking for a valid set of lengths, and looking ahead
 271.129 +       at length counts to determine sub-table sizes when building the
 271.130 +       decoding tables.
 271.131 +     */
 271.132 +
 271.133 +    /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
 271.134 +    for (len = 0; len <= MAXBITS; len++)
 271.135 +        count[len] = 0;
 271.136 +    for (sym = 0; sym < codes; sym++)
 271.137 +        count[lens[sym]]++;
 271.138 +
 271.139 +    /* bound code lengths, force root to be within code lengths */
 271.140 +    root = *bits;
 271.141 +    for (max = MAXBITS; max >= 1; max--)
 271.142 +        if (count[max] != 0) break;
 271.143 +    if (root > max) root = max;
 271.144 +    if (max == 0) {                     /* no symbols to code at all */
 271.145 +        here.op = (unsigned char)64;    /* invalid code marker */
 271.146 +        here.bits = (unsigned char)1;
 271.147 +        here.val = (unsigned short)0;
 271.148 +        *(*table)++ = here;             /* make a table to force an error */
 271.149 +        *(*table)++ = here;
 271.150 +        *bits = 1;
 271.151 +        return 0;     /* no symbols, but wait for decoding to report error */
 271.152 +    }
 271.153 +    for (min = 1; min < max; min++)
 271.154 +        if (count[min] != 0) break;
 271.155 +    if (root < min) root = min;
 271.156 +
 271.157 +    /* check for an over-subscribed or incomplete set of lengths */
 271.158 +    left = 1;
 271.159 +    for (len = 1; len <= MAXBITS; len++) {
 271.160 +        left <<= 1;
 271.161 +        left -= count[len];
 271.162 +        if (left < 0) return -1;        /* over-subscribed */
 271.163 +    }
 271.164 +    if (left > 0 && (type == CODES || max != 1))
 271.165 +        return -1;                      /* incomplete set */
 271.166 +
 271.167 +    /* generate offsets into symbol table for each length for sorting */
 271.168 +    offs[1] = 0;
 271.169 +    for (len = 1; len < MAXBITS; len++)
 271.170 +        offs[len + 1] = offs[len] + count[len];
 271.171 +
 271.172 +    /* sort symbols by length, by symbol order within each length */
 271.173 +    for (sym = 0; sym < codes; sym++)
 271.174 +        if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;
 271.175 +
 271.176 +    /*
 271.177 +       Create and fill in decoding tables.  In this loop, the table being
 271.178 +       filled is at next and has curr index bits.  The code being used is huff
 271.179 +       with length len.  That code is converted to an index by dropping drop
 271.180 +       bits off of the bottom.  For codes where len is less than drop + curr,
 271.181 +       those top drop + curr - len bits are incremented through all values to
 271.182 +       fill the table with replicated entries.
 271.183 +
 271.184 +       root is the number of index bits for the root table.  When len exceeds
 271.185 +       root, sub-tables are created pointed to by the root entry with an index
 271.186 +       of the low root bits of huff.  This is saved in low to check for when a
 271.187 +       new sub-table should be started.  drop is zero when the root table is
 271.188 +       being filled, and drop is root when sub-tables are being filled.
 271.189 +
 271.190 +       When a new sub-table is needed, it is necessary to look ahead in the
 271.191 +       code lengths to determine what size sub-table is needed.  The length
 271.192 +       counts are used for this, and so count[] is decremented as codes are
 271.193 +       entered in the tables.
 271.194 +
 271.195 +       used keeps track of how many table entries have been allocated from the
 271.196 +       provided *table space.  It is checked for LENS and DIST tables against
 271.197 +       the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
 271.198 +       the initial root table size constants.  See the comments in inftrees.h
 271.199 +       for more information.
 271.200 +
 271.201 +       sym increments through all symbols, and the loop terminates when
 271.202 +       all codes of length max, i.e. all codes, have been processed.  This
 271.203 +       routine permits incomplete codes, so another loop after this one fills
 271.204 +       in the rest of the decoding tables with invalid code markers.
 271.205 +     */
 271.206 +
 271.207 +    /* set up for code type */
 271.208 +    switch (type) {
 271.209 +    case CODES:
 271.210 +        base = extra = work;    /* dummy value--not used */
 271.211 +        end = 19;
 271.212 +        break;
 271.213 +    case LENS:
 271.214 +        base = lbase;
 271.215 +        base -= 257;
 271.216 +        extra = lext;
 271.217 +        extra -= 257;
 271.218 +        end = 256;
 271.219 +        break;
 271.220 +    default:            /* DISTS */
 271.221 +        base = dbase;
 271.222 +        extra = dext;
 271.223 +        end = -1;
 271.224 +    }
 271.225 +
 271.226 +    /* initialize state for loop */
 271.227 +    huff = 0;                   /* starting code */
 271.228 +    sym = 0;                    /* starting code symbol */
 271.229 +    len = min;                  /* starting code length */
 271.230 +    next = *table;              /* current table to fill in */
 271.231 +    curr = root;                /* current table index bits */
 271.232 +    drop = 0;                   /* current bits to drop from code for index */
 271.233 +    low = (unsigned)(-1);       /* trigger new sub-table when len > root */
 271.234 +    used = 1U << root;          /* use root table entries */
 271.235 +    mask = used - 1;            /* mask for comparing low */
 271.236 +
 271.237 +    /* check available table space */
 271.238 +    if ((type == LENS && used >= ENOUGH_LENS) ||
 271.239 +        (type == DISTS && used >= ENOUGH_DISTS))
 271.240 +        return 1;
 271.241 +
 271.242 +    /* process all codes and make table entries */
 271.243 +    for (;;) {
 271.244 +        /* create table entry */
 271.245 +        here.bits = (unsigned char)(len - drop);
 271.246 +        if ((int)(work[sym]) < end) {
 271.247 +            here.op = (unsigned char)0;
 271.248 +            here.val = work[sym];
 271.249 +        }
 271.250 +        else if ((int)(work[sym]) > end) {
 271.251 +            here.op = (unsigned char)(extra[work[sym]]);
 271.252 +            here.val = base[work[sym]];
 271.253 +        }
 271.254 +        else {
 271.255 +            here.op = (unsigned char)(32 + 64);         /* end of block */
 271.256 +            here.val = 0;
 271.257 +        }
 271.258 +
 271.259 +        /* replicate for those indices with low len bits equal to huff */
 271.260 +        incr = 1U << (len - drop);
 271.261 +        fill = 1U << curr;
 271.262 +        min = fill;                 /* save offset to next table */
 271.263 +        do {
 271.264 +            fill -= incr;
 271.265 +            next[(huff >> drop) + fill] = here;
 271.266 +        } while (fill != 0);
 271.267 +
 271.268 +        /* backwards increment the len-bit code huff */
 271.269 +        incr = 1U << (len - 1);
 271.270 +        while (huff & incr)
 271.271 +            incr >>= 1;
 271.272 +        if (incr != 0) {
 271.273 +            huff &= incr - 1;
 271.274 +            huff += incr;
 271.275 +        }
 271.276 +        else
 271.277 +            huff = 0;
 271.278 +
 271.279 +        /* go to next symbol, update count, len */
 271.280 +        sym++;
 271.281 +        if (--(count[len]) == 0) {
 271.282 +            if (len == max) break;
 271.283 +            len = lens[work[sym]];
 271.284 +        }
 271.285 +
 271.286 +        /* create new sub-table if needed */
 271.287 +        if (len > root && (huff & mask) != low) {
 271.288 +            /* if first time, transition to sub-tables */
 271.289 +            if (drop == 0)
 271.290 +                drop = root;
 271.291 +
 271.292 +            /* increment past last table */
 271.293 +            next += min;            /* here min is 1 << curr */
 271.294 +
 271.295 +            /* determine length of next table */
 271.296 +            curr = len - drop;
 271.297 +            left = (int)(1 << curr);
 271.298 +            while (curr + drop < max) {
 271.299 +                left -= count[curr + drop];
 271.300 +                if (left <= 0) break;
 271.301 +                curr++;
 271.302 +                left <<= 1;
 271.303 +            }
 271.304 +
 271.305 +            /* check for enough space */
 271.306 +            used += 1U << curr;
 271.307 +            if ((type == LENS && used >= ENOUGH_LENS) ||
 271.308 +                (type == DISTS && used >= ENOUGH_DISTS))
 271.309 +                return 1;
 271.310 +
 271.311 +            /* point entry in root table to sub-table */
 271.312 +            low = huff & mask;
 271.313 +            (*table)[low].op = (unsigned char)curr;
 271.314 +            (*table)[low].bits = (unsigned char)root;
 271.315 +            (*table)[low].val = (unsigned short)(next - *table);
 271.316 +        }
 271.317 +    }
 271.318 +
 271.319 +    /*
 271.320 +       Fill in rest of table for incomplete codes.  This loop is similar to the
 271.321 +       loop above in incrementing huff for table indices.  It is assumed that
 271.322 +       len is equal to curr + drop, so there is no loop needed to increment
 271.323 +       through high index bits.  When the current sub-table is filled, the loop
 271.324 +       drops back to the root table to fill in any remaining entries there.
 271.325 +     */
 271.326 +    here.op = (unsigned char)64;                /* invalid code marker */
 271.327 +    here.bits = (unsigned char)(len - drop);
 271.328 +    here.val = (unsigned short)0;
 271.329 +    while (huff != 0) {
 271.330 +        /* when done with sub-table, drop back to root table */
 271.331 +        if (drop != 0 && (huff & mask) != low) {
 271.332 +            drop = 0;
 271.333 +            len = root;
 271.334 +            next = *table;
 271.335 +            here.bits = (unsigned char)len;
 271.336 +        }
 271.337 +
 271.338 +        /* put invalid code marker in table */
 271.339 +        next[huff >> drop] = here;
 271.340 +
 271.341 +        /* backwards increment the len-bit code huff */
 271.342 +        incr = 1U << (len - 1);
 271.343 +        while (huff & incr)
 271.344 +            incr >>= 1;
 271.345 +        if (incr != 0) {
 271.346 +            huff &= incr - 1;
 271.347 +            huff += incr;
 271.348 +        }
 271.349 +        else
 271.350 +            huff = 0;
 271.351 +    }
 271.352 +
 271.353 +    /* set return parameters */
 271.354 +    *table += used;
 271.355 +    *bits = root;
 271.356 +    return 0;
 271.357 +}
   272.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   272.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/inftrees.h	Mon Dec 19 10:06:23 2011 -0800
   272.3 @@ -0,0 +1,86 @@
   272.4 +/*
   272.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   272.6 + *
   272.7 + * This code is free software; you can redistribute it and/or modify it
   272.8 + * under the terms of the GNU General Public License version 2 only, as
   272.9 + * published by the Free Software Foundation.  Oracle designates this
  272.10 + * particular file as subject to the "Classpath" exception as provided
  272.11 + * by Oracle in the LICENSE file that accompanied this code.
  272.12 + *
  272.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
  272.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  272.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  272.16 + * version 2 for more details (a copy is included in the LICENSE file that
  272.17 + * accompanied this code).
  272.18 + *
  272.19 + * You should have received a copy of the GNU General Public License version
  272.20 + * 2 along with this work; if not, write to the Free Software Foundation,
  272.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  272.22 + *
  272.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  272.24 + * or visit www.oracle.com if you need additional information or have any
  272.25 + * questions.
  272.26 + */
  272.27 +
  272.28 +/* inftrees.h -- header to use inftrees.c
  272.29 + * Copyright (C) 1995-2005, 2010 Mark Adler
  272.30 + * For conditions of distribution and use, see copyright notice in zlib.h
  272.31 + */
  272.32 +
  272.33 +/* WARNING: this file should *not* be used by applications. It is
  272.34 +   part of the implementation of the compression library and is
  272.35 +   subject to change. Applications should only use zlib.h.
  272.36 + */
  272.37 +
  272.38 +/* Structure for decoding tables.  Each entry provides either the
  272.39 +   information needed to do the operation requested by the code that
  272.40 +   indexed that table entry, or it provides a pointer to another
  272.41 +   table that indexes more bits of the code.  op indicates whether
  272.42 +   the entry is a pointer to another table, a literal, a length or
  272.43 +   distance, an end-of-block, or an invalid code.  For a table
  272.44 +   pointer, the low four bits of op is the number of index bits of
  272.45 +   that table.  For a length or distance, the low four bits of op
  272.46 +   is the number of extra bits to get after the code.  bits is
  272.47 +   the number of bits in this code or part of the code to drop off
  272.48 +   of the bit buffer.  val is the actual byte to output in the case
  272.49 +   of a literal, the base length or distance, or the offset from
  272.50 +   the current table to the next table.  Each entry is four bytes. */
  272.51 +typedef struct {
  272.52 +    unsigned char op;           /* operation, extra bits, table bits */
  272.53 +    unsigned char bits;         /* bits in this part of the code */
  272.54 +    unsigned short val;         /* offset in table or code value */
  272.55 +} code;
  272.56 +
  272.57 +/* op values as set by inflate_table():
  272.58 +    00000000 - literal
  272.59 +    0000tttt - table link, tttt != 0 is the number of table index bits
  272.60 +    0001eeee - length or distance, eeee is the number of extra bits
  272.61 +    01100000 - end of block
  272.62 +    01000000 - invalid code
  272.63 + */
  272.64 +
  272.65 +/* Maximum size of the dynamic table.  The maximum number of code structures is
  272.66 +   1444, which is the sum of 852 for literal/length codes and 592 for distance
  272.67 +   codes.  These values were found by exhaustive searches using the program
  272.68 +   examples/enough.c found in the zlib distribtution.  The arguments to that
  272.69 +   program are the number of symbols, the initial root table size, and the
  272.70 +   maximum bit length of a code.  "enough 286 9 15" for literal/length codes
  272.71 +   returns returns 852, and "enough 30 6 15" for distance codes returns 592.
  272.72 +   The initial root table size (9 or 6) is found in the fifth argument of the
  272.73 +   inflate_table() calls in inflate.c and infback.c.  If the root table size is
  272.74 +   changed, then these maximum sizes would be need to be recalculated and
  272.75 +   updated. */
  272.76 +#define ENOUGH_LENS 852
  272.77 +#define ENOUGH_DISTS 592
  272.78 +#define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS)
  272.79 +
  272.80 +/* Type of code to build for inflate_table() */
  272.81 +typedef enum {
  272.82 +    CODES,
  272.83 +    LENS,
  272.84 +    DISTS
  272.85 +} codetype;
  272.86 +
  272.87 +int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
  272.88 +                             unsigned codes, code FAR * FAR *table,
  272.89 +                             unsigned FAR *bits, unsigned short FAR *work));
   273.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   273.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/patches/ChangeLog_java	Mon Dec 19 10:06:23 2011 -0800
   273.3 @@ -0,0 +1,19 @@
   273.4 +(1)renamed
   273.5 +   adler32.c -> zadler32.c
   273.6 +   zcrc32c -> zcrc32.c
   273.7 +
   273.8 +(2)added _LP64 to make uLong a 32-bit int on 64-bit platform
   273.9 +   zconf.h:
  273.10 +   uLong -> 32-bit int
  273.11 +
  273.12 +(3)updated crc32.c/crc32()
  273.13 +   unsigned long      -> uLong
  273.14 +
  273.15 +(4)updated zlib.h (to support > 4G zipfile):
  273.16 +   total_in/out: uLong -> long long
  273.17 +
  273.18 +(5)updated inflate.c/inflateSync()
  273.19 +   unsigned long in, out; -->  long long in, out;
  273.20 +
  273.21 +(6)updated compress.c/uncompr.c
  273.22 +   *destLen = stream.total_out; --> *destLen = (uLong)stream.total_out;
   274.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   274.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/trees.c	Mon Dec 19 10:06:23 2011 -0800
   274.3 @@ -0,0 +1,1268 @@
   274.4 +/*
   274.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   274.6 + *
   274.7 + * This code is free software; you can redistribute it and/or modify it
   274.8 + * under the terms of the GNU General Public License version 2 only, as
   274.9 + * published by the Free Software Foundation.  Oracle designates this
  274.10 + * particular file as subject to the "Classpath" exception as provided
  274.11 + * by Oracle in the LICENSE file that accompanied this code.
  274.12 + *
  274.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
  274.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  274.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  274.16 + * version 2 for more details (a copy is included in the LICENSE file that
  274.17 + * accompanied this code).
  274.18 + *
  274.19 + * You should have received a copy of the GNU General Public License version
  274.20 + * 2 along with this work; if not, write to the Free Software Foundation,
  274.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  274.22 + *
  274.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  274.24 + * or visit www.oracle.com if you need additional information or have any
  274.25 + * questions.
  274.26 + */
  274.27 +
  274.28 +/* trees.c -- output deflated data using Huffman coding
  274.29 + * Copyright (C) 1995-2010 Jean-loup Gailly
  274.30 + * detect_data_type() function provided freely by Cosmin Truta, 2006
  274.31 + * For conditions of distribution and use, see copyright notice in zlib.h
  274.32 + */
  274.33 +
  274.34 +/*
  274.35 + *  ALGORITHM
  274.36 + *
  274.37 + *      The "deflation" process uses several Huffman trees. The more
  274.38 + *      common source values are represented by shorter bit sequences.
  274.39 + *
  274.40 + *      Each code tree is stored in a compressed form which is itself
  274.41 + * a Huffman encoding of the lengths of all the code strings (in
  274.42 + * ascending order by source values).  The actual code strings are
  274.43 + * reconstructed from the lengths in the inflate process, as described
  274.44 + * in the deflate specification.
  274.45 + *
  274.46 + *  REFERENCES
  274.47 + *
  274.48 + *      Deutsch, L.P.,"'Deflate' Compressed Data Format Specification".
  274.49 + *      Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc
  274.50 + *
  274.51 + *      Storer, James A.
  274.52 + *          Data Compression:  Methods and Theory, pp. 49-50.
  274.53 + *          Computer Science Press, 1988.  ISBN 0-7167-8156-5.
  274.54 + *
  274.55 + *      Sedgewick, R.
  274.56 + *          Algorithms, p290.
  274.57 + *          Addison-Wesley, 1983. ISBN 0-201-06672-6.
  274.58 + */
  274.59 +
  274.60 +/* @(#) $Id$ */
  274.61 +
  274.62 +/* #define GEN_TREES_H */
  274.63 +
  274.64 +#include "deflate.h"
  274.65 +
  274.66 +#ifdef DEBUG
  274.67 +#  include <ctype.h>
  274.68 +#endif
  274.69 +
  274.70 +/* ===========================================================================
  274.71 + * Constants
  274.72 + */
  274.73 +
  274.74 +#define MAX_BL_BITS 7
  274.75 +/* Bit length codes must not exceed MAX_BL_BITS bits */
  274.76 +
  274.77 +#define END_BLOCK 256
  274.78 +/* end of block literal code */
  274.79 +
  274.80 +#define REP_3_6      16
  274.81 +/* repeat previous bit length 3-6 times (2 bits of repeat count) */
  274.82 +
  274.83 +#define REPZ_3_10    17
  274.84 +/* repeat a zero length 3-10 times  (3 bits of repeat count) */
  274.85 +
  274.86 +#define REPZ_11_138  18
  274.87 +/* repeat a zero length 11-138 times  (7 bits of repeat count) */
  274.88 +
  274.89 +local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */
  274.90 +   = {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};
  274.91 +
  274.92 +local const int extra_dbits[D_CODES] /* extra bits for each distance code */
  274.93 +   = {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};
  274.94 +
  274.95 +local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */
  274.96 +   = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7};
  274.97 +
  274.98 +local const uch bl_order[BL_CODES]
  274.99 +   = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15};
 274.100 +/* The lengths of the bit length codes are sent in order of decreasing
 274.101 + * probability, to avoid transmitting the lengths for unused bit length codes.
 274.102 + */
 274.103 +
 274.104 +#define Buf_size (8 * 2*sizeof(char))
 274.105 +/* Number of bits used within bi_buf. (bi_buf might be implemented on
 274.106 + * more than 16 bits on some systems.)
 274.107 + */
 274.108 +
 274.109 +/* ===========================================================================
 274.110 + * Local data. These are initialized only once.
 274.111 + */
 274.112 +
 274.113 +#define DIST_CODE_LEN  512 /* see definition of array dist_code below */
 274.114 +
 274.115 +#if defined(GEN_TREES_H) || !defined(STDC)
 274.116 +/* non ANSI compilers may not accept trees.h */
 274.117 +
 274.118 +local ct_data static_ltree[L_CODES+2];
 274.119 +/* The static literal tree. Since the bit lengths are imposed, there is no
 274.120 + * need for the L_CODES extra codes used during heap construction. However
 274.121 + * The codes 286 and 287 are needed to build a canonical tree (see _tr_init
 274.122 + * below).
 274.123 + */
 274.124 +
 274.125 +local ct_data static_dtree[D_CODES];
 274.126 +/* The static distance tree. (Actually a trivial tree since all codes use
 274.127 + * 5 bits.)
 274.128 + */
 274.129 +
 274.130 +uch _dist_code[DIST_CODE_LEN];
 274.131 +/* Distance codes. The first 256 values correspond to the distances
 274.132 + * 3 .. 258, the last 256 values correspond to the top 8 bits of
 274.133 + * the 15 bit distances.
 274.134 + */
 274.135 +
 274.136 +uch _length_code[MAX_MATCH-MIN_MATCH+1];
 274.137 +/* length code for each normalized match length (0 == MIN_MATCH) */
 274.138 +
 274.139 +local int base_length[LENGTH_CODES];
 274.140 +/* First normalized length for each code (0 = MIN_MATCH) */
 274.141 +
 274.142 +local int base_dist[D_CODES];
 274.143 +/* First normalized distance for each code (0 = distance of 1) */
 274.144 +
 274.145 +#else
 274.146 +#  include "trees.h"
 274.147 +#endif /* GEN_TREES_H */
 274.148 +
 274.149 +struct static_tree_desc_s {
 274.150 +    const ct_data *static_tree;  /* static tree or NULL */
 274.151 +    const intf *extra_bits;      /* extra bits for each code or NULL */
 274.152 +    int     extra_base;          /* base index for extra_bits */
 274.153 +    int     elems;               /* max number of elements in the tree */
 274.154 +    int     max_length;          /* max bit length for the codes */
 274.155 +};
 274.156 +
 274.157 +local static_tree_desc  static_l_desc =
 274.158 +{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS};
 274.159 +
 274.160 +local static_tree_desc  static_d_desc =
 274.161 +{static_dtree, extra_dbits, 0,          D_CODES, MAX_BITS};
 274.162 +
 274.163 +local static_tree_desc  static_bl_desc =
 274.164 +{(const ct_data *)0, extra_blbits, 0,   BL_CODES, MAX_BL_BITS};
 274.165 +
 274.166 +/* ===========================================================================
 274.167 + * Local (static) routines in this file.
 274.168 + */
 274.169 +
 274.170 +local void tr_static_init OF((void));
 274.171 +local void init_block     OF((deflate_state *s));
 274.172 +local void pqdownheap     OF((deflate_state *s, ct_data *tree, int k));
 274.173 +local void gen_bitlen     OF((deflate_state *s, tree_desc *desc));
 274.174 +local void gen_codes      OF((ct_data *tree, int max_code, ushf *bl_count));
 274.175 +local void build_tree     OF((deflate_state *s, tree_desc *desc));
 274.176 +local void scan_tree      OF((deflate_state *s, ct_data *tree, int max_code));
 274.177 +local void send_tree      OF((deflate_state *s, ct_data *tree, int max_code));
 274.178 +local int  build_bl_tree  OF((deflate_state *s));
 274.179 +local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
 274.180 +                              int blcodes));
 274.181 +local void compress_block OF((deflate_state *s, ct_data *ltree,
 274.182 +                              ct_data *dtree));
 274.183 +local int  detect_data_type OF((deflate_state *s));
 274.184 +local unsigned bi_reverse OF((unsigned value, int length));
 274.185 +local void bi_windup      OF((deflate_state *s));
 274.186 +local void bi_flush       OF((deflate_state *s));
 274.187 +local void copy_block     OF((deflate_state *s, charf *buf, unsigned len,
 274.188 +                              int header));
 274.189 +
 274.190 +#ifdef GEN_TREES_H
 274.191 +local void gen_trees_header OF((void));
 274.192 +#endif
 274.193 +
 274.194 +#ifndef DEBUG
 274.195 +#  define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
 274.196 +   /* Send a code of the given tree. c and tree must not have side effects */
 274.197 +
 274.198 +#else /* DEBUG */
 274.199 +#  define send_code(s, c, tree) \
 274.200 +     { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \
 274.201 +       send_bits(s, tree[c].Code, tree[c].Len); }
 274.202 +#endif
 274.203 +
 274.204 +/* ===========================================================================
 274.205 + * Output a short LSB first on the stream.
 274.206 + * IN assertion: there is enough room in pendingBuf.
 274.207 + */
 274.208 +#define put_short(s, w) { \
 274.209 +    put_byte(s, (uch)((w) & 0xff)); \
 274.210 +    put_byte(s, (uch)((ush)(w) >> 8)); \
 274.211 +}
 274.212 +
 274.213 +/* ===========================================================================
 274.214 + * Send a value on a given number of bits.
 274.215 + * IN assertion: length <= 16 and value fits in length bits.
 274.216 + */
 274.217 +#ifdef DEBUG
 274.218 +local void send_bits      OF((deflate_state *s, int value, int length));
 274.219 +
 274.220 +local void send_bits(s, value, length)
 274.221 +    deflate_state *s;
 274.222 +    int value;  /* value to send */
 274.223 +    int length; /* number of bits */
 274.224 +{
 274.225 +    Tracevv((stderr," l %2d v %4x ", length, value));
 274.226 +    Assert(length > 0 && length <= 15, "invalid length");
 274.227 +    s->bits_sent += (ulg)length;
 274.228 +
 274.229 +    /* If not enough room in bi_buf, use (valid) bits from bi_buf and
 274.230 +     * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))
 274.231 +     * unused bits in value.
 274.232 +     */
 274.233 +    if (s->bi_valid > (int)Buf_size - length) {
 274.234 +        s->bi_buf |= (ush)value << s->bi_valid;
 274.235 +        put_short(s, s->bi_buf);
 274.236 +        s->bi_buf = (ush)value >> (Buf_size - s->bi_valid);
 274.237 +        s->bi_valid += length - Buf_size;
 274.238 +    } else {
 274.239 +        s->bi_buf |= (ush)value << s->bi_valid;
 274.240 +        s->bi_valid += length;
 274.241 +    }
 274.242 +}
 274.243 +#else /* !DEBUG */
 274.244 +
 274.245 +#define send_bits(s, value, length) \
 274.246 +{ int len = length;\
 274.247 +  if (s->bi_valid > (int)Buf_size - len) {\
 274.248 +    int val = value;\
 274.249 +    s->bi_buf |= (ush)val << s->bi_valid;\
 274.250 +    put_short(s, s->bi_buf);\
 274.251 +    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
 274.252 +    s->bi_valid += len - Buf_size;\
 274.253 +  } else {\
 274.254 +    s->bi_buf |= (ush)(value) << s->bi_valid;\
 274.255 +    s->bi_valid += len;\
 274.256 +  }\
 274.257 +}
 274.258 +#endif /* DEBUG */
 274.259 +
 274.260 +
 274.261 +/* the arguments must not have side effects */
 274.262 +
 274.263 +/* ===========================================================================
 274.264 + * Initialize the various 'constant' tables.
 274.265 + */
 274.266 +local void tr_static_init()
 274.267 +{
 274.268 +#if defined(GEN_TREES_H) || !defined(STDC)
 274.269 +    static int static_init_done = 0;
 274.270 +    int n;        /* iterates over tree elements */
 274.271 +    int bits;     /* bit counter */
 274.272 +    int length;   /* length value */
 274.273 +    int code;     /* code value */
 274.274 +    int dist;     /* distance index */
 274.275 +    ush bl_count[MAX_BITS+1];
 274.276 +    /* number of codes at each bit length for an optimal tree */
 274.277 +
 274.278 +    if (static_init_done) return;
 274.279 +
 274.280 +    /* For some embedded targets, global variables are not initialized: */
 274.281 +#ifdef NO_INIT_GLOBAL_POINTERS
 274.282 +    static_l_desc.static_tree = static_ltree;
 274.283 +    static_l_desc.extra_bits = extra_lbits;
 274.284 +    static_d_desc.static_tree = static_dtree;
 274.285 +    static_d_desc.extra_bits = extra_dbits;
 274.286 +    static_bl_desc.extra_bits = extra_blbits;
 274.287 +#endif
 274.288 +
 274.289 +    /* Initialize the mapping length (0..255) -> length code (0..28) */
 274.290 +    length = 0;
 274.291 +    for (code = 0; code < LENGTH_CODES-1; code++) {
 274.292 +        base_length[code] = length;
 274.293 +        for (n = 0; n < (1<<extra_lbits[code]); n++) {
 274.294 +            _length_code[length++] = (uch)code;
 274.295 +        }
 274.296 +    }
 274.297 +    Assert (length == 256, "tr_static_init: length != 256");
 274.298 +    /* Note that the length 255 (match length 258) can be represented
 274.299 +     * in two different ways: code 284 + 5 bits or code 285, so we
 274.300 +     * overwrite length_code[255] to use the best encoding:
 274.301 +     */
 274.302 +    _length_code[length-1] = (uch)code;
 274.303 +
 274.304 +    /* Initialize the mapping dist (0..32K) -> dist code (0..29) */
 274.305 +    dist = 0;
 274.306 +    for (code = 0 ; code < 16; code++) {
 274.307 +        base_dist[code] = dist;
 274.308 +        for (n = 0; n < (1<<extra_dbits[code]); n++) {
 274.309 +            _dist_code[dist++] = (uch)code;
 274.310 +        }
 274.311 +    }
 274.312 +    Assert (dist == 256, "tr_static_init: dist != 256");
 274.313 +    dist >>= 7; /* from now on, all distances are divided by 128 */
 274.314 +    for ( ; code < D_CODES; code++) {
 274.315 +        base_dist[code] = dist << 7;
 274.316 +        for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
 274.317 +            _dist_code[256 + dist++] = (uch)code;
 274.318 +        }
 274.319 +    }
 274.320 +    Assert (dist == 256, "tr_static_init: 256+dist != 512");
 274.321 +
 274.322 +    /* Construct the codes of the static literal tree */
 274.323 +    for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
 274.324 +    n = 0;
 274.325 +    while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++;
 274.326 +    while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++;
 274.327 +    while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++;
 274.328 +    while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++;
 274.329 +    /* Codes 286 and 287 do not exist, but we must include them in the
 274.330 +     * tree construction to get a canonical Huffman tree (longest code
 274.331 +     * all ones)
 274.332 +     */
 274.333 +    gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count);
 274.334 +
 274.335 +    /* The static distance tree is trivial: */
 274.336 +    for (n = 0; n < D_CODES; n++) {
 274.337 +        static_dtree[n].Len = 5;
 274.338 +        static_dtree[n].Code = bi_reverse((unsigned)n, 5);
 274.339 +    }
 274.340 +    static_init_done = 1;
 274.341 +
 274.342 +#  ifdef GEN_TREES_H
 274.343 +    gen_trees_header();
 274.344 +#  endif
 274.345 +#endif /* defined(GEN_TREES_H) || !defined(STDC) */
 274.346 +}
 274.347 +
 274.348 +/* ===========================================================================
 274.349 + * Genererate the file trees.h describing the static trees.
 274.350 + */
 274.351 +#ifdef GEN_TREES_H
 274.352 +#  ifndef DEBUG
 274.353 +#    include <stdio.h>
 274.354 +#  endif
 274.355 +
 274.356 +#  define SEPARATOR(i, last, width) \
 274.357 +      ((i) == (last)? "\n};\n\n" :    \
 274.358 +       ((i) % (width) == (width)-1 ? ",\n" : ", "))
 274.359 +
 274.360 +void gen_trees_header()
 274.361 +{
 274.362 +    FILE *header = fopen("trees.h", "w");
 274.363 +    int i;
 274.364 +
 274.365 +    Assert (header != NULL, "Can't open trees.h");
 274.366 +    fprintf(header,
 274.367 +            "/* header created automatically with -DGEN_TREES_H */\n\n");
 274.368 +
 274.369 +    fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n");
 274.370 +    for (i = 0; i < L_CODES+2; i++) {
 274.371 +        fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code,
 274.372 +                static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5));
 274.373 +    }
 274.374 +
 274.375 +    fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n");
 274.376 +    for (i = 0; i < D_CODES; i++) {
 274.377 +        fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code,
 274.378 +                static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5));
 274.379 +    }
 274.380 +
 274.381 +    fprintf(header, "const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\n");
 274.382 +    for (i = 0; i < DIST_CODE_LEN; i++) {
 274.383 +        fprintf(header, "%2u%s", _dist_code[i],
 274.384 +                SEPARATOR(i, DIST_CODE_LEN-1, 20));
 274.385 +    }
 274.386 +
 274.387 +    fprintf(header,
 274.388 +        "const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {\n");
 274.389 +    for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) {
 274.390 +        fprintf(header, "%2u%s", _length_code[i],
 274.391 +                SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20));
 274.392 +    }
 274.393 +
 274.394 +    fprintf(header, "local const int base_length[LENGTH_CODES] = {\n");
 274.395 +    for (i = 0; i < LENGTH_CODES; i++) {
 274.396 +        fprintf(header, "%1u%s", base_length[i],
 274.397 +                SEPARATOR(i, LENGTH_CODES-1, 20));
 274.398 +    }
 274.399 +
 274.400 +    fprintf(header, "local const int base_dist[D_CODES] = {\n");
 274.401 +    for (i = 0; i < D_CODES; i++) {
 274.402 +        fprintf(header, "%5u%s", base_dist[i],
 274.403 +                SEPARATOR(i, D_CODES-1, 10));
 274.404 +    }
 274.405 +
 274.406 +    fclose(header);
 274.407 +}
 274.408 +#endif /* GEN_TREES_H */
 274.409 +
 274.410 +/* ===========================================================================
 274.411 + * Initialize the tree data structures for a new zlib stream.
 274.412 + */
 274.413 +void ZLIB_INTERNAL _tr_init(s)
 274.414 +    deflate_state *s;
 274.415 +{
 274.416 +    tr_static_init();
 274.417 +
 274.418 +    s->l_desc.dyn_tree = s->dyn_ltree;
 274.419 +    s->l_desc.stat_desc = &static_l_desc;
 274.420 +
 274.421 +    s->d_desc.dyn_tree = s->dyn_dtree;
 274.422 +    s->d_desc.stat_desc = &static_d_desc;
 274.423 +
 274.424 +    s->bl_desc.dyn_tree = s->bl_tree;
 274.425 +    s->bl_desc.stat_desc = &static_bl_desc;
 274.426 +
 274.427 +    s->bi_buf = 0;
 274.428 +    s->bi_valid = 0;
 274.429 +    s->last_eob_len = 8; /* enough lookahead for inflate */
 274.430 +#ifdef DEBUG
 274.431 +    s->compressed_len = 0L;
 274.432 +    s->bits_sent = 0L;
 274.433 +#endif
 274.434 +
 274.435 +    /* Initialize the first block of the first file: */
 274.436 +    init_block(s);
 274.437 +}
 274.438 +
 274.439 +/* ===========================================================================
 274.440 + * Initialize a new block.
 274.441 + */
 274.442 +local void init_block(s)
 274.443 +    deflate_state *s;
 274.444 +{
 274.445 +    int n; /* iterates over tree elements */
 274.446 +
 274.447 +    /* Initialize the trees. */
 274.448 +    for (n = 0; n < L_CODES;  n++) s->dyn_ltree[n].Freq = 0;
 274.449 +    for (n = 0; n < D_CODES;  n++) s->dyn_dtree[n].Freq = 0;
 274.450 +    for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
 274.451 +
 274.452 +    s->dyn_ltree[END_BLOCK].Freq = 1;
 274.453 +    s->opt_len = s->static_len = 0L;
 274.454 +    s->last_lit = s->matches = 0;
 274.455 +}
 274.456 +
 274.457 +#define SMALLEST 1
 274.458 +/* Index within the heap array of least frequent node in the Huffman tree */
 274.459 +
 274.460 +
 274.461 +/* ===========================================================================
 274.462 + * Remove the smallest element from the heap and recreate the heap with
 274.463 + * one less element. Updates heap and heap_len.
 274.464 + */
 274.465 +#define pqremove(s, tree, top) \
 274.466 +{\
 274.467 +    top = s->heap[SMALLEST]; \
 274.468 +    s->heap[SMALLEST] = s->heap[s->heap_len--]; \
 274.469 +    pqdownheap(s, tree, SMALLEST); \
 274.470 +}
 274.471 +
 274.472 +/* ===========================================================================
 274.473 + * Compares to subtrees, using the tree depth as tie breaker when
 274.474 + * the subtrees have equal frequency. This minimizes the worst case length.
 274.475 + */
 274.476 +#define smaller(tree, n, m, depth) \
 274.477 +   (tree[n].Freq < tree[m].Freq || \
 274.478 +   (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
 274.479 +
 274.480 +/* ===========================================================================
 274.481 + * Restore the heap property by moving down the tree starting at node k,
 274.482 + * exchanging a node with the smallest of its two sons if necessary, stopping
 274.483 + * when the heap property is re-established (each father smaller than its
 274.484 + * two sons).
 274.485 + */
 274.486 +local void pqdownheap(s, tree, k)
 274.487 +    deflate_state *s;
 274.488 +    ct_data *tree;  /* the tree to restore */
 274.489 +    int k;               /* node to move down */
 274.490 +{
 274.491 +    int v = s->heap[k];
 274.492 +    int j = k << 1;  /* left son of k */
 274.493 +    while (j <= s->heap_len) {
 274.494 +        /* Set j to the smallest of the two sons: */
 274.495 +        if (j < s->heap_len &&
 274.496 +            smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
 274.497 +            j++;
 274.498 +        }
 274.499 +        /* Exit if v is smaller than both sons */
 274.500 +        if (smaller(tree, v, s->heap[j], s->depth)) break;
 274.501 +
 274.502 +        /* Exchange v with the smallest son */
 274.503 +        s->heap[k] = s->heap[j];  k = j;
 274.504 +
 274.505 +        /* And continue down the tree, setting j to the left son of k */
 274.506 +        j <<= 1;
 274.507 +    }
 274.508 +    s->heap[k] = v;
 274.509 +}
 274.510 +
 274.511 +/* ===========================================================================
 274.512 + * Compute the optimal bit lengths for a tree and update the total bit length
 274.513 + * for the current block.
 274.514 + * IN assertion: the fields freq and dad are set, heap[heap_max] and
 274.515 + *    above are the tree nodes sorted by increasing frequency.
 274.516 + * OUT assertions: the field len is set to the optimal bit length, the
 274.517 + *     array bl_count contains the frequencies for each bit length.
 274.518 + *     The length opt_len is updated; static_len is also updated if stree is
 274.519 + *     not null.
 274.520 + */
 274.521 +local void gen_bitlen(s, desc)
 274.522 +    deflate_state *s;
 274.523 +    tree_desc *desc;    /* the tree descriptor */
 274.524 +{
 274.525 +    ct_data *tree        = desc->dyn_tree;
 274.526 +    int max_code         = desc->max_code;
 274.527 +    const ct_data *stree = desc->stat_desc->static_tree;
 274.528 +    const intf *extra    = desc->stat_desc->extra_bits;
 274.529 +    int base             = desc->stat_desc->extra_base;
 274.530 +    int max_length       = desc->stat_desc->max_length;
 274.531 +    int h;              /* heap index */
 274.532 +    int n, m;           /* iterate over the tree elements */
 274.533 +    int bits;           /* bit length */
 274.534 +    int xbits;          /* extra bits */
 274.535 +    ush f;              /* frequency */
 274.536 +    int overflow = 0;   /* number of elements with bit length too large */
 274.537 +
 274.538 +    for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0;
 274.539 +
 274.540 +    /* In a first pass, compute the optimal bit lengths (which may
 274.541 +     * overflow in the case of the bit length tree).
 274.542 +     */
 274.543 +    tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */
 274.544 +
 274.545 +    for (h = s->heap_max+1; h < HEAP_SIZE; h++) {
 274.546 +        n = s->heap[h];
 274.547 +        bits = tree[tree[n].Dad].Len + 1;
 274.548 +        if (bits > max_length) bits = max_length, overflow++;
 274.549 +        tree[n].Len = (ush)bits;
 274.550 +        /* We overwrite tree[n].Dad which is no longer needed */
 274.551 +
 274.552 +        if (n > max_code) continue; /* not a leaf node */
 274.553 +
 274.554 +        s->bl_count[bits]++;
 274.555 +        xbits = 0;
 274.556 +        if (n >= base) xbits = extra[n-base];
 274.557 +        f = tree[n].Freq;
 274.558 +        s->opt_len += (ulg)f * (bits + xbits);
 274.559 +        if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits);
 274.560 +    }
 274.561 +    if (overflow == 0) return;
 274.562 +
 274.563 +    Trace((stderr,"\nbit length overflow\n"));
 274.564 +    /* This happens for example on obj2 and pic of the Calgary corpus */
 274.565 +
 274.566 +    /* Find the first bit length which could increase: */
 274.567 +    do {
 274.568 +        bits = max_length-1;
 274.569 +        while (s->bl_count[bits] == 0) bits--;
 274.570 +        s->bl_count[bits]--;      /* move one leaf down the tree */
 274.571 +        s->bl_count[bits+1] += 2; /* move one overflow item as its brother */
 274.572 +        s->bl_count[max_length]--;
 274.573 +        /* The brother of the overflow item also moves one step up,
 274.574 +         * but this does not affect bl_count[max_length]
 274.575 +         */
 274.576 +        overflow -= 2;
 274.577 +    } while (overflow > 0);
 274.578 +
 274.579 +    /* Now recompute all bit lengths, scanning in increasing frequency.
 274.580 +     * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
 274.581 +     * lengths instead of fixing only the wrong ones. This idea is taken
 274.582 +     * from 'ar' written by Haruhiko Okumura.)
 274.583 +     */
 274.584 +    for (bits = max_length; bits != 0; bits--) {
 274.585 +        n = s->bl_count[bits];
 274.586 +        while (n != 0) {
 274.587 +            m = s->heap[--h];
 274.588 +            if (m > max_code) continue;
 274.589 +            if ((unsigned) tree[m].Len != (unsigned) bits) {
 274.590 +                Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
 274.591 +                s->opt_len += ((long)bits - (long)tree[m].Len)
 274.592 +                              *(long)tree[m].Freq;
 274.593 +                tree[m].Len = (ush)bits;
 274.594 +            }
 274.595 +            n--;
 274.596 +        }
 274.597 +    }
 274.598 +}
 274.599 +
 274.600 +/* ===========================================================================
 274.601 + * Generate the codes for a given tree and bit counts (which need not be
 274.602 + * optimal).
 274.603 + * IN assertion: the array bl_count contains the bit length statistics for
 274.604 + * the given tree and the field len is set for all tree elements.
 274.605 + * OUT assertion: the field code is set for all tree elements of non
 274.606 + *     zero code length.
 274.607 + */
 274.608 +local void gen_codes (tree, max_code, bl_count)
 274.609 +    ct_data *tree;             /* the tree to decorate */
 274.610 +    int max_code;              /* largest code with non zero frequency */
 274.611 +    ushf *bl_count;            /* number of codes at each bit length */
 274.612 +{
 274.613 +    ush next_code[MAX_BITS+1]; /* next code value for each bit length */
 274.614 +    ush code = 0;              /* running code value */
 274.615 +    int bits;                  /* bit index */
 274.616 +    int n;                     /* code index */
 274.617 +
 274.618 +    /* The distribution counts are first used to generate the code values
 274.619 +     * without bit reversal.
 274.620 +     */
 274.621 +    for (bits = 1; bits <= MAX_BITS; bits++) {
 274.622 +        next_code[bits] = code = (code + bl_count[bits-1]) << 1;
 274.623 +    }
 274.624 +    /* Check that the bit counts in bl_count are consistent. The last code
 274.625 +     * must be all ones.
 274.626 +     */
 274.627 +    Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
 274.628 +            "inconsistent bit counts");
 274.629 +    Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
 274.630 +
 274.631 +    for (n = 0;  n <= max_code; n++) {
 274.632 +        int len = tree[n].Len;
 274.633 +        if (len == 0) continue;
 274.634 +        /* Now reverse the bits */
 274.635 +        tree[n].Code = bi_reverse(next_code[len]++, len);
 274.636 +
 274.637 +        Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
 274.638 +             n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
 274.639 +    }
 274.640 +}
 274.641 +
 274.642 +/* ===========================================================================
 274.643 + * Construct one Huffman tree and assigns the code bit strings and lengths.
 274.644 + * Update the total bit length for the current block.
 274.645 + * IN assertion: the field freq is set for all tree elements.
 274.646 + * OUT assertions: the fields len and code are set to the optimal bit length
 274.647 + *     and corresponding code. The length opt_len is updated; static_len is
 274.648 + *     also updated if stree is not null. The field max_code is set.
 274.649 + */
 274.650 +local void build_tree(s, desc)
 274.651 +    deflate_state *s;
 274.652 +    tree_desc *desc; /* the tree descriptor */
 274.653 +{
 274.654 +    ct_data *tree         = desc->dyn_tree;
 274.655 +    const ct_data *stree  = desc->stat_desc->static_tree;
 274.656 +    int elems             = desc->stat_desc->elems;
 274.657 +    int n, m;          /* iterate over heap elements */
 274.658 +    int max_code = -1; /* largest code with non zero frequency */
 274.659 +    int node;          /* new node being created */
 274.660 +
 274.661 +    /* Construct the initial heap, with least frequent element in
 274.662 +     * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
 274.663 +     * heap[0] is not used.
 274.664 +     */
 274.665 +    s->heap_len = 0, s->heap_max = HEAP_SIZE;
 274.666 +
 274.667 +    for (n = 0; n < elems; n++) {
 274.668 +        if (tree[n].Freq != 0) {
 274.669 +            s->heap[++(s->heap_len)] = max_code = n;
 274.670 +            s->depth[n] = 0;
 274.671 +        } else {
 274.672 +            tree[n].Len = 0;
 274.673 +        }
 274.674 +    }
 274.675 +
 274.676 +    /* The pkzip format requires that at least one distance code exists,
 274.677 +     * and that at least one bit should be sent even if there is only one
 274.678 +     * possible code. So to avoid special checks later on we force at least
 274.679 +     * two codes of non zero frequency.
 274.680 +     */
 274.681 +    while (s->heap_len < 2) {
 274.682 +        node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0);
 274.683 +        tree[node].Freq = 1;
 274.684 +        s->depth[node] = 0;
 274.685 +        s->opt_len--; if (stree) s->static_len -= stree[node].Len;
 274.686 +        /* node is 0 or 1 so it does not have extra bits */
 274.687 +    }
 274.688 +    desc->max_code = max_code;
 274.689 +
 274.690 +    /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
 274.691 +     * establish sub-heaps of increasing lengths:
 274.692 +     */
 274.693 +    for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n);
 274.694 +
 274.695 +    /* Construct the Huffman tree by repeatedly combining the least two
 274.696 +     * frequent nodes.
 274.697 +     */
 274.698 +    node = elems;              /* next internal node of the tree */
 274.699 +    do {
 274.700 +        pqremove(s, tree, n);  /* n = node of least frequency */
 274.701 +        m = s->heap[SMALLEST]; /* m = node of next least frequency */
 274.702 +
 274.703 +        s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */
 274.704 +        s->heap[--(s->heap_max)] = m;
 274.705 +
 274.706 +        /* Create a new node father of n and m */
 274.707 +        tree[node].Freq = tree[n].Freq + tree[m].Freq;
 274.708 +        s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ?
 274.709 +                                s->depth[n] : s->depth[m]) + 1);
 274.710 +        tree[n].Dad = tree[m].Dad = (ush)node;
 274.711 +#ifdef DUMP_BL_TREE
 274.712 +        if (tree == s->bl_tree) {
 274.713 +            fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)",
 274.714 +                    node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq);
 274.715 +        }
 274.716 +#endif
 274.717 +        /* and insert the new node in the heap */
 274.718 +        s->heap[SMALLEST] = node++;
 274.719 +        pqdownheap(s, tree, SMALLEST);
 274.720 +
 274.721 +    } while (s->heap_len >= 2);
 274.722 +
 274.723 +    s->heap[--(s->heap_max)] = s->heap[SMALLEST];
 274.724 +
 274.725 +    /* At this point, the fields freq and dad are set. We can now
 274.726 +     * generate the bit lengths.
 274.727 +     */
 274.728 +    gen_bitlen(s, (tree_desc *)desc);
 274.729 +
 274.730 +    /* The field len is now set, we can generate the bit codes */
 274.731 +    gen_codes ((ct_data *)tree, max_code, s->bl_count);
 274.732 +}
 274.733 +
 274.734 +/* ===========================================================================
 274.735 + * Scan a literal or distance tree to determine the frequencies of the codes
 274.736 + * in the bit length tree.
 274.737 + */
 274.738 +local void scan_tree (s, tree, max_code)
 274.739 +    deflate_state *s;
 274.740 +    ct_data *tree;   /* the tree to be scanned */
 274.741 +    int max_code;    /* and its largest code of non zero frequency */
 274.742 +{
 274.743 +    int n;                     /* iterates over all tree elements */
 274.744 +    int prevlen = -1;          /* last emitted length */
 274.745 +    int curlen;                /* length of current code */
 274.746 +    int nextlen = tree[0].Len; /* length of next code */
 274.747 +    int count = 0;             /* repeat count of the current code */
 274.748 +    int max_count = 7;         /* max repeat count */
 274.749 +    int min_count = 4;         /* min repeat count */
 274.750 +
 274.751 +    if (nextlen == 0) max_count = 138, min_count = 3;
 274.752 +    tree[max_code+1].Len = (ush)0xffff; /* guard */
 274.753 +
 274.754 +    for (n = 0; n <= max_code; n++) {
 274.755 +        curlen = nextlen; nextlen = tree[n+1].Len;
 274.756 +        if (++count < max_count && curlen == nextlen) {
 274.757 +            continue;
 274.758 +        } else if (count < min_count) {
 274.759 +            s->bl_tree[curlen].Freq += count;
 274.760 +        } else if (curlen != 0) {
 274.761 +            if (curlen != prevlen) s->bl_tree[curlen].Freq++;
 274.762 +            s->bl_tree[REP_3_6].Freq++;
 274.763 +        } else if (count <= 10) {
 274.764 +            s->bl_tree[REPZ_3_10].Freq++;
 274.765 +        } else {
 274.766 +            s->bl_tree[REPZ_11_138].Freq++;
 274.767 +        }
 274.768 +        count = 0; prevlen = curlen;
 274.769 +        if (nextlen == 0) {
 274.770 +            max_count = 138, min_count = 3;
 274.771 +        } else if (curlen == nextlen) {
 274.772 +            max_count = 6, min_count = 3;
 274.773 +        } else {
 274.774 +            max_count = 7, min_count = 4;
 274.775 +        }
 274.776 +    }
 274.777 +}
 274.778 +
 274.779 +/* ===========================================================================
 274.780 + * Send a literal or distance tree in compressed form, using the codes in
 274.781 + * bl_tree.
 274.782 + */
 274.783 +local void send_tree (s, tree, max_code)
 274.784 +    deflate_state *s;
 274.785 +    ct_data *tree; /* the tree to be scanned */
 274.786 +    int max_code;       /* and its largest code of non zero frequency */
 274.787 +{
 274.788 +    int n;                     /* iterates over all tree elements */
 274.789 +    int prevlen = -1;          /* last emitted length */
 274.790 +    int curlen;                /* length of current code */
 274.791 +    int nextlen = tree[0].Len; /* length of next code */
 274.792 +    int count = 0;             /* repeat count of the current code */
 274.793 +    int max_count = 7;         /* max repeat count */
 274.794 +    int min_count = 4;         /* min repeat count */
 274.795 +
 274.796 +    /* tree[max_code+1].Len = -1; */  /* guard already set */
 274.797 +    if (nextlen == 0) max_count = 138, min_count = 3;
 274.798 +
 274.799 +    for (n = 0; n <= max_code; n++) {
 274.800 +        curlen = nextlen; nextlen = tree[n+1].Len;
 274.801 +        if (++count < max_count && curlen == nextlen) {
 274.802 +            continue;
 274.803 +        } else if (count < min_count) {
 274.804 +            do { send_code(s, curlen, s->bl_tree); } while (--count != 0);
 274.805 +
 274.806 +        } else if (curlen != 0) {
 274.807 +            if (curlen != prevlen) {
 274.808 +                send_code(s, curlen, s->bl_tree); count--;
 274.809 +            }
 274.810 +            Assert(count >= 3 && count <= 6, " 3_6?");
 274.811 +            send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);
 274.812 +
 274.813 +        } else if (count <= 10) {
 274.814 +            send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);
 274.815 +
 274.816 +        } else {
 274.817 +            send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);
 274.818 +        }
 274.819 +        count = 0; prevlen = curlen;
 274.820 +        if (nextlen == 0) {
 274.821 +            max_count = 138, min_count = 3;
 274.822 +        } else if (curlen == nextlen) {
 274.823 +            max_count = 6, min_count = 3;
 274.824 +        } else {
 274.825 +            max_count = 7, min_count = 4;
 274.826 +        }
 274.827 +    }
 274.828 +}
 274.829 +
 274.830 +/* ===========================================================================
 274.831 + * Construct the Huffman tree for the bit lengths and return the index in
 274.832 + * bl_order of the last bit length code to send.
 274.833 + */
 274.834 +local int build_bl_tree(s)
 274.835 +    deflate_state *s;
 274.836 +{
 274.837 +    int max_blindex;  /* index of last bit length code of non zero freq */
 274.838 +
 274.839 +    /* Determine the bit length frequencies for literal and distance trees */
 274.840 +    scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code);
 274.841 +    scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code);
 274.842 +
 274.843 +    /* Build the bit length tree: */
 274.844 +    build_tree(s, (tree_desc *)(&(s->bl_desc)));
 274.845 +    /* opt_len now includes the length of the tree representations, except
 274.846 +     * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
 274.847 +     */
 274.848 +
 274.849 +    /* Determine the number of bit length codes to send. The pkzip format
 274.850 +     * requires that at least 4 bit length codes be sent. (appnote.txt says
 274.851 +     * 3 but the actual value used is 4.)
 274.852 +     */
 274.853 +    for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
 274.854 +        if (s->bl_tree[bl_order[max_blindex]].Len != 0) break;
 274.855 +    }
 274.856 +    /* Update opt_len to include the bit length tree and counts */
 274.857 +    s->opt_len += 3*(max_blindex+1) + 5+5+4;
 274.858 +    Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
 274.859 +            s->opt_len, s->static_len));
 274.860 +
 274.861 +    return max_blindex;
 274.862 +}
 274.863 +
 274.864 +/* ===========================================================================
 274.865 + * Send the header for a block using dynamic Huffman trees: the counts, the
 274.866 + * lengths of the bit length codes, the literal tree and the distance tree.
 274.867 + * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
 274.868 + */
 274.869 +local void send_all_trees(s, lcodes, dcodes, blcodes)
 274.870 +    deflate_state *s;
 274.871 +    int lcodes, dcodes, blcodes; /* number of codes for each tree */
 274.872 +{
 274.873 +    int rank;                    /* index in bl_order */
 274.874 +
 274.875 +    Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
 274.876 +    Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
 274.877 +            "too many codes");
 274.878 +    Tracev((stderr, "\nbl counts: "));
 274.879 +    send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */
 274.880 +    send_bits(s, dcodes-1,   5);
 274.881 +    send_bits(s, blcodes-4,  4); /* not -3 as stated in appnote.txt */
 274.882 +    for (rank = 0; rank < blcodes; rank++) {
 274.883 +        Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
 274.884 +        send_bits(s, s->bl_tree[bl_order[rank]].Len, 3);
 274.885 +    }
 274.886 +    Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
 274.887 +
 274.888 +    send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */
 274.889 +    Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent));
 274.890 +
 274.891 +    send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */
 274.892 +    Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
 274.893 +}
 274.894 +
 274.895 +/* ===========================================================================
 274.896 + * Send a stored block
 274.897 + */
 274.898 +void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)
 274.899 +    deflate_state *s;
 274.900 +    charf *buf;       /* input block */
 274.901 +    ulg stored_len;   /* length of input block */
 274.902 +    int last;         /* one if this is the last block for a file */
 274.903 +{
 274.904 +    send_bits(s, (STORED_BLOCK<<1)+last, 3);    /* send block type */
 274.905 +#ifdef DEBUG
 274.906 +    s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
 274.907 +    s->compressed_len += (stored_len + 4) << 3;
 274.908 +#endif
 274.909 +    copy_block(s, buf, (unsigned)stored_len, 1); /* with header */
 274.910 +}
 274.911 +
 274.912 +/* ===========================================================================
 274.913 + * Send one empty static block to give enough lookahead for inflate.
 274.914 + * This takes 10 bits, of which 7 may remain in the bit buffer.
 274.915 + * The current inflate code requires 9 bits of lookahead. If the
 274.916 + * last two codes for the previous block (real code plus EOB) were coded
 274.917 + * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode
 274.918 + * the last real code. In this case we send two empty static blocks instead
 274.919 + * of one. (There are no problems if the previous block is stored or fixed.)
 274.920 + * To simplify the code, we assume the worst case of last real code encoded
 274.921 + * on one bit only.
 274.922 + */
 274.923 +void ZLIB_INTERNAL _tr_align(s)
 274.924 +    deflate_state *s;
 274.925 +{
 274.926 +    send_bits(s, STATIC_TREES<<1, 3);
 274.927 +    send_code(s, END_BLOCK, static_ltree);
 274.928 +#ifdef DEBUG
 274.929 +    s->compressed_len += 10L; /* 3 for block type, 7 for EOB */
 274.930 +#endif
 274.931 +    bi_flush(s);
 274.932 +    /* Of the 10 bits for the empty block, we have already sent
 274.933 +     * (10 - bi_valid) bits. The lookahead for the last real code (before
 274.934 +     * the EOB of the previous block) was thus at least one plus the length
 274.935 +     * of the EOB plus what we have just sent of the empty static block.
 274.936 +     */
 274.937 +    if (1 + s->last_eob_len + 10 - s->bi_valid < 9) {
 274.938 +        send_bits(s, STATIC_TREES<<1, 3);
 274.939 +        send_code(s, END_BLOCK, static_ltree);
 274.940 +#ifdef DEBUG
 274.941 +        s->compressed_len += 10L;
 274.942 +#endif
 274.943 +        bi_flush(s);
 274.944 +    }
 274.945 +    s->last_eob_len = 7;
 274.946 +}
 274.947 +
 274.948 +/* ===========================================================================
 274.949 + * Determine the best encoding for the current block: dynamic trees, static
 274.950 + * trees or store, and output the encoded block to the zip file.
 274.951 + */
 274.952 +void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
 274.953 +    deflate_state *s;
 274.954 +    charf *buf;       /* input block, or NULL if too old */
 274.955 +    ulg stored_len;   /* length of input block */
 274.956 +    int last;         /* one if this is the last block for a file */
 274.957 +{
 274.958 +    ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
 274.959 +    int max_blindex = 0;  /* index of last bit length code of non zero freq */
 274.960 +
 274.961 +    /* Build the Huffman trees unless a stored block is forced */
 274.962 +    if (s->level > 0) {
 274.963 +
 274.964 +        /* Check if the file is binary or text */
 274.965 +        if (s->strm->data_type == Z_UNKNOWN)
 274.966 +            s->strm->data_type = detect_data_type(s);
 274.967 +
 274.968 +        /* Construct the literal and distance trees */
 274.969 +        build_tree(s, (tree_desc *)(&(s->l_desc)));
 274.970 +        Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len,
 274.971 +                s->static_len));
 274.972 +
 274.973 +        build_tree(s, (tree_desc *)(&(s->d_desc)));
 274.974 +        Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len,
 274.975 +                s->static_len));
 274.976 +        /* At this point, opt_len and static_len are the total bit lengths of
 274.977 +         * the compressed block data, excluding the tree representations.
 274.978 +         */
 274.979 +
 274.980 +        /* Build the bit length tree for the above two trees, and get the index
 274.981 +         * in bl_order of the last bit length code to send.
 274.982 +         */
 274.983 +        max_blindex = build_bl_tree(s);
 274.984 +
 274.985 +        /* Determine the best encoding. Compute the block lengths in bytes. */
 274.986 +        opt_lenb = (s->opt_len+3+7)>>3;
 274.987 +        static_lenb = (s->static_len+3+7)>>3;
 274.988 +
 274.989 +        Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
 274.990 +                opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
 274.991 +                s->last_lit));
 274.992 +
 274.993 +        if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
 274.994 +
 274.995 +    } else {
 274.996 +        Assert(buf != (char*)0, "lost buf");
 274.997 +        opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
 274.998 +    }
 274.999 +
274.1000 +#ifdef FORCE_STORED
274.1001 +    if (buf != (char*)0) { /* force stored block */
274.1002 +#else
274.1003 +    if (stored_len+4 <= opt_lenb && buf != (char*)0) {
274.1004 +                       /* 4: two words for the lengths */
274.1005 +#endif
274.1006 +        /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
274.1007 +         * Otherwise we can't have processed more than WSIZE input bytes since
274.1008 +         * the last block flush, because compression would have been
274.1009 +         * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
274.1010 +         * transform a block into a stored block.
274.1011 +         */
274.1012 +        _tr_stored_block(s, buf, stored_len, last);
274.1013 +
274.1014 +#ifdef FORCE_STATIC
274.1015 +    } else if (static_lenb >= 0) { /* force static trees */
274.1016 +#else
274.1017 +    } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) {
274.1018 +#endif
274.1019 +        send_bits(s, (STATIC_TREES<<1)+last, 3);
274.1020 +        compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree);
274.1021 +#ifdef DEBUG
274.1022 +        s->compressed_len += 3 + s->static_len;
274.1023 +#endif
274.1024 +    } else {
274.1025 +        send_bits(s, (DYN_TREES<<1)+last, 3);
274.1026 +        send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
274.1027 +                       max_blindex+1);
274.1028 +        compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree);
274.1029 +#ifdef DEBUG
274.1030 +        s->compressed_len += 3 + s->opt_len;
274.1031 +#endif
274.1032 +    }
274.1033 +    Assert (s->compressed_len == s->bits_sent, "bad compressed size");
274.1034 +    /* The above check is made mod 2^32, for files larger than 512 MB
274.1035 +     * and uLong implemented on 32 bits.
274.1036 +     */
274.1037 +    init_block(s);
274.1038 +
274.1039 +    if (last) {
274.1040 +        bi_windup(s);
274.1041 +#ifdef DEBUG
274.1042 +        s->compressed_len += 7;  /* align on byte boundary */
274.1043 +#endif
274.1044 +    }
274.1045 +    Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
274.1046 +           s->compressed_len-7*last));
274.1047 +}
274.1048 +
274.1049 +/* ===========================================================================
274.1050 + * Save the match info and tally the frequency counts. Return true if
274.1051 + * the current block must be flushed.
274.1052 + */
274.1053 +int ZLIB_INTERNAL _tr_tally (s, dist, lc)
274.1054 +    deflate_state *s;
274.1055 +    unsigned dist;  /* distance of matched string */
274.1056 +    unsigned lc;    /* match length-MIN_MATCH or unmatched char (if dist==0) */
274.1057 +{
274.1058 +    s->d_buf[s->last_lit] = (ush)dist;
274.1059 +    s->l_buf[s->last_lit++] = (uch)lc;
274.1060 +    if (dist == 0) {
274.1061 +        /* lc is the unmatched char */
274.1062 +        s->dyn_ltree[lc].Freq++;
274.1063 +    } else {
274.1064 +        s->matches++;
274.1065 +        /* Here, lc is the match length - MIN_MATCH */
274.1066 +        dist--;             /* dist = match distance - 1 */
274.1067 +        Assert((ush)dist < (ush)MAX_DIST(s) &&
274.1068 +               (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
274.1069 +               (ush)d_code(dist) < (ush)D_CODES,  "_tr_tally: bad match");
274.1070 +
274.1071 +        s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
274.1072 +        s->dyn_dtree[d_code(dist)].Freq++;
274.1073 +    }
274.1074 +
274.1075 +#ifdef TRUNCATE_BLOCK
274.1076 +    /* Try to guess if it is profitable to stop the current block here */
274.1077 +    if ((s->last_lit & 0x1fff) == 0 && s->level > 2) {
274.1078 +        /* Compute an upper bound for the compressed length */
274.1079 +        ulg out_length = (ulg)s->last_lit*8L;
274.1080 +        ulg in_length = (ulg)((long)s->strstart - s->block_start);
274.1081 +        int dcode;
274.1082 +        for (dcode = 0; dcode < D_CODES; dcode++) {
274.1083 +            out_length += (ulg)s->dyn_dtree[dcode].Freq *
274.1084 +                (5L+extra_dbits[dcode]);
274.1085 +        }
274.1086 +        out_length >>= 3;
274.1087 +        Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
274.1088 +               s->last_lit, in_length, out_length,
274.1089 +               100L - out_length*100L/in_length));
274.1090 +        if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1;
274.1091 +    }
274.1092 +#endif
274.1093 +    return (s->last_lit == s->lit_bufsize-1);
274.1094 +    /* We avoid equality with lit_bufsize because of wraparound at 64K
274.1095 +     * on 16 bit machines and because stored blocks are restricted to
274.1096 +     * 64K-1 bytes.
274.1097 +     */
274.1098 +}
274.1099 +
274.1100 +/* ===========================================================================
274.1101 + * Send the block data compressed using the given Huffman trees
274.1102 + */
274.1103 +local void compress_block(s, ltree, dtree)
274.1104 +    deflate_state *s;
274.1105 +    ct_data *ltree; /* literal tree */
274.1106 +    ct_data *dtree; /* distance tree */
274.1107 +{
274.1108 +    unsigned dist;      /* distance of matched string */
274.1109 +    int lc;             /* match length or unmatched char (if dist == 0) */
274.1110 +    unsigned lx = 0;    /* running index in l_buf */
274.1111 +    unsigned code;      /* the code to send */
274.1112 +    int extra;          /* number of extra bits to send */
274.1113 +
274.1114 +    if (s->last_lit != 0) do {
274.1115 +        dist = s->d_buf[lx];
274.1116 +        lc = s->l_buf[lx++];
274.1117 +        if (dist == 0) {
274.1118 +            send_code(s, lc, ltree); /* send a literal byte */
274.1119 +            Tracecv(isgraph(lc), (stderr," '%c' ", lc));
274.1120 +        } else {
274.1121 +            /* Here, lc is the match length - MIN_MATCH */
274.1122 +            code = _length_code[lc];
274.1123 +            send_code(s, code+LITERALS+1, ltree); /* send the length code */
274.1124 +            extra = extra_lbits[code];
274.1125 +            if (extra != 0) {
274.1126 +                lc -= base_length[code];
274.1127 +                send_bits(s, lc, extra);       /* send the extra length bits */
274.1128 +            }
274.1129 +            dist--; /* dist is now the match distance - 1 */
274.1130 +            code = d_code(dist);
274.1131 +            Assert (code < D_CODES, "bad d_code");
274.1132 +
274.1133 +            send_code(s, code, dtree);       /* send the distance code */
274.1134 +            extra = extra_dbits[code];
274.1135 +            if (extra != 0) {
274.1136 +                dist -= base_dist[code];
274.1137 +                send_bits(s, dist, extra);   /* send the extra distance bits */
274.1138 +            }
274.1139 +        } /* literal or match pair ? */
274.1140 +
274.1141 +        /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
274.1142 +        Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
274.1143 +               "pendingBuf overflow");
274.1144 +
274.1145 +    } while (lx < s->last_lit);
274.1146 +
274.1147 +    send_code(s, END_BLOCK, ltree);
274.1148 +    s->last_eob_len = ltree[END_BLOCK].Len;
274.1149 +}
274.1150 +
274.1151 +/* ===========================================================================
274.1152 + * Check if the data type is TEXT or BINARY, using the following algorithm:
274.1153 + * - TEXT if the two conditions below are satisfied:
274.1154 + *    a) There are no non-portable control characters belonging to the
274.1155 + *       "black list" (0..6, 14..25, 28..31).
274.1156 + *    b) There is at least one printable character belonging to the
274.1157 + *       "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).
274.1158 + * - BINARY otherwise.
274.1159 + * - The following partially-portable control characters form a
274.1160 + *   "gray list" that is ignored in this detection algorithm:
274.1161 + *   (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).
274.1162 + * IN assertion: the fields Freq of dyn_ltree are set.
274.1163 + */
274.1164 +local int detect_data_type(s)
274.1165 +    deflate_state *s;
274.1166 +{
274.1167 +    /* black_mask is the bit mask of black-listed bytes
274.1168 +     * set bits 0..6, 14..25, and 28..31
274.1169 +     * 0xf3ffc07f = binary 11110011111111111100000001111111
274.1170 +     */
274.1171 +    unsigned long black_mask = 0xf3ffc07fUL;
274.1172 +    int n;
274.1173 +
274.1174 +    /* Check for non-textual ("black-listed") bytes. */
274.1175 +    for (n = 0; n <= 31; n++, black_mask >>= 1)
274.1176 +        if ((black_mask & 1) && (s->dyn_ltree[n].Freq != 0))
274.1177 +            return Z_BINARY;
274.1178 +
274.1179 +    /* Check for textual ("white-listed") bytes. */
274.1180 +    if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0
274.1181 +            || s->dyn_ltree[13].Freq != 0)
274.1182 +        return Z_TEXT;
274.1183 +    for (n = 32; n < LITERALS; n++)
274.1184 +        if (s->dyn_ltree[n].Freq != 0)
274.1185 +            return Z_TEXT;
274.1186 +
274.1187 +    /* There are no "black-listed" or "white-listed" bytes:
274.1188 +     * this stream either is empty or has tolerated ("gray-listed") bytes only.
274.1189 +     */
274.1190 +    return Z_BINARY;
274.1191 +}
274.1192 +
274.1193 +/* ===========================================================================
274.1194 + * Reverse the first len bits of a code, using straightforward code (a faster
274.1195 + * method would use a table)
274.1196 + * IN assertion: 1 <= len <= 15
274.1197 + */
274.1198 +local unsigned bi_reverse(code, len)
274.1199 +    unsigned code; /* the value to invert */
274.1200 +    int len;       /* its bit length */
274.1201 +{
274.1202 +    register unsigned res = 0;
274.1203 +    do {
274.1204 +        res |= code & 1;
274.1205 +        code >>= 1, res <<= 1;
274.1206 +    } while (--len > 0);
274.1207 +    return res >> 1;
274.1208 +}
274.1209 +
274.1210 +/* ===========================================================================
274.1211 + * Flush the bit buffer, keeping at most 7 bits in it.
274.1212 + */
274.1213 +local void bi_flush(s)
274.1214 +    deflate_state *s;
274.1215 +{
274.1216 +    if (s->bi_valid == 16) {
274.1217 +        put_short(s, s->bi_buf);
274.1218 +        s->bi_buf = 0;
274.1219 +        s->bi_valid = 0;
274.1220 +    } else if (s->bi_valid >= 8) {
274.1221 +        put_byte(s, (Byte)s->bi_buf);
274.1222 +        s->bi_buf >>= 8;
274.1223 +        s->bi_valid -= 8;
274.1224 +    }
274.1225 +}
274.1226 +
274.1227 +/* ===========================================================================
274.1228 + * Flush the bit buffer and align the output on a byte boundary
274.1229 + */
274.1230 +local void bi_windup(s)
274.1231 +    deflate_state *s;
274.1232 +{
274.1233 +    if (s->bi_valid > 8) {
274.1234 +        put_short(s, s->bi_buf);
274.1235 +    } else if (s->bi_valid > 0) {
274.1236 +        put_byte(s, (Byte)s->bi_buf);
274.1237 +    }
274.1238 +    s->bi_buf = 0;
274.1239 +    s->bi_valid = 0;
274.1240 +#ifdef DEBUG
274.1241 +    s->bits_sent = (s->bits_sent+7) & ~7;
274.1242 +#endif
274.1243 +}
274.1244 +
274.1245 +/* ===========================================================================
274.1246 + * Copy a stored block, storing first the length and its
274.1247 + * one's complement if requested.
274.1248 + */
274.1249 +local void copy_block(s, buf, len, header)
274.1250 +    deflate_state *s;
274.1251 +    charf    *buf;    /* the input data */
274.1252 +    unsigned len;     /* its length */
274.1253 +    int      header;  /* true if block header must be written */
274.1254 +{
274.1255 +    bi_windup(s);        /* align on byte boundary */
274.1256 +    s->last_eob_len = 8; /* enough lookahead for inflate */
274.1257 +
274.1258 +    if (header) {
274.1259 +        put_short(s, (ush)len);
274.1260 +        put_short(s, (ush)~len);
274.1261 +#ifdef DEBUG
274.1262 +        s->bits_sent += 2*16;
274.1263 +#endif
274.1264 +    }
274.1265 +#ifdef DEBUG
274.1266 +    s->bits_sent += (ulg)len<<3;
274.1267 +#endif
274.1268 +    while (len--) {
274.1269 +        put_byte(s, *buf++);
274.1270 +    }
274.1271 +}
   275.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   275.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/trees.h	Mon Dec 19 10:06:23 2011 -0800
   275.3 @@ -0,0 +1,152 @@
   275.4 +/*
   275.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   275.6 + *
   275.7 + * This code is free software; you can redistribute it and/or modify it
   275.8 + * under the terms of the GNU General Public License version 2 only, as
   275.9 + * published by the Free Software Foundation.  Oracle designates this
  275.10 + * particular file as subject to the "Classpath" exception as provided
  275.11 + * by Oracle in the LICENSE file that accompanied this code.
  275.12 + *
  275.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
  275.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  275.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  275.16 + * version 2 for more details (a copy is included in the LICENSE file that
  275.17 + * accompanied this code).
  275.18 + *
  275.19 + * You should have received a copy of the GNU General Public License version
  275.20 + * 2 along with this work; if not, write to the Free Software Foundation,
  275.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  275.22 + *
  275.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  275.24 + * or visit www.oracle.com if you need additional information or have any
  275.25 + * questions.
  275.26 + */
  275.27 +
  275.28 +/* header created automatically with -DGEN_TREES_H */
  275.29 +
  275.30 +local const ct_data static_ltree[L_CODES+2] = {
  275.31 +{{ 12},{  8}}, {{140},{  8}}, {{ 76},{  8}}, {{204},{  8}}, {{ 44},{  8}},
  275.32 +{{172},{  8}}, {{108},{  8}}, {{236},{  8}}, {{ 28},{  8}}, {{156},{  8}},
  275.33 +{{ 92},{  8}}, {{220},{  8}}, {{ 60},{  8}}, {{188},{  8}}, {{124},{  8}},
  275.34 +{{252},{  8}}, {{  2},{  8}}, {{130},{  8}}, {{ 66},{  8}}, {{194},{  8}},
  275.35 +{{ 34},{  8}}, {{162},{  8}}, {{ 98},{  8}}, {{226},{  8}}, {{ 18},{  8}},
  275.36 +{{146},{  8}}, {{ 82},{  8}}, {{210},{  8}}, {{ 50},{  8}}, {{178},{  8}},
  275.37 +{{114},{  8}}, {{242},{  8}}, {{ 10},{  8}}, {{138},{  8}}, {{ 74},{  8}},
  275.38 +{{202},{  8}}, {{ 42},{  8}}, {{170},{  8}}, {{106},{  8}}, {{234},{  8}},
  275.39 +{{ 26},{  8}}, {{154},{  8}}, {{ 90},{  8}}, {{218},{  8}}, {{ 58},{  8}},
  275.40 +{{186},{  8}}, {{122},{  8}}, {{250},{  8}}, {{  6},{  8}}, {{134},{  8}},
  275.41 +{{ 70},{  8}}, {{198},{  8}}, {{ 38},{  8}}, {{166},{  8}}, {{102},{  8}},
  275.42 +{{230},{  8}}, {{ 22},{  8}}, {{150},{  8}}, {{ 86},{  8}}, {{214},{  8}},
  275.43 +{{ 54},{  8}}, {{182},{  8}}, {{118},{  8}}, {{246},{  8}}, {{ 14},{  8}},
  275.44 +{{142},{  8}}, {{ 78},{  8}}, {{206},{  8}}, {{ 46},{  8}}, {{174},{  8}},
  275.45 +{{110},{  8}}, {{238},{  8}}, {{ 30},{  8}}, {{158},{  8}}, {{ 94},{  8}},
  275.46 +{{222},{  8}}, {{ 62},{  8}}, {{190},{  8}}, {{126},{  8}}, {{254},{  8}},
  275.47 +{{  1},{  8}}, {{129},{  8}}, {{ 65},{  8}}, {{193},{  8}}, {{ 33},{  8}},
  275.48 +{{161},{  8}}, {{ 97},{  8}}, {{225},{  8}}, {{ 17},{  8}}, {{145},{  8}},
  275.49 +{{ 81},{  8}}, {{209},{  8}}, {{ 49},{  8}}, {{177},{  8}}, {{113},{  8}},
  275.50 +{{241},{  8}}, {{  9},{  8}}, {{137},{  8}}, {{ 73},{  8}}, {{201},{  8}},
  275.51 +{{ 41},{  8}}, {{169},{  8}}, {{105},{  8}}, {{233},{  8}}, {{ 25},{  8}},
  275.52 +{{153},{  8}}, {{ 89},{  8}}, {{217},{  8}}, {{ 57},{  8}}, {{185},{  8}},
  275.53 +{{121},{  8}}, {{249},{  8}}, {{  5},{  8}}, {{133},{  8}}, {{ 69},{  8}},
  275.54 +{{197},{  8}}, {{ 37},{  8}}, {{165},{  8}}, {{101},{  8}}, {{229},{  8}},
  275.55 +{{ 21},{  8}}, {{149},{  8}}, {{ 85},{  8}}, {{213},{  8}}, {{ 53},{  8}},
  275.56 +{{181},{  8}}, {{117},{  8}}, {{245},{  8}}, {{ 13},{  8}}, {{141},{  8}},
  275.57 +{{ 77},{  8}}, {{205},{  8}}, {{ 45},{  8}}, {{173},{  8}}, {{109},{  8}},
  275.58 +{{237},{  8}}, {{ 29},{  8}}, {{157},{  8}}, {{ 93},{  8}}, {{221},{  8}},
  275.59 +{{ 61},{  8}}, {{189},{  8}}, {{125},{  8}}, {{253},{  8}}, {{ 19},{  9}},
  275.60 +{{275},{  9}}, {{147},{  9}}, {{403},{  9}}, {{ 83},{  9}}, {{339},{  9}},
  275.61 +{{211},{  9}}, {{467},{  9}}, {{ 51},{  9}}, {{307},{  9}}, {{179},{  9}},
  275.62 +{{435},{  9}}, {{115},{  9}}, {{371},{  9}}, {{243},{  9}}, {{499},{  9}},
  275.63 +{{ 11},{  9}}, {{267},{  9}}, {{139},{  9}}, {{395},{  9}}, {{ 75},{  9}},
  275.64 +{{331},{  9}}, {{203},{  9}}, {{459},{  9}}, {{ 43},{  9}}, {{299},{  9}},
  275.65 +{{171},{  9}}, {{427},{  9}}, {{107},{  9}}, {{363},{  9}}, {{235},{  9}},
  275.66 +{{491},{  9}}, {{ 27},{  9}}, {{283},{  9}}, {{155},{  9}}, {{411},{  9}},
  275.67 +{{ 91},{  9}}, {{347},{  9}}, {{219},{  9}}, {{475},{  9}}, {{ 59},{  9}},
  275.68 +{{315},{  9}}, {{187},{  9}}, {{443},{  9}}, {{123},{  9}}, {{379},{  9}},
  275.69 +{{251},{  9}}, {{507},{  9}}, {{  7},{  9}}, {{263},{  9}}, {{135},{  9}},
  275.70 +{{391},{  9}}, {{ 71},{  9}}, {{327},{  9}}, {{199},{  9}}, {{455},{  9}},
  275.71 +{{ 39},{  9}}, {{295},{  9}}, {{167},{  9}}, {{423},{  9}}, {{103},{  9}},
  275.72 +{{359},{  9}}, {{231},{  9}}, {{487},{  9}}, {{ 23},{  9}}, {{279},{  9}},
  275.73 +{{151},{  9}}, {{407},{  9}}, {{ 87},{  9}}, {{343},{  9}}, {{215},{  9}},
  275.74 +{{471},{  9}}, {{ 55},{  9}}, {{311},{  9}}, {{183},{  9}}, {{439},{  9}},
  275.75 +{{119},{  9}}, {{375},{  9}}, {{247},{  9}}, {{503},{  9}}, {{ 15},{  9}},
  275.76 +{{271},{  9}}, {{143},{  9}}, {{399},{  9}}, {{ 79},{  9}}, {{335},{  9}},
  275.77 +{{207},{  9}}, {{463},{  9}}, {{ 47},{  9}}, {{303},{  9}}, {{175},{  9}},
  275.78 +{{431},{  9}}, {{111},{  9}}, {{367},{  9}}, {{239},{  9}}, {{495},{  9}},
  275.79 +{{ 31},{  9}}, {{287},{  9}}, {{159},{  9}}, {{415},{  9}}, {{ 95},{  9}},
  275.80 +{{351},{  9}}, {{223},{  9}}, {{479},{  9}}, {{ 63},{  9}}, {{319},{  9}},
  275.81 +{{191},{  9}}, {{447},{  9}}, {{127},{  9}}, {{383},{  9}}, {{255},{  9}},
  275.82 +{{511},{  9}}, {{  0},{  7}}, {{ 64},{  7}}, {{ 32},{  7}}, {{ 96},{  7}},
  275.83 +{{ 16},{  7}}, {{ 80},{  7}}, {{ 48},{  7}}, {{112},{  7}}, {{  8},{  7}},
  275.84 +{{ 72},{  7}}, {{ 40},{  7}}, {{104},{  7}}, {{ 24},{  7}}, {{ 88},{  7}},
  275.85 +{{ 56},{  7}}, {{120},{  7}}, {{  4},{  7}}, {{ 68},{  7}}, {{ 36},{  7}},
  275.86 +{{100},{  7}}, {{ 20},{  7}}, {{ 84},{  7}}, {{ 52},{  7}}, {{116},{  7}},
  275.87 +{{  3},{  8}}, {{131},{  8}}, {{ 67},{  8}}, {{195},{  8}}, {{ 35},{  8}},
  275.88 +{{163},{  8}}, {{ 99},{  8}}, {{227},{  8}}
  275.89 +};
  275.90 +
  275.91 +local const ct_data static_dtree[D_CODES] = {
  275.92 +{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}},
  275.93 +{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}},
  275.94 +{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}},
  275.95 +{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}},
  275.96 +{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}},
  275.97 +{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}}
  275.98 +};
  275.99 +
 275.100 +const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {
 275.101 + 0,  1,  2,  3,  4,  4,  5,  5,  6,  6,  6,  6,  7,  7,  7,  7,  8,  8,  8,  8,
 275.102 + 8,  8,  8,  8,  9,  9,  9,  9,  9,  9,  9,  9, 10, 10, 10, 10, 10, 10, 10, 10,
 275.103 +10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
 275.104 +11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
 275.105 +12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13,
 275.106 +13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
 275.107 +13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
 275.108 +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
 275.109 +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
 275.110 +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15,
 275.111 +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
 275.112 +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
 275.113 +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,  0,  0, 16, 17,
 275.114 +18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22,
 275.115 +23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
 275.116 +24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
 275.117 +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
 275.118 +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27,
 275.119 +27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
 275.120 +27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
 275.121 +28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
 275.122 +28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
 275.123 +28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
 275.124 +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
 275.125 +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
 275.126 +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
 275.127 +};
 275.128 +
 275.129 +const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {
 275.130 + 0,  1,  2,  3,  4,  5,  6,  7,  8,  8,  9,  9, 10, 10, 11, 11, 12, 12, 12, 12,
 275.131 +13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
 275.132 +17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,
 275.133 +19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
 275.134 +21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22,
 275.135 +22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23,
 275.136 +23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
 275.137 +24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
 275.138 +25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
 275.139 +25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26,
 275.140 +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
 275.141 +26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
 275.142 +27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28
 275.143 +};
 275.144 +
 275.145 +local const int base_length[LENGTH_CODES] = {
 275.146 +0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56,
 275.147 +64, 80, 96, 112, 128, 160, 192, 224, 0
 275.148 +};
 275.149 +
 275.150 +local const int base_dist[D_CODES] = {
 275.151 +    0,     1,     2,     3,     4,     6,     8,    12,    16,    24,
 275.152 +   32,    48,    64,    96,   128,   192,   256,   384,   512,   768,
 275.153 + 1024,  1536,  2048,  3072,  4096,  6144,  8192, 12288, 16384, 24576
 275.154 +};
 275.155 +
   276.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   276.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/uncompr.c	Mon Dec 19 10:06:23 2011 -0800
   276.3 @@ -0,0 +1,83 @@
   276.4 +/*
   276.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   276.6 + *
   276.7 + * This code is free software; you can redistribute it and/or modify it
   276.8 + * under the terms of the GNU General Public License version 2 only, as
   276.9 + * published by the Free Software Foundation.  Oracle designates this
  276.10 + * particular file as subject to the "Classpath" exception as provided
  276.11 + * by Oracle in the LICENSE file that accompanied this code.
  276.12 + *
  276.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
  276.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  276.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  276.16 + * version 2 for more details (a copy is included in the LICENSE file that
  276.17 + * accompanied this code).
  276.18 + *
  276.19 + * You should have received a copy of the GNU General Public License version
  276.20 + * 2 along with this work; if not, write to the Free Software Foundation,
  276.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  276.22 + *
  276.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  276.24 + * or visit www.oracle.com if you need additional information or have any
  276.25 + * questions.
  276.26 + */
  276.27 +
  276.28 +/* uncompr.c -- decompress a memory buffer
  276.29 + * Copyright (C) 1995-2003, 2010 Jean-loup Gailly.
  276.30 + * For conditions of distribution and use, see copyright notice in zlib.h
  276.31 + */
  276.32 +
  276.33 +/* @(#) $Id$ */
  276.34 +
  276.35 +#define ZLIB_INTERNAL
  276.36 +#include "zlib.h"
  276.37 +
  276.38 +/* ===========================================================================
  276.39 +     Decompresses the source buffer into the destination buffer.  sourceLen is
  276.40 +   the byte length of the source buffer. Upon entry, destLen is the total
  276.41 +   size of the destination buffer, which must be large enough to hold the
  276.42 +   entire uncompressed data. (The size of the uncompressed data must have
  276.43 +   been saved previously by the compressor and transmitted to the decompressor
  276.44 +   by some mechanism outside the scope of this compression library.)
  276.45 +   Upon exit, destLen is the actual size of the compressed buffer.
  276.46 +
  276.47 +     uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
  276.48 +   enough memory, Z_BUF_ERROR if there was not enough room in the output
  276.49 +   buffer, or Z_DATA_ERROR if the input data was corrupted.
  276.50 +*/
  276.51 +int ZEXPORT uncompress (dest, destLen, source, sourceLen)
  276.52 +    Bytef *dest;
  276.53 +    uLongf *destLen;
  276.54 +    const Bytef *source;
  276.55 +    uLong sourceLen;
  276.56 +{
  276.57 +    z_stream stream;
  276.58 +    int err;
  276.59 +
  276.60 +    stream.next_in = (Bytef*)source;
  276.61 +    stream.avail_in = (uInt)sourceLen;
  276.62 +    /* Check for source > 64K on 16-bit machine: */
  276.63 +    if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
  276.64 +
  276.65 +    stream.next_out = dest;
  276.66 +    stream.avail_out = (uInt)*destLen;
  276.67 +    if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
  276.68 +
  276.69 +    stream.zalloc = (alloc_func)0;
  276.70 +    stream.zfree = (free_func)0;
  276.71 +
  276.72 +    err = inflateInit(&stream);
  276.73 +    if (err != Z_OK) return err;
  276.74 +
  276.75 +    err = inflate(&stream, Z_FINISH);
  276.76 +    if (err != Z_STREAM_END) {
  276.77 +        inflateEnd(&stream);
  276.78 +        if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0))
  276.79 +            return Z_DATA_ERROR;
  276.80 +        return err;
  276.81 +    }
  276.82 +    *destLen = (uLong)stream.total_out;
  276.83 +
  276.84 +    err = inflateEnd(&stream);
  276.85 +    return err;
  276.86 +}
   277.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   277.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/zadler32.c	Mon Dec 19 10:06:23 2011 -0800
   277.3 @@ -0,0 +1,193 @@
   277.4 +/*
   277.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   277.6 + *
   277.7 + * This code is free software; you can redistribute it and/or modify it
   277.8 + * under the terms of the GNU General Public License version 2 only, as
   277.9 + * published by the Free Software Foundation.  Oracle designates this
  277.10 + * particular file as subject to the "Classpath" exception as provided
  277.11 + * by Oracle in the LICENSE file that accompanied this code.
  277.12 + *
  277.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
  277.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  277.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  277.16 + * version 2 for more details (a copy is included in the LICENSE file that
  277.17 + * accompanied this code).
  277.18 + *
  277.19 + * You should have received a copy of the GNU General Public License version
  277.20 + * 2 along with this work; if not, write to the Free Software Foundation,
  277.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  277.22 + *
  277.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  277.24 + * or visit www.oracle.com if you need additional information or have any
  277.25 + * questions.
  277.26 + */
  277.27 +
  277.28 +/* adler32.c -- compute the Adler-32 checksum of a data stream
  277.29 + * Copyright (C) 1995-2007 Mark Adler
  277.30 + * For conditions of distribution and use, see copyright notice in zlib.h
  277.31 + */
  277.32 +
  277.33 +/* @(#) $Id$ */
  277.34 +
  277.35 +#include "zutil.h"
  277.36 +
  277.37 +#define local static
  277.38 +
  277.39 +local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2);
  277.40 +
  277.41 +#define BASE 65521UL    /* largest prime smaller than 65536 */
  277.42 +#define NMAX 5552
  277.43 +/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
  277.44 +
  277.45 +#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  277.46 +#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  277.47 +#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  277.48 +#define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  277.49 +#define DO16(buf)   DO8(buf,0); DO8(buf,8);
  277.50 +
  277.51 +/* use NO_DIVIDE if your processor does not do division in hardware */
  277.52 +#ifdef NO_DIVIDE
  277.53 +#  define MOD(a) \
  277.54 +    do { \
  277.55 +        if (a >= (BASE << 16)) a -= (BASE << 16); \
  277.56 +        if (a >= (BASE << 15)) a -= (BASE << 15); \
  277.57 +        if (a >= (BASE << 14)) a -= (BASE << 14); \
  277.58 +        if (a >= (BASE << 13)) a -= (BASE << 13); \
  277.59 +        if (a >= (BASE << 12)) a -= (BASE << 12); \
  277.60 +        if (a >= (BASE << 11)) a -= (BASE << 11); \
  277.61 +        if (a >= (BASE << 10)) a -= (BASE << 10); \
  277.62 +        if (a >= (BASE << 9)) a -= (BASE << 9); \
  277.63 +        if (a >= (BASE << 8)) a -= (BASE << 8); \
  277.64 +        if (a >= (BASE << 7)) a -= (BASE << 7); \
  277.65 +        if (a >= (BASE << 6)) a -= (BASE << 6); \
  277.66 +        if (a >= (BASE << 5)) a -= (BASE << 5); \
  277.67 +        if (a >= (BASE << 4)) a -= (BASE << 4); \
  277.68 +        if (a >= (BASE << 3)) a -= (BASE << 3); \
  277.69 +        if (a >= (BASE << 2)) a -= (BASE << 2); \
  277.70 +        if (a >= (BASE << 1)) a -= (BASE << 1); \
  277.71 +        if (a >= BASE) a -= BASE; \
  277.72 +    } while (0)
  277.73 +#  define MOD4(a) \
  277.74 +    do { \
  277.75 +        if (a >= (BASE << 4)) a -= (BASE << 4); \
  277.76 +        if (a >= (BASE << 3)) a -= (BASE << 3); \
  277.77 +        if (a >= (BASE << 2)) a -= (BASE << 2); \
  277.78 +        if (a >= (BASE << 1)) a -= (BASE << 1); \
  277.79 +        if (a >= BASE) a -= BASE; \
  277.80 +    } while (0)
  277.81 +#else
  277.82 +#  define MOD(a) a %= BASE
  277.83 +#  define MOD4(a) a %= BASE
  277.84 +#endif
  277.85 +
  277.86 +/* ========================================================================= */
  277.87 +uLong ZEXPORT adler32(adler, buf, len)
  277.88 +    uLong adler;
  277.89 +    const Bytef *buf;
  277.90 +    uInt len;
  277.91 +{
  277.92 +    unsigned long sum2;
  277.93 +    unsigned n;
  277.94 +
  277.95 +    /* split Adler-32 into component sums */
  277.96 +    sum2 = (adler >> 16) & 0xffff;
  277.97 +    adler &= 0xffff;
  277.98 +
  277.99 +    /* in case user likes doing a byte at a time, keep it fast */
 277.100 +    if (len == 1) {
 277.101 +        adler += buf[0];
 277.102 +        if (adler >= BASE)
 277.103 +            adler -= BASE;
 277.104 +        sum2 += adler;
 277.105 +        if (sum2 >= BASE)
 277.106 +            sum2 -= BASE;
 277.107 +        return adler | (sum2 << 16);
 277.108 +    }
 277.109 +
 277.110 +    /* initial Adler-32 value (deferred check for len == 1 speed) */
 277.111 +    if (buf == Z_NULL)
 277.112 +        return 1L;
 277.113 +
 277.114 +    /* in case short lengths are provided, keep it somewhat fast */
 277.115 +    if (len < 16) {
 277.116 +        while (len--) {
 277.117 +            adler += *buf++;
 277.118 +            sum2 += adler;
 277.119 +        }
 277.120 +        if (adler >= BASE)
 277.121 +            adler -= BASE;
 277.122 +        MOD4(sum2);             /* only added so many BASE's */
 277.123 +        return adler | (sum2 << 16);
 277.124 +    }
 277.125 +
 277.126 +    /* do length NMAX blocks -- requires just one modulo operation */
 277.127 +    while (len >= NMAX) {
 277.128 +        len -= NMAX;
 277.129 +        n = NMAX / 16;          /* NMAX is divisible by 16 */
 277.130 +        do {
 277.131 +            DO16(buf);          /* 16 sums unrolled */
 277.132 +            buf += 16;
 277.133 +        } while (--n);
 277.134 +        MOD(adler);
 277.135 +        MOD(sum2);
 277.136 +    }
 277.137 +
 277.138 +    /* do remaining bytes (less than NMAX, still just one modulo) */
 277.139 +    if (len) {                  /* avoid modulos if none remaining */
 277.140 +        while (len >= 16) {
 277.141 +            len -= 16;
 277.142 +            DO16(buf);
 277.143 +            buf += 16;
 277.144 +        }
 277.145 +        while (len--) {
 277.146 +            adler += *buf++;
 277.147 +            sum2 += adler;
 277.148 +        }
 277.149 +        MOD(adler);
 277.150 +        MOD(sum2);
 277.151 +    }
 277.152 +
 277.153 +    /* return recombined sums */
 277.154 +    return adler | (sum2 << 16);
 277.155 +}
 277.156 +
 277.157 +/* ========================================================================= */
 277.158 +local uLong adler32_combine_(adler1, adler2, len2)
 277.159 +    uLong adler1;
 277.160 +    uLong adler2;
 277.161 +    z_off64_t len2;
 277.162 +{
 277.163 +    unsigned long sum1;
 277.164 +    unsigned long sum2;
 277.165 +    unsigned rem;
 277.166 +
 277.167 +    /* the derivation of this formula is left as an exercise for the reader */
 277.168 +    rem = (unsigned)(len2 % BASE);
 277.169 +    sum1 = adler1 & 0xffff;
 277.170 +    sum2 = rem * sum1;
 277.171 +    MOD(sum2);
 277.172 +    sum1 += (adler2 & 0xffff) + BASE - 1;
 277.173 +    sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
 277.174 +    if (sum1 >= BASE) sum1 -= BASE;
 277.175 +    if (sum1 >= BASE) sum1 -= BASE;
 277.176 +    if (sum2 >= (BASE << 1)) sum2 -= (BASE << 1);
 277.177 +    if (sum2 >= BASE) sum2 -= BASE;
 277.178 +    return sum1 | (sum2 << 16);
 277.179 +}
 277.180 +
 277.181 +/* ========================================================================= */
 277.182 +uLong ZEXPORT adler32_combine(adler1, adler2, len2)
 277.183 +    uLong adler1;
 277.184 +    uLong adler2;
 277.185 +    z_off_t len2;
 277.186 +{
 277.187 +    return adler32_combine_(adler1, adler2, len2);
 277.188 +}
 277.189 +
 277.190 +uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
 277.191 +    uLong adler1;
 277.192 +    uLong adler2;
 277.193 +    z_off64_t len2;
 277.194 +{
 277.195 +    return adler32_combine_(adler1, adler2, len2);
 277.196 +}
   278.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   278.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/zconf.h	Mon Dec 19 10:06:23 2011 -0800
   278.3 @@ -0,0 +1,459 @@
   278.4 +/*
   278.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   278.6 + *
   278.7 + * This code is free software; you can redistribute it and/or modify it
   278.8 + * under the terms of the GNU General Public License version 2 only, as
   278.9 + * published by the Free Software Foundation.  Oracle designates this
  278.10 + * particular file as subject to the "Classpath" exception as provided
  278.11 + * by Oracle in the LICENSE file that accompanied this code.
  278.12 + *
  278.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
  278.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  278.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  278.16 + * version 2 for more details (a copy is included in the LICENSE file that
  278.17 + * accompanied this code).
  278.18 + *
  278.19 + * You should have received a copy of the GNU General Public License version
  278.20 + * 2 along with this work; if not, write to the Free Software Foundation,
  278.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  278.22 + *
  278.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  278.24 + * or visit www.oracle.com if you need additional information or have any
  278.25 + * questions.
  278.26 + */
  278.27 +
  278.28 +/* zconf.h -- configuration of the zlib compression library
  278.29 + * Copyright (C) 1995-2010 Jean-loup Gailly.
  278.30 + * For conditions of distribution and use, see copyright notice in zlib.h
  278.31 + */
  278.32 +
  278.33 +/* @(#) $Id$ */
  278.34 +
  278.35 +#ifndef ZCONF_H
  278.36 +#define ZCONF_H
  278.37 +
  278.38 +/* for _LP64 */
  278.39 +#include <sys/types.h>
  278.40 +
  278.41 +/*
  278.42 + * If you *really* need a unique prefix for all types and library functions,
  278.43 + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
  278.44 + * Even better than compiling with -DZ_PREFIX would be to use configure to set
  278.45 + * this permanently in zconf.h using "./configure --zprefix".
  278.46 + */
  278.47 +#ifdef Z_PREFIX     /* may be set to #if 1 by ./configure */
  278.48 +
  278.49 +/* all linked symbols */
  278.50 +#  define _dist_code            z__dist_code
  278.51 +#  define _length_code          z__length_code
  278.52 +#  define _tr_align             z__tr_align
  278.53 +#  define _tr_flush_block       z__tr_flush_block
  278.54 +#  define _tr_init              z__tr_init
  278.55 +#  define _tr_stored_block      z__tr_stored_block
  278.56 +#  define _tr_tally             z__tr_tally
  278.57 +#  define adler32               z_adler32
  278.58 +#  define adler32_combine       z_adler32_combine
  278.59 +#  define adler32_combine64     z_adler32_combine64
  278.60 +#  define compress              z_compress
  278.61 +#  define compress2             z_compress2
  278.62 +#  define compressBound         z_compressBound
  278.63 +#  define crc32                 z_crc32
  278.64 +#  define crc32_combine         z_crc32_combine
  278.65 +#  define crc32_combine64       z_crc32_combine64
  278.66 +#  define deflate               z_deflate
  278.67 +#  define deflateBound          z_deflateBound
  278.68 +#  define deflateCopy           z_deflateCopy
  278.69 +#  define deflateEnd            z_deflateEnd
  278.70 +#  define deflateInit2_         z_deflateInit2_
  278.71 +#  define deflateInit_          z_deflateInit_
  278.72 +#  define deflateParams         z_deflateParams
  278.73 +#  define deflatePrime          z_deflatePrime
  278.74 +#  define deflateReset          z_deflateReset
  278.75 +#  define deflateSetDictionary  z_deflateSetDictionary
  278.76 +#  define deflateSetHeader      z_deflateSetHeader
  278.77 +#  define deflateTune           z_deflateTune
  278.78 +#  define deflate_copyright     z_deflate_copyright
  278.79 +#  define get_crc_table         z_get_crc_table
  278.80 +#  define gz_error              z_gz_error
  278.81 +#  define gz_intmax             z_gz_intmax
  278.82 +#  define gz_strwinerror        z_gz_strwinerror
  278.83 +#  define gzbuffer              z_gzbuffer
  278.84 +#  define gzclearerr            z_gzclearerr
  278.85 +#  define gzclose               z_gzclose
  278.86 +#  define gzclose_r             z_gzclose_r
  278.87 +#  define gzclose_w             z_gzclose_w
  278.88 +#  define gzdirect              z_gzdirect
  278.89 +#  define gzdopen               z_gzdopen
  278.90 +#  define gzeof                 z_gzeof
  278.91 +#  define gzerror               z_gzerror
  278.92 +#  define gzflush               z_gzflush
  278.93 +#  define gzgetc                z_gzgetc
  278.94 +#  define gzgets                z_gzgets
  278.95 +#  define gzoffset              z_gzoffset
  278.96 +#  define gzoffset64            z_gzoffset64
  278.97 +#  define gzopen                z_gzopen
  278.98 +#  define gzopen64              z_gzopen64
  278.99 +#  define gzprintf              z_gzprintf
 278.100 +#  define gzputc                z_gzputc
 278.101 +#  define gzputs                z_gzputs
 278.102 +#  define gzread                z_gzread
 278.103 +#  define gzrewind              z_gzrewind
 278.104 +#  define gzseek                z_gzseek
 278.105 +#  define gzseek64              z_gzseek64
 278.106 +#  define gzsetparams           z_gzsetparams
 278.107 +#  define gztell                z_gztell
 278.108 +#  define gztell64              z_gztell64
 278.109 +#  define gzungetc              z_gzungetc
 278.110 +#  define gzwrite               z_gzwrite
 278.111 +#  define inflate               z_inflate
 278.112 +#  define inflateBack           z_inflateBack
 278.113 +#  define inflateBackEnd        z_inflateBackEnd
 278.114 +#  define inflateBackInit_      z_inflateBackInit_
 278.115 +#  define inflateCopy           z_inflateCopy
 278.116 +#  define inflateEnd            z_inflateEnd
 278.117 +#  define inflateGetHeader      z_inflateGetHeader
 278.118 +#  define inflateInit2_         z_inflateInit2_
 278.119 +#  define inflateInit_          z_inflateInit_
 278.120 +#  define inflateMark           z_inflateMark
 278.121 +#  define inflatePrime          z_inflatePrime
 278.122 +#  define inflateReset          z_inflateReset
 278.123 +#  define inflateReset2         z_inflateReset2
 278.124 +#  define inflateSetDictionary  z_inflateSetDictionary
 278.125 +#  define inflateSync           z_inflateSync
 278.126 +#  define inflateSyncPoint      z_inflateSyncPoint
 278.127 +#  define inflateUndermine      z_inflateUndermine
 278.128 +#  define inflate_copyright     z_inflate_copyright
 278.129 +#  define inflate_fast          z_inflate_fast
 278.130 +#  define inflate_table         z_inflate_table
 278.131 +#  define uncompress            z_uncompress
 278.132 +#  define zError                z_zError
 278.133 +#  define zcalloc               z_zcalloc
 278.134 +#  define zcfree                z_zcfree
 278.135 +#  define zlibCompileFlags      z_zlibCompileFlags
 278.136 +#  define zlibVersion           z_zlibVersion
 278.137 +
 278.138 +/* all zlib typedefs in zlib.h and zconf.h */
 278.139 +#  define Byte                  z_Byte
 278.140 +#  define Bytef                 z_Bytef
 278.141 +#  define alloc_func            z_alloc_func
 278.142 +#  define charf                 z_charf
 278.143 +#  define free_func             z_free_func
 278.144 +#  define gzFile                z_gzFile
 278.145 +#  define gz_header             z_gz_header
 278.146 +#  define gz_headerp            z_gz_headerp
 278.147 +#  define in_func               z_in_func
 278.148 +#  define intf                  z_intf
 278.149 +#  define out_func              z_out_func
 278.150 +#  define uInt                  z_uInt
 278.151 +#  define uIntf                 z_uIntf
 278.152 +#  define uLong                 z_uLong
 278.153 +#  define uLongf                z_uLongf
 278.154 +#  define voidp                 z_voidp
 278.155 +#  define voidpc                z_voidpc
 278.156 +#  define voidpf                z_voidpf
 278.157 +
 278.158 +/* all zlib structs in zlib.h and zconf.h */
 278.159 +#  define gz_header_s           z_gz_header_s
 278.160 +#  define internal_state        z_internal_state
 278.161 +
 278.162 +#endif
 278.163 +
 278.164 +#if defined(__MSDOS__) && !defined(MSDOS)
 278.165 +#  define MSDOS
 278.166 +#endif
 278.167 +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
 278.168 +#  define OS2
 278.169 +#endif
 278.170 +#if defined(_WINDOWS) && !defined(WINDOWS)
 278.171 +#  define WINDOWS
 278.172 +#endif
 278.173 +#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
 278.174 +#  ifndef WIN32
 278.175 +#    define WIN32
 278.176 +#  endif
 278.177 +#endif
 278.178 +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
 278.179 +#  if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
 278.180 +#    ifndef SYS16BIT
 278.181 +#      define SYS16BIT
 278.182 +#    endif
 278.183 +#  endif
 278.184 +#endif
 278.185 +
 278.186 +/*
 278.187 + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
 278.188 + * than 64k bytes at a time (needed on systems with 16-bit int).
 278.189 + */
 278.190 +#ifdef SYS16BIT
 278.191 +#  define MAXSEG_64K
 278.192 +#endif
 278.193 +#ifdef MSDOS
 278.194 +#  define UNALIGNED_OK
 278.195 +#endif
 278.196 +
 278.197 +#ifdef __STDC_VERSION__
 278.198 +#  ifndef STDC
 278.199 +#    define STDC
 278.200 +#  endif
 278.201 +#  if __STDC_VERSION__ >= 199901L
 278.202 +#    ifndef STDC99
 278.203 +#      define STDC99
 278.204 +#    endif
 278.205 +#  endif
 278.206 +#endif
 278.207 +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
 278.208 +#  define STDC
 278.209 +#endif
 278.210 +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
 278.211 +#  define STDC
 278.212 +#endif
 278.213 +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
 278.214 +#  define STDC
 278.215 +#endif
 278.216 +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
 278.217 +#  define STDC
 278.218 +#endif
 278.219 +
 278.220 +#if defined(__OS400__) && !defined(STDC)    /* iSeries (formerly AS/400). */
 278.221 +#  define STDC
 278.222 +#endif
 278.223 +
 278.224 +#ifndef STDC
 278.225 +#  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
 278.226 +#    define const       /* note: need a more gentle solution here */
 278.227 +#  endif
 278.228 +#endif
 278.229 +
 278.230 +/* Some Mac compilers merge all .h files incorrectly: */
 278.231 +#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
 278.232 +#  define NO_DUMMY_DECL
 278.233 +#endif
 278.234 +
 278.235 +/* Maximum value for memLevel in deflateInit2 */
 278.236 +#ifndef MAX_MEM_LEVEL
 278.237 +#  ifdef MAXSEG_64K
 278.238 +#    define MAX_MEM_LEVEL 8
 278.239 +#  else
 278.240 +#    define MAX_MEM_LEVEL 9
 278.241 +#  endif
 278.242 +#endif
 278.243 +
 278.244 +/* Maximum value for windowBits in deflateInit2 and inflateInit2.
 278.245 + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
 278.246 + * created by gzip. (Files created by minigzip can still be extracted by
 278.247 + * gzip.)
 278.248 + */
 278.249 +#ifndef MAX_WBITS
 278.250 +#  define MAX_WBITS   15 /* 32K LZ77 window */
 278.251 +#endif
 278.252 +
 278.253 +/* The memory requirements for deflate are (in bytes):
 278.254 +            (1 << (windowBits+2)) +  (1 << (memLevel+9))
 278.255 + that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
 278.256 + plus a few kilobytes for small objects. For example, if you want to reduce
 278.257 + the default memory requirements from 256K to 128K, compile with
 278.258 +     make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
 278.259 + Of course this will generally degrade compression (there's no free lunch).
 278.260 +
 278.261 +   The memory requirements for inflate are (in bytes) 1 << windowBits
 278.262 + that is, 32K for windowBits=15 (default value) plus a few kilobytes
 278.263 + for small objects.
 278.264 +*/
 278.265 +
 278.266 +                        /* Type declarations */
 278.267 +
 278.268 +#ifndef OF /* function prototypes */
 278.269 +#  ifdef STDC
 278.270 +#    define OF(args)  args
 278.271 +#  else
 278.272 +#    define OF(args)  ()
 278.273 +#  endif
 278.274 +#endif
 278.275 +
 278.276 +/* The following definitions for FAR are needed only for MSDOS mixed
 278.277 + * model programming (small or medium model with some far allocations).
 278.278 + * This was tested only with MSC; for other MSDOS compilers you may have
 278.279 + * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
 278.280 + * just define FAR to be empty.
 278.281 + */
 278.282 +#ifdef SYS16BIT
 278.283 +#  if defined(M_I86SM) || defined(M_I86MM)
 278.284 +     /* MSC small or medium model */
 278.285 +#    define SMALL_MEDIUM
 278.286 +#    ifdef _MSC_VER
 278.287 +#      define FAR _far
 278.288 +#    else
 278.289 +#      define FAR far
 278.290 +#    endif
 278.291 +#  endif
 278.292 +#  if (defined(__SMALL__) || defined(__MEDIUM__))
 278.293 +     /* Turbo C small or medium model */
 278.294 +#    define SMALL_MEDIUM
 278.295 +#    ifdef __BORLANDC__
 278.296 +#      define FAR _far
 278.297 +#    else
 278.298 +#      define FAR far
 278.299 +#    endif
 278.300 +#  endif
 278.301 +#endif
 278.302 +
 278.303 +#if defined(WINDOWS) || defined(WIN32)
 278.304 +   /* If building or using zlib as a DLL, define ZLIB_DLL.
 278.305 +    * This is not mandatory, but it offers a little performance increase.
 278.306 +    */
 278.307 +#  ifdef ZLIB_DLL
 278.308 +#    if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
 278.309 +#      ifdef ZLIB_INTERNAL
 278.310 +#        define ZEXTERN extern __declspec(dllexport)
 278.311 +#      else
 278.312 +#        define ZEXTERN extern __declspec(dllimport)
 278.313 +#      endif
 278.314 +#    endif
 278.315 +#  endif  /* ZLIB_DLL */
 278.316 +   /* If building or using zlib with the WINAPI/WINAPIV calling convention,
 278.317 +    * define ZLIB_WINAPI.
 278.318 +    * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
 278.319 +    */
 278.320 +#  ifdef ZLIB_WINAPI
 278.321 +#    ifdef FAR
 278.322 +#      undef FAR
 278.323 +#    endif
 278.324 +#    include <windows.h>
 278.325 +     /* No need for _export, use ZLIB.DEF instead. */
 278.326 +     /* For complete Windows compatibility, use WINAPI, not __stdcall. */
 278.327 +#    define ZEXPORT WINAPI
 278.328 +#    ifdef WIN32
 278.329 +#      define ZEXPORTVA WINAPIV
 278.330 +#    else
 278.331 +#      define ZEXPORTVA FAR CDECL
 278.332 +#    endif
 278.333 +#  endif
 278.334 +#endif
 278.335 +
 278.336 +#if defined (__BEOS__)
 278.337 +#  ifdef ZLIB_DLL
 278.338 +#    ifdef ZLIB_INTERNAL
 278.339 +#      define ZEXPORT   __declspec(dllexport)
 278.340 +#      define ZEXPORTVA __declspec(dllexport)
 278.341 +#    else
 278.342 +#      define ZEXPORT   __declspec(dllimport)
 278.343 +#      define ZEXPORTVA __declspec(dllimport)
 278.344 +#    endif
 278.345 +#  endif
 278.346 +#endif
 278.347 +
 278.348 +#ifndef ZEXTERN
 278.349 +#  define ZEXTERN extern
 278.350 +#endif
 278.351 +#ifndef ZEXPORT
 278.352 +#  define ZEXPORT
 278.353 +#endif
 278.354 +#ifndef ZEXPORTVA
 278.355 +#  define ZEXPORTVA
 278.356 +#endif
 278.357 +
 278.358 +#ifndef FAR
 278.359 +#  define FAR
 278.360 +#endif
 278.361 +
 278.362 +#if !defined(__MACTYPES__)
 278.363 +typedef unsigned char  Byte;  /* 8 bits */
 278.364 +#endif
 278.365 +typedef unsigned int   uInt;  /* 16 bits or more */
 278.366 +#ifdef _LP64
 278.367 +typedef unsigned int  uLong;  /* 32 bits or more */
 278.368 +#else
 278.369 +typedef unsigned long  uLong; /* 32 bits or more */
 278.370 +#endif
 278.371 +
 278.372 +#ifdef SMALL_MEDIUM
 278.373 +   /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
 278.374 +#  define Bytef Byte FAR
 278.375 +#else
 278.376 +   typedef Byte  FAR Bytef;
 278.377 +#endif
 278.378 +typedef char  FAR charf;
 278.379 +typedef int   FAR intf;
 278.380 +typedef uInt  FAR uIntf;
 278.381 +typedef uLong FAR uLongf;
 278.382 +
 278.383 +#ifdef STDC
 278.384 +   typedef void const *voidpc;
 278.385 +   typedef void FAR   *voidpf;
 278.386 +   typedef void       *voidp;
 278.387 +#else
 278.388 +   typedef Byte const *voidpc;
 278.389 +   typedef Byte FAR   *voidpf;
 278.390 +   typedef Byte       *voidp;
 278.391 +#endif
 278.392 +
 278.393 +#ifdef HAVE_UNISTD_H    /* may be set to #if 1 by ./configure */
 278.394 +#  define Z_HAVE_UNISTD_H
 278.395 +#endif
 278.396 +
 278.397 +#ifdef STDC
 278.398 +#  include <sys/types.h>    /* for off_t */
 278.399 +#endif
 278.400 +
 278.401 +/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
 278.402 + * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
 278.403 + * though the former does not conform to the LFS document), but considering
 278.404 + * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
 278.405 + * equivalently requesting no 64-bit operations
 278.406 + */
 278.407 +#if -_LARGEFILE64_SOURCE - -1 == 1
 278.408 +#  undef _LARGEFILE64_SOURCE
 278.409 +#endif
 278.410 +
 278.411 +#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
 278.412 +#  include <unistd.h>       /* for SEEK_* and off_t */
 278.413 +#  ifdef VMS
 278.414 +#    include <unixio.h>     /* for off_t */
 278.415 +#  endif
 278.416 +#  ifndef z_off_t
 278.417 +#    define z_off_t off_t
 278.418 +#  endif
 278.419 +#endif
 278.420 +
 278.421 +#ifndef SEEK_SET
 278.422 +#  define SEEK_SET        0       /* Seek from beginning of file.  */
 278.423 +#  define SEEK_CUR        1       /* Seek from current position.  */
 278.424 +#  define SEEK_END        2       /* Set file pointer to EOF plus "offset" */
 278.425 +#endif
 278.426 +
 278.427 +#ifndef z_off_t
 278.428 +#  define z_off_t long
 278.429 +#endif
 278.430 +
 278.431 +#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
 278.432 +#  define z_off64_t off64_t
 278.433 +#else
 278.434 +#  define z_off64_t z_off_t
 278.435 +#endif
 278.436 +
 278.437 +#if defined(__OS400__)
 278.438 +#  define NO_vsnprintf
 278.439 +#endif
 278.440 +
 278.441 +#if defined(__MVS__)
 278.442 +#  define NO_vsnprintf
 278.443 +#endif
 278.444 +
 278.445 +/* MVS linker does not support external names larger than 8 bytes */
 278.446 +#if defined(__MVS__)
 278.447 +  #pragma map(deflateInit_,"DEIN")
 278.448 +  #pragma map(deflateInit2_,"DEIN2")
 278.449 +  #pragma map(deflateEnd,"DEEND")
 278.450 +  #pragma map(deflateBound,"DEBND")
 278.451 +  #pragma map(inflateInit_,"ININ")
 278.452 +  #pragma map(inflateInit2_,"ININ2")
 278.453 +  #pragma map(inflateEnd,"INEND")
 278.454 +  #pragma map(inflateSync,"INSY")
 278.455 +  #pragma map(inflateSetDictionary,"INSEDI")
 278.456 +  #pragma map(compressBound,"CMBND")
 278.457 +  #pragma map(inflate_table,"INTABL")
 278.458 +  #pragma map(inflate_fast,"INFA")
 278.459 +  #pragma map(inflate_copyright,"INCOPY")
 278.460 +#endif
 278.461 +
 278.462 +#endif /* ZCONF_H */
   279.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   279.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/zcrc32.c	Mon Dec 19 10:06:23 2011 -0800
   279.3 @@ -0,0 +1,466 @@
   279.4 +/*
   279.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   279.6 + *
   279.7 + * This code is free software; you can redistribute it and/or modify it
   279.8 + * under the terms of the GNU General Public License version 2 only, as
   279.9 + * published by the Free Software Foundation.  Oracle designates this
  279.10 + * particular file as subject to the "Classpath" exception as provided
  279.11 + * by Oracle in the LICENSE file that accompanied this code.
  279.12 + *
  279.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
  279.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  279.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  279.16 + * version 2 for more details (a copy is included in the LICENSE file that
  279.17 + * accompanied this code).
  279.18 + *
  279.19 + * You should have received a copy of the GNU General Public License version
  279.20 + * 2 along with this work; if not, write to the Free Software Foundation,
  279.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  279.22 + *
  279.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  279.24 + * or visit www.oracle.com if you need additional information or have any
  279.25 + * questions.
  279.26 + */
  279.27 +
  279.28 +/* crc32.c -- compute the CRC-32 of a data stream
  279.29 + * Copyright (C) 1995-2006, 2010 Mark Adler
  279.30 + * For conditions of distribution and use, see copyright notice in zlib.h
  279.31 + *
  279.32 + * Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster
  279.33 + * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing
  279.34 + * tables for updating the shift register in one step with three exclusive-ors
  279.35 + * instead of four steps with four exclusive-ors.  This results in about a
  279.36 + * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3.
  279.37 + */
  279.38 +
  279.39 +/* @(#) $Id$ */
  279.40 +
  279.41 +/*
  279.42 +  Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore
  279.43 +  protection on the static variables used to control the first-use generation
  279.44 +  of the crc tables.  Therefore, if you #define DYNAMIC_CRC_TABLE, you should
  279.45 +  first call get_crc_table() to initialize the tables before allowing more than
  279.46 +  one thread to use crc32().
  279.47 + */
  279.48 +
  279.49 +#ifdef MAKECRCH
  279.50 +#  include <stdio.h>
  279.51 +#  ifndef DYNAMIC_CRC_TABLE
  279.52 +#    define DYNAMIC_CRC_TABLE
  279.53 +#  endif /* !DYNAMIC_CRC_TABLE */
  279.54 +#endif /* MAKECRCH */
  279.55 +
  279.56 +#include "zutil.h"      /* for STDC and FAR definitions */
  279.57 +
  279.58 +#define local static
  279.59 +
  279.60 +/* Find a four-byte integer type for crc32_little() and crc32_big(). */
  279.61 +#ifndef NOBYFOUR
  279.62 +#  ifdef STDC           /* need ANSI C limits.h to determine sizes */
  279.63 +#    include <limits.h>
  279.64 +#    define BYFOUR
  279.65 +#    if (UINT_MAX == 0xffffffffUL)
  279.66 +       typedef unsigned int u4;
  279.67 +#    else
  279.68 +#      if (ULONG_MAX == 0xffffffffUL)
  279.69 +         typedef unsigned long u4;
  279.70 +#      else
  279.71 +#        if (USHRT_MAX == 0xffffffffUL)
  279.72 +           typedef unsigned short u4;
  279.73 +#        else
  279.74 +#          undef BYFOUR     /* can't find a four-byte integer type! */
  279.75 +#        endif
  279.76 +#      endif
  279.77 +#    endif
  279.78 +#  endif /* STDC */
  279.79 +#endif /* !NOBYFOUR */
  279.80 +
  279.81 +/* Definitions for doing the crc four data bytes at a time. */
  279.82 +#ifdef BYFOUR
  279.83 +#  define REV(w) ((((w)>>24)&0xff)+(((w)>>8)&0xff00)+ \
  279.84 +                (((w)&0xff00)<<8)+(((w)&0xff)<<24))
  279.85 +   local unsigned long crc32_little OF((unsigned long,
  279.86 +                        const unsigned char FAR *, unsigned));
  279.87 +   local unsigned long crc32_big OF((unsigned long,
  279.88 +                        const unsigned char FAR *, unsigned));
  279.89 +#  define TBLS 8
  279.90 +#else
  279.91 +#  define TBLS 1
  279.92 +#endif /* BYFOUR */
  279.93 +
  279.94 +/* Local functions for crc concatenation */
  279.95 +local unsigned long gf2_matrix_times OF((unsigned long *mat,
  279.96 +                                         unsigned long vec));
  279.97 +local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat));
  279.98 +local uLong crc32_combine_(uLong crc1, uLong crc2, z_off64_t len2);
  279.99 +
 279.100 +
 279.101 +#ifdef DYNAMIC_CRC_TABLE
 279.102 +
 279.103 +local volatile int crc_table_empty = 1;
 279.104 +local unsigned long FAR crc_table[TBLS][256];
 279.105 +local void make_crc_table OF((void));
 279.106 +#ifdef MAKECRCH
 279.107 +   local void write_table OF((FILE *, const unsigned long FAR *));
 279.108 +#endif /* MAKECRCH */
 279.109 +/*
 279.110 +  Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
 279.111 +  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.
 279.112 +
 279.113 +  Polynomials over GF(2) are represented in binary, one bit per coefficient,
 279.114 +  with the lowest powers in the most significant bit.  Then adding polynomials
 279.115 +  is just exclusive-or, and multiplying a polynomial by x is a right shift by
 279.116 +  one.  If we call the above polynomial p, and represent a byte as the
 279.117 +  polynomial q, also with the lowest power in the most significant bit (so the
 279.118 +  byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p,
 279.119 +  where a mod b means the remainder after dividing a by b.
 279.120 +
 279.121 +  This calculation is done using the shift-register method of multiplying and
 279.122 +  taking the remainder.  The register is initialized to zero, and for each
 279.123 +  incoming bit, x^32 is added mod p to the register if the bit is a one (where
 279.124 +  x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by
 279.125 +  x (which is shifting right by one and adding x^32 mod p if the bit shifted
 279.126 +  out is a one).  We start with the highest power (least significant bit) of
 279.127 +  q and repeat for all eight bits of q.
 279.128 +
 279.129 +  The first table is simply the CRC of all possible eight bit values.  This is
 279.130 +  all the information needed to generate CRCs on data a byte at a time for all
 279.131 +  combinations of CRC register values and incoming bytes.  The remaining tables
 279.132 +  allow for word-at-a-time CRC calculation for both big-endian and little-
 279.133 +  endian machines, where a word is four bytes.
 279.134 +*/
 279.135 +local void make_crc_table()
 279.136 +{
 279.137 +    unsigned long c;
 279.138 +    int n, k;
 279.139 +    unsigned long poly;                 /* polynomial exclusive-or pattern */
 279.140 +    /* terms of polynomial defining this crc (except x^32): */
 279.141 +    static volatile int first = 1;      /* flag to limit concurrent making */
 279.142 +    static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
 279.143 +
 279.144 +    /* See if another task is already doing this (not thread-safe, but better
 279.145 +       than nothing -- significantly reduces duration of vulnerability in
 279.146 +       case the advice about DYNAMIC_CRC_TABLE is ignored) */
 279.147 +    if (first) {
 279.148 +        first = 0;
 279.149 +
 279.150 +        /* make exclusive-or pattern from polynomial (0xedb88320UL) */
 279.151 +        poly = 0UL;
 279.152 +        for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++)
 279.153 +            poly |= 1UL << (31 - p[n]);
 279.154 +
 279.155 +        /* generate a crc for every 8-bit value */
 279.156 +        for (n = 0; n < 256; n++) {
 279.157 +            c = (unsigned long)n;
 279.158 +            for (k = 0; k < 8; k++)
 279.159 +                c = c & 1 ? poly ^ (c >> 1) : c >> 1;
 279.160 +            crc_table[0][n] = c;
 279.161 +        }
 279.162 +
 279.163 +#ifdef BYFOUR
 279.164 +        /* generate crc for each value followed by one, two, and three zeros,
 279.165 +           and then the byte reversal of those as well as the first table */
 279.166 +        for (n = 0; n < 256; n++) {
 279.167 +            c = crc_table[0][n];
 279.168 +            crc_table[4][n] = REV(c);
 279.169 +            for (k = 1; k < 4; k++) {
 279.170 +                c = crc_table[0][c & 0xff] ^ (c >> 8);
 279.171 +                crc_table[k][n] = c;
 279.172 +                crc_table[k + 4][n] = REV(c);
 279.173 +            }
 279.174 +        }
 279.175 +#endif /* BYFOUR */
 279.176 +
 279.177 +        crc_table_empty = 0;
 279.178 +    }
 279.179 +    else {      /* not first */
 279.180 +        /* wait for the other guy to finish (not efficient, but rare) */
 279.181 +        while (crc_table_empty)
 279.182 +            ;
 279.183 +    }
 279.184 +
 279.185 +#ifdef MAKECRCH
 279.186 +    /* write out CRC tables to crc32.h */
 279.187 +    {
 279.188 +        FILE *out;
 279.189 +
 279.190 +        out = fopen("crc32.h", "w");
 279.191 +        if (out == NULL) return;
 279.192 +        fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n");
 279.193 +        fprintf(out, " * Generated automatically by crc32.c\n */\n\n");
 279.194 +        fprintf(out, "local const unsigned long FAR ");
 279.195 +        fprintf(out, "crc_table[TBLS][256] =\n{\n  {\n");
 279.196 +        write_table(out, crc_table[0]);
 279.197 +#  ifdef BYFOUR
 279.198 +        fprintf(out, "#ifdef BYFOUR\n");
 279.199 +        for (k = 1; k < 8; k++) {
 279.200 +            fprintf(out, "  },\n  {\n");
 279.201 +            write_table(out, crc_table[k]);
 279.202 +        }
 279.203 +        fprintf(out, "#endif\n");
 279.204 +#  endif /* BYFOUR */
 279.205 +        fprintf(out, "  }\n};\n");
 279.206 +        fclose(out);
 279.207 +    }
 279.208 +#endif /* MAKECRCH */
 279.209 +}
 279.210 +
 279.211 +#ifdef MAKECRCH
 279.212 +local void write_table(out, table)
 279.213 +    FILE *out;
 279.214 +    const unsigned long FAR *table;
 279.215 +{
 279.216 +    int n;
 279.217 +
 279.218 +    for (n = 0; n < 256; n++)
 279.219 +        fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : "    ", table[n],
 279.220 +                n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", "));
 279.221 +}
 279.222 +#endif /* MAKECRCH */
 279.223 +
 279.224 +#else /* !DYNAMIC_CRC_TABLE */
 279.225 +/* ========================================================================
 279.226 + * Tables of CRC-32s of all single-byte values, made by make_crc_table().
 279.227 + */
 279.228 +#include "crc32.h"
 279.229 +#endif /* DYNAMIC_CRC_TABLE */
 279.230 +
 279.231 +/* =========================================================================
 279.232 + * This function can be used by asm versions of crc32()
 279.233 + */
 279.234 +const unsigned long FAR * ZEXPORT get_crc_table()
 279.235 +{
 279.236 +#ifdef DYNAMIC_CRC_TABLE
 279.237 +    if (crc_table_empty)
 279.238 +        make_crc_table();
 279.239 +#endif /* DYNAMIC_CRC_TABLE */
 279.240 +    return (const unsigned long FAR *)crc_table;
 279.241 +}
 279.242 +
 279.243 +/* ========================================================================= */
 279.244 +#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8)
 279.245 +#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1
 279.246 +
 279.247 +/* ========================================================================= */
 279.248 +uLong ZEXPORT crc32(crc, buf, len)
 279.249 +    uLong crc;
 279.250 +    const unsigned char FAR *buf;
 279.251 +    uInt len;
 279.252 +{
 279.253 +    if (buf == Z_NULL) return 0UL;
 279.254 +
 279.255 +#ifdef DYNAMIC_CRC_TABLE
 279.256 +    if (crc_table_empty)
 279.257 +        make_crc_table();
 279.258 +#endif /* DYNAMIC_CRC_TABLE */
 279.259 +
 279.260 +#ifdef BYFOUR
 279.261 +    if (sizeof(void *) == sizeof(ptrdiff_t)) {
 279.262 +        u4 endian;
 279.263 +
 279.264 +        endian = 1;
 279.265 +        if (*((unsigned char *)(&endian)))
 279.266 +            return (uLong)crc32_little(crc, buf, len);
 279.267 +        else
 279.268 +            return (uLong)crc32_big(crc, buf, len);
 279.269 +    }
 279.270 +#endif /* BYFOUR */
 279.271 +    crc = crc ^ 0xffffffffUL;
 279.272 +    while (len >= 8) {
 279.273 +        DO8;
 279.274 +        len -= 8;
 279.275 +    }
 279.276 +    if (len) do {
 279.277 +        DO1;
 279.278 +    } while (--len);
 279.279 +    return crc ^ 0xffffffffUL;
 279.280 +}
 279.281 +
 279.282 +#ifdef BYFOUR
 279.283 +
 279.284 +/* ========================================================================= */
 279.285 +#define DOLIT4 c ^= *buf4++; \
 279.286 +        c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \
 279.287 +            crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24]
 279.288 +#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4
 279.289 +
 279.290 +/* ========================================================================= */
 279.291 +local unsigned long crc32_little(crc, buf, len)
 279.292 +    unsigned long crc;
 279.293 +    const unsigned char FAR *buf;
 279.294 +    unsigned len;
 279.295 +{
 279.296 +    register u4 c;
 279.297 +    register const u4 FAR *buf4;
 279.298 +
 279.299 +    c = (u4)crc;
 279.300 +    c = ~c;
 279.301 +    while (len && ((ptrdiff_t)buf & 3)) {
 279.302 +        c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
 279.303 +        len--;
 279.304 +    }
 279.305 +
 279.306 +    buf4 = (const u4 FAR *)(const void FAR *)buf;
 279.307 +    while (len >= 32) {
 279.308 +        DOLIT32;
 279.309 +        len -= 32;
 279.310 +    }
 279.311 +    while (len >= 4) {
 279.312 +        DOLIT4;
 279.313 +        len -= 4;
 279.314 +    }
 279.315 +    buf = (const unsigned char FAR *)buf4;
 279.316 +
 279.317 +    if (len) do {
 279.318 +        c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
 279.319 +    } while (--len);
 279.320 +    c = ~c;
 279.321 +    return (unsigned long)c;
 279.322 +}
 279.323 +
 279.324 +/* ========================================================================= */
 279.325 +#define DOBIG4 c ^= *++buf4; \
 279.326 +        c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \
 279.327 +            crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24]
 279.328 +#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4
 279.329 +
 279.330 +/* ========================================================================= */
 279.331 +local unsigned long crc32_big(crc, buf, len)
 279.332 +    unsigned long crc;
 279.333 +    const unsigned char FAR *buf;
 279.334 +    unsigned len;
 279.335 +{
 279.336 +    register u4 c;
 279.337 +    register const u4 FAR *buf4;
 279.338 +
 279.339 +    c = REV((u4)crc);
 279.340 +    c = ~c;
 279.341 +    while (len && ((ptrdiff_t)buf & 3)) {
 279.342 +        c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
 279.343 +        len--;
 279.344 +    }
 279.345 +
 279.346 +    buf4 = (const u4 FAR *)(const void FAR *)buf;
 279.347 +    buf4--;
 279.348 +    while (len >= 32) {
 279.349 +        DOBIG32;
 279.350 +        len -= 32;
 279.351 +    }
 279.352 +    while (len >= 4) {
 279.353 +        DOBIG4;
 279.354 +        len -= 4;
 279.355 +    }
 279.356 +    buf4++;
 279.357 +    buf = (const unsigned char FAR *)buf4;
 279.358 +
 279.359 +    if (len) do {
 279.360 +        c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
 279.361 +    } while (--len);
 279.362 +    c = ~c;
 279.363 +    return (unsigned long)(REV(c));
 279.364 +}
 279.365 +
 279.366 +#endif /* BYFOUR */
 279.367 +
 279.368 +#define GF2_DIM 32      /* dimension of GF(2) vectors (length of CRC) */
 279.369 +
 279.370 +/* ========================================================================= */
 279.371 +local unsigned long gf2_matrix_times(mat, vec)
 279.372 +    unsigned long *mat;
 279.373 +    unsigned long vec;
 279.374 +{
 279.375 +    unsigned long sum;
 279.376 +
 279.377 +    sum = 0;
 279.378 +    while (vec) {
 279.379 +        if (vec & 1)
 279.380 +            sum ^= *mat;
 279.381 +        vec >>= 1;
 279.382 +        mat++;
 279.383 +    }
 279.384 +    return sum;
 279.385 +}
 279.386 +
 279.387 +/* ========================================================================= */
 279.388 +local void gf2_matrix_square(square, mat)
 279.389 +    unsigned long *square;
 279.390 +    unsigned long *mat;
 279.391 +{
 279.392 +    int n;
 279.393 +
 279.394 +    for (n = 0; n < GF2_DIM; n++)
 279.395 +        square[n] = gf2_matrix_times(mat, mat[n]);
 279.396 +}
 279.397 +
 279.398 +/* ========================================================================= */
 279.399 +local uLong crc32_combine_(crc1, crc2, len2)
 279.400 +    uLong crc1;
 279.401 +    uLong crc2;
 279.402 +    z_off64_t len2;
 279.403 +{
 279.404 +    int n;
 279.405 +    unsigned long row;
 279.406 +    unsigned long even[GF2_DIM];    /* even-power-of-two zeros operator */
 279.407 +    unsigned long odd[GF2_DIM];     /* odd-power-of-two zeros operator */
 279.408 +
 279.409 +    /* degenerate case (also disallow negative lengths) */
 279.410 +    if (len2 <= 0)
 279.411 +        return crc1;
 279.412 +
 279.413 +    /* put operator for one zero bit in odd */
 279.414 +    odd[0] = 0xedb88320UL;          /* CRC-32 polynomial */
 279.415 +    row = 1;
 279.416 +    for (n = 1; n < GF2_DIM; n++) {
 279.417 +        odd[n] = row;
 279.418 +        row <<= 1;
 279.419 +    }
 279.420 +
 279.421 +    /* put operator for two zero bits in even */
 279.422 +    gf2_matrix_square(even, odd);
 279.423 +
 279.424 +    /* put operator for four zero bits in odd */
 279.425 +    gf2_matrix_square(odd, even);
 279.426 +
 279.427 +    /* apply len2 zeros to crc1 (first square will put the operator for one
 279.428 +       zero byte, eight zero bits, in even) */
 279.429 +    do {
 279.430 +        /* apply zeros operator for this bit of len2 */
 279.431 +        gf2_matrix_square(even, odd);
 279.432 +        if (len2 & 1)
 279.433 +            crc1 = gf2_matrix_times(even, crc1);
 279.434 +        len2 >>= 1;
 279.435 +
 279.436 +        /* if no more bits set, then done */
 279.437 +        if (len2 == 0)
 279.438 +            break;
 279.439 +
 279.440 +        /* another iteration of the loop with odd and even swapped */
 279.441 +        gf2_matrix_square(odd, even);
 279.442 +        if (len2 & 1)
 279.443 +            crc1 = gf2_matrix_times(odd, crc1);
 279.444 +        len2 >>= 1;
 279.445 +
 279.446 +        /* if no more bits set, then done */
 279.447 +    } while (len2 != 0);
 279.448 +
 279.449 +    /* return combined crc */
 279.450 +    crc1 ^= crc2;
 279.451 +    return crc1;
 279.452 +}
 279.453 +
 279.454 +/* ========================================================================= */
 279.455 +uLong ZEXPORT crc32_combine(crc1, crc2, len2)
 279.456 +    uLong crc1;
 279.457 +    uLong crc2;
 279.458 +    z_off_t len2;
 279.459 +{
 279.460 +    return crc32_combine_(crc1, crc2, len2);
 279.461 +}
 279.462 +
 279.463 +uLong ZEXPORT crc32_combine64(crc1, crc2, len2)
 279.464 +    uLong crc1;
 279.465 +    uLong crc2;
 279.466 +    z_off64_t len2;
 279.467 +{
 279.468 +    return crc32_combine_(crc1, crc2, len2);
 279.469 +}
   280.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   280.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/zlib.h	Mon Dec 19 10:06:23 2011 -0800
   280.3 @@ -0,0 +1,1637 @@
   280.4 +/*
   280.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   280.6 + *
   280.7 + * This code is free software; you can redistribute it and/or modify it
   280.8 + * under the terms of the GNU General Public License version 2 only, as
   280.9 + * published by the Free Software Foundation.  Oracle designates this
  280.10 + * particular file as subject to the "Classpath" exception as provided
  280.11 + * by Oracle in the LICENSE file that accompanied this code.
  280.12 + *
  280.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
  280.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  280.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  280.16 + * version 2 for more details (a copy is included in the LICENSE file that
  280.17 + * accompanied this code).
  280.18 + *
  280.19 + * You should have received a copy of the GNU General Public License version
  280.20 + * 2 along with this work; if not, write to the Free Software Foundation,
  280.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  280.22 + *
  280.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  280.24 + * or visit www.oracle.com if you need additional information or have any
  280.25 + * questions.
  280.26 + */
  280.27 +
  280.28 +/* zlib.h -- interface of the 'zlib' general purpose compression library
  280.29 +  version 1.2.5, April 19th, 2010
  280.30 +
  280.31 +  Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler
  280.32 +
  280.33 +  This software is provided 'as-is', without any express or implied
  280.34 +  warranty.  In no event will the authors be held liable for any damages
  280.35 +  arising from the use of this software.
  280.36 +
  280.37 +  Permission is granted to anyone to use this software for any purpose,
  280.38 +  including commercial applications, and to alter it and redistribute it
  280.39 +  freely, subject to the following restrictions:
  280.40 +
  280.41 +  1. The origin of this software must not be misrepresented; you must not
  280.42 +     claim that you wrote the original software. If you use this software
  280.43 +     in a product, an acknowledgment in the product documentation would be
  280.44 +     appreciated but is not required.
  280.45 +  2. Altered source versions must be plainly marked as such, and must not be
  280.46 +     misrepresented as being the original software.
  280.47 +  3. This notice may not be removed or altered from any source distribution.
  280.48 +
  280.49 +  Jean-loup Gailly        Mark Adler
  280.50 +  jloup@gzip.org          madler@alumni.caltech.edu
  280.51 +
  280.52 +
  280.53 +  The data format used by the zlib library is described by RFCs (Request for
  280.54 +  Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt
  280.55 +  (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
  280.56 +*/
  280.57 +
  280.58 +#ifndef ZLIB_H
  280.59 +#define ZLIB_H
  280.60 +
  280.61 +#include "zconf.h"
  280.62 +
  280.63 +#ifdef __cplusplus
  280.64 +extern "C" {
  280.65 +#endif
  280.66 +
  280.67 +#define ZLIB_VERSION "1.2.5"
  280.68 +#define ZLIB_VERNUM 0x1250
  280.69 +#define ZLIB_VER_MAJOR 1
  280.70 +#define ZLIB_VER_MINOR 2
  280.71 +#define ZLIB_VER_REVISION 5
  280.72 +#define ZLIB_VER_SUBREVISION 0
  280.73 +
  280.74 +/*
  280.75 +    The 'zlib' compression library provides in-memory compression and
  280.76 +  decompression functions, including integrity checks of the uncompressed data.
  280.77 +  This version of the library supports only one compression method (deflation)
  280.78 +  but other algorithms will be added later and will have the same stream
  280.79 +  interface.
  280.80 +
  280.81 +    Compression can be done in a single step if the buffers are large enough,
  280.82 +  or can be done by repeated calls of the compression function.  In the latter
  280.83 +  case, the application must provide more input and/or consume the output
  280.84 +  (providing more output space) before each call.
  280.85 +
  280.86 +    The compressed data format used by default by the in-memory functions is
  280.87 +  the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
  280.88 +  around a deflate stream, which is itself documented in RFC 1951.
  280.89 +
  280.90 +    The library also supports reading and writing files in gzip (.gz) format
  280.91 +  with an interface similar to that of stdio using the functions that start
  280.92 +  with "gz".  The gzip format is different from the zlib format.  gzip is a
  280.93 +  gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
  280.94 +
  280.95 +    This library can optionally read and write gzip streams in memory as well.
  280.96 +
  280.97 +    The zlib format was designed to be compact and fast for use in memory
  280.98 +  and on communications channels.  The gzip format was designed for single-
  280.99 +  file compression on file systems, has a larger header than zlib to maintain
 280.100 +  directory information, and uses a different, slower check method than zlib.
 280.101 +
 280.102 +    The library does not install any signal handler.  The decoder checks
 280.103 +  the consistency of the compressed data, so the library should never crash
 280.104 +  even in case of corrupted input.
 280.105 +*/
 280.106 +
 280.107 +typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
 280.108 +typedef void   (*free_func)  OF((voidpf opaque, voidpf address));
 280.109 +
 280.110 +struct internal_state;
 280.111 +
 280.112 +typedef struct z_stream_s {
 280.113 +    Bytef    *next_in;  /* next input byte */
 280.114 +    uInt     avail_in;  /* number of bytes available at next_in */
 280.115 +    long long total_in; /* total nb of input bytes read so far */
 280.116 +
 280.117 +    Bytef    *next_out; /* next output byte should be put there */
 280.118 +    uInt     avail_out; /* remaining free space at next_out */
 280.119 +    long long total_out;/* total nb of bytes output so far */
 280.120 +
 280.121 +    char     *msg;      /* last error message, NULL if no error */
 280.122 +    struct internal_state FAR *state; /* not visible by applications */
 280.123 +
 280.124 +    alloc_func zalloc;  /* used to allocate the internal state */
 280.125 +    free_func  zfree;   /* used to free the internal state */
 280.126 +    voidpf     opaque;  /* private data object passed to zalloc and zfree */
 280.127 +
 280.128 +    int     data_type;  /* best guess about the data type: binary or text */
 280.129 +    uLong   adler;      /* adler32 value of the uncompressed data */
 280.130 +    uLong   reserved;   /* reserved for future use */
 280.131 +} z_stream;
 280.132 +
 280.133 +typedef z_stream FAR *z_streamp;
 280.134 +
 280.135 +/*
 280.136 +     gzip header information passed to and from zlib routines.  See RFC 1952
 280.137 +  for more details on the meanings of these fields.
 280.138 +*/
 280.139 +typedef struct gz_header_s {
 280.140 +    int     text;       /* true if compressed data believed to be text */
 280.141 +    uLong   time;       /* modification time */
 280.142 +    int     xflags;     /* extra flags (not used when writing a gzip file) */
 280.143 +    int     os;         /* operating system */
 280.144 +    Bytef   *extra;     /* pointer to extra field or Z_NULL if none */
 280.145 +    uInt    extra_len;  /* extra field length (valid if extra != Z_NULL) */
 280.146 +    uInt    extra_max;  /* space at extra (only when reading header) */
 280.147 +    Bytef   *name;      /* pointer to zero-terminated file name or Z_NULL */
 280.148 +    uInt    name_max;   /* space at name (only when reading header) */
 280.149 +    Bytef   *comment;   /* pointer to zero-terminated comment or Z_NULL */
 280.150 +    uInt    comm_max;   /* space at comment (only when reading header) */
 280.151 +    int     hcrc;       /* true if there was or will be a header crc */
 280.152 +    int     done;       /* true when done reading gzip header (not used
 280.153 +                           when writing a gzip file) */
 280.154 +} gz_header;
 280.155 +
 280.156 +typedef gz_header FAR *gz_headerp;
 280.157 +
 280.158 +/*
 280.159 +     The application must update next_in and avail_in when avail_in has dropped
 280.160 +   to zero.  It must update next_out and avail_out when avail_out has dropped
 280.161 +   to zero.  The application must initialize zalloc, zfree and opaque before
 280.162 +   calling the init function.  All other fields are set by the compression
 280.163 +   library and must not be updated by the application.
 280.164 +
 280.165 +     The opaque value provided by the application will be passed as the first
 280.166 +   parameter for calls of zalloc and zfree.  This can be useful for custom
 280.167 +   memory management.  The compression library attaches no meaning to the
 280.168 +   opaque value.
 280.169 +
 280.170 +     zalloc must return Z_NULL if there is not enough memory for the object.
 280.171 +   If zlib is used in a multi-threaded application, zalloc and zfree must be
 280.172 +   thread safe.
 280.173 +
 280.174 +     On 16-bit systems, the functions zalloc and zfree must be able to allocate
 280.175 +   exactly 65536 bytes, but will not be required to allocate more than this if
 280.176 +   the symbol MAXSEG_64K is defined (see zconf.h).  WARNING: On MSDOS, pointers
 280.177 +   returned by zalloc for objects of exactly 65536 bytes *must* have their
 280.178 +   offset normalized to zero.  The default allocation function provided by this
 280.179 +   library ensures this (see zutil.c).  To reduce memory requirements and avoid
 280.180 +   any allocation of 64K objects, at the expense of compression ratio, compile
 280.181 +   the library with -DMAX_WBITS=14 (see zconf.h).
 280.182 +
 280.183 +     The fields total_in and total_out can be used for statistics or progress
 280.184 +   reports.  After compression, total_in holds the total size of the
 280.185 +   uncompressed data and may be saved for use in the decompressor (particularly
 280.186 +   if the decompressor wants to decompress everything in a single step).
 280.187 +*/
 280.188 +
 280.189 +                        /* constants */
 280.190 +
 280.191 +#define Z_NO_FLUSH      0
 280.192 +#define Z_PARTIAL_FLUSH 1
 280.193 +#define Z_SYNC_FLUSH    2
 280.194 +#define Z_FULL_FLUSH    3
 280.195 +#define Z_FINISH        4
 280.196 +#define Z_BLOCK         5
 280.197 +#define Z_TREES         6
 280.198 +/* Allowed flush values; see deflate() and inflate() below for details */
 280.199 +
 280.200 +#define Z_OK            0
 280.201 +#define Z_STREAM_END    1
 280.202 +#define Z_NEED_DICT     2
 280.203 +#define Z_ERRNO        (-1)
 280.204 +#define Z_STREAM_ERROR (-2)
 280.205 +#define Z_DATA_ERROR   (-3)
 280.206 +#define Z_MEM_ERROR    (-4)
 280.207 +#define Z_BUF_ERROR    (-5)
 280.208 +#define Z_VERSION_ERROR (-6)
 280.209 +/* Return codes for the compression/decompression functions. Negative values
 280.210 + * are errors, positive values are used for special but normal events.
 280.211 + */
 280.212 +
 280.213 +#define Z_NO_COMPRESSION         0
 280.214 +#define Z_BEST_SPEED             1
 280.215 +#define Z_BEST_COMPRESSION       9
 280.216 +#define Z_DEFAULT_COMPRESSION  (-1)
 280.217 +/* compression levels */
 280.218 +
 280.219 +#define Z_FILTERED            1
 280.220 +#define Z_HUFFMAN_ONLY        2
 280.221 +#define Z_RLE                 3
 280.222 +#define Z_FIXED               4
 280.223 +#define Z_DEFAULT_STRATEGY    0
 280.224 +/* compression strategy; see deflateInit2() below for details */
 280.225 +
 280.226 +#define Z_BINARY   0
 280.227 +#define Z_TEXT     1
 280.228 +#define Z_ASCII    Z_TEXT   /* for compatibility with 1.2.2 and earlier */
 280.229 +#define Z_UNKNOWN  2
 280.230 +/* Possible values of the data_type field (though see inflate()) */
 280.231 +
 280.232 +#define Z_DEFLATED   8
 280.233 +/* The deflate compression method (the only one supported in this version) */
 280.234 +
 280.235 +#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
 280.236 +
 280.237 +#define zlib_version zlibVersion()
 280.238 +/* for compatibility with versions < 1.0.2 */
 280.239 +
 280.240 +
 280.241 +                        /* basic functions */
 280.242 +
 280.243 +ZEXTERN const char * ZEXPORT zlibVersion OF((void));
 280.244 +/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
 280.245 +   If the first character differs, the library code actually used is not
 280.246 +   compatible with the zlib.h header file used by the application.  This check
 280.247 +   is automatically made by deflateInit and inflateInit.
 280.248 + */
 280.249 +
 280.250 +/*
 280.251 +ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
 280.252 +
 280.253 +     Initializes the internal stream state for compression.  The fields
 280.254 +   zalloc, zfree and opaque must be initialized before by the caller.  If
 280.255 +   zalloc and zfree are set to Z_NULL, deflateInit updates them to use default
 280.256 +   allocation functions.
 280.257 +
 280.258 +     The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
 280.259 +   1 gives best speed, 9 gives best compression, 0 gives no compression at all
 280.260 +   (the input data is simply copied a block at a time).  Z_DEFAULT_COMPRESSION
 280.261 +   requests a default compromise between speed and compression (currently
 280.262 +   equivalent to level 6).
 280.263 +
 280.264 +     deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
 280.265 +   memory, Z_STREAM_ERROR if level is not a valid compression level, or
 280.266 +   Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
 280.267 +   with the version assumed by the caller (ZLIB_VERSION).  msg is set to null
 280.268 +   if there is no error message.  deflateInit does not perform any compression:
 280.269 +   this will be done by deflate().
 280.270 +*/
 280.271 +
 280.272 +
 280.273 +ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
 280.274 +/*
 280.275 +    deflate compresses as much data as possible, and stops when the input
 280.276 +  buffer becomes empty or the output buffer becomes full.  It may introduce
 280.277 +  some output latency (reading input without producing any output) except when
 280.278 +  forced to flush.
 280.279 +
 280.280 +    The detailed semantics are as follows.  deflate performs one or both of the
 280.281 +  following actions:
 280.282 +
 280.283 +  - Compress more input starting at next_in and update next_in and avail_in
 280.284 +    accordingly.  If not all input can be processed (because there is not
 280.285 +    enough room in the output buffer), next_in and avail_in are updated and
 280.286 +    processing will resume at this point for the next call of deflate().
 280.287 +
 280.288 +  - Provide more output starting at next_out and update next_out and avail_out
 280.289 +    accordingly.  This action is forced if the parameter flush is non zero.
 280.290 +    Forcing flush frequently degrades the compression ratio, so this parameter
 280.291 +    should be set only when necessary (in interactive applications).  Some
 280.292 +    output may be provided even if flush is not set.
 280.293 +
 280.294 +    Before the call of deflate(), the application should ensure that at least
 280.295 +  one of the actions is possible, by providing more input and/or consuming more
 280.296 +  output, and updating avail_in or avail_out accordingly; avail_out should
 280.297 +  never be zero before the call.  The application can consume the compressed
 280.298 +  output when it wants, for example when the output buffer is full (avail_out
 280.299 +  == 0), or after each call of deflate().  If deflate returns Z_OK and with
 280.300 +  zero avail_out, it must be called again after making room in the output
 280.301 +  buffer because there might be more output pending.
 280.302 +
 280.303 +    Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
 280.304 +  decide how much data to accumulate before producing output, in order to
 280.305 +  maximize compression.
 280.306 +
 280.307 +    If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
 280.308 +  flushed to the output buffer and the output is aligned on a byte boundary, so
 280.309 +  that the decompressor can get all input data available so far.  (In
 280.310 +  particular avail_in is zero after the call if enough output space has been
 280.311 +  provided before the call.) Flushing may degrade compression for some
 280.312 +  compression algorithms and so it should be used only when necessary.  This
 280.313 +  completes the current deflate block and follows it with an empty stored block
 280.314 +  that is three bits plus filler bits to the next byte, followed by four bytes
 280.315 +  (00 00 ff ff).
 280.316 +
 280.317 +    If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the
 280.318 +  output buffer, but the output is not aligned to a byte boundary.  All of the
 280.319 +  input data so far will be available to the decompressor, as for Z_SYNC_FLUSH.
 280.320 +  This completes the current deflate block and follows it with an empty fixed
 280.321 +  codes block that is 10 bits long.  This assures that enough bytes are output
 280.322 +  in order for the decompressor to finish the block before the empty fixed code
 280.323 +  block.
 280.324 +
 280.325 +    If flush is set to Z_BLOCK, a deflate block is completed and emitted, as
 280.326 +  for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to
 280.327 +  seven bits of the current block are held to be written as the next byte after
 280.328 +  the next deflate block is completed.  In this case, the decompressor may not
 280.329 +  be provided enough bits at this point in order to complete decompression of
 280.330 +  the data provided so far to the compressor.  It may need to wait for the next
 280.331 +  block to be emitted.  This is for advanced applications that need to control
 280.332 +  the emission of deflate blocks.
 280.333 +
 280.334 +    If flush is set to Z_FULL_FLUSH, all output is flushed as with
 280.335 +  Z_SYNC_FLUSH, and the compression state is reset so that decompression can
 280.336 +  restart from this point if previous compressed data has been damaged or if
 280.337 +  random access is desired.  Using Z_FULL_FLUSH too often can seriously degrade
 280.338 +  compression.
 280.339 +
 280.340 +    If deflate returns with avail_out == 0, this function must be called again
 280.341 +  with the same value of the flush parameter and more output space (updated
 280.342 +  avail_out), until the flush is complete (deflate returns with non-zero
 280.343 +  avail_out).  In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
 280.344 +  avail_out is greater than six to avoid repeated flush markers due to
 280.345 +  avail_out == 0 on return.
 280.346 +
 280.347 +    If the parameter flush is set to Z_FINISH, pending input is processed,
 280.348 +  pending output is flushed and deflate returns with Z_STREAM_END if there was
 280.349 +  enough output space; if deflate returns with Z_OK, this function must be
 280.350 +  called again with Z_FINISH and more output space (updated avail_out) but no
 280.351 +  more input data, until it returns with Z_STREAM_END or an error.  After
 280.352 +  deflate has returned Z_STREAM_END, the only possible operations on the stream
 280.353 +  are deflateReset or deflateEnd.
 280.354 +
 280.355 +    Z_FINISH can be used immediately after deflateInit if all the compression
 280.356 +  is to be done in a single step.  In this case, avail_out must be at least the
 280.357 +  value returned by deflateBound (see below).  If deflate does not return
 280.358 +  Z_STREAM_END, then it must be called again as described above.
 280.359 +
 280.360 +    deflate() sets strm->adler to the adler32 checksum of all input read
 280.361 +  so far (that is, total_in bytes).
 280.362 +
 280.363 +    deflate() may update strm->data_type if it can make a good guess about
 280.364 +  the input data type (Z_BINARY or Z_TEXT).  In doubt, the data is considered
 280.365 +  binary.  This field is only for information purposes and does not affect the
 280.366 +  compression algorithm in any manner.
 280.367 +
 280.368 +    deflate() returns Z_OK if some progress has been made (more input
 280.369 +  processed or more output produced), Z_STREAM_END if all input has been
 280.370 +  consumed and all output has been produced (only when flush is set to
 280.371 +  Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
 280.372 +  if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible
 280.373 +  (for example avail_in or avail_out was zero).  Note that Z_BUF_ERROR is not
 280.374 +  fatal, and deflate() can be called again with more input and more output
 280.375 +  space to continue compressing.
 280.376 +*/
 280.377 +
 280.378 +
 280.379 +ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
 280.380 +/*
 280.381 +     All dynamically allocated data structures for this stream are freed.
 280.382 +   This function discards any unprocessed input and does not flush any pending
 280.383 +   output.
 280.384 +
 280.385 +     deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
 280.386 +   stream state was inconsistent, Z_DATA_ERROR if the stream was freed
 280.387 +   prematurely (some input or output was discarded).  In the error case, msg
 280.388 +   may be set but then points to a static string (which must not be
 280.389 +   deallocated).
 280.390 +*/
 280.391 +
 280.392 +
 280.393 +/*
 280.394 +ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
 280.395 +
 280.396 +     Initializes the internal stream state for decompression.  The fields
 280.397 +   next_in, avail_in, zalloc, zfree and opaque must be initialized before by
 280.398 +   the caller.  If next_in is not Z_NULL and avail_in is large enough (the
 280.399 +   exact value depends on the compression method), inflateInit determines the
 280.400 +   compression method from the zlib header and allocates all data structures
 280.401 +   accordingly; otherwise the allocation will be deferred to the first call of
 280.402 +   inflate.  If zalloc and zfree are set to Z_NULL, inflateInit updates them to
 280.403 +   use default allocation functions.
 280.404 +
 280.405 +     inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
 280.406 +   memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
 280.407 +   version assumed by the caller, or Z_STREAM_ERROR if the parameters are
 280.408 +   invalid, such as a null pointer to the structure.  msg is set to null if
 280.409 +   there is no error message.  inflateInit does not perform any decompression
 280.410 +   apart from possibly reading the zlib header if present: actual decompression
 280.411 +   will be done by inflate().  (So next_in and avail_in may be modified, but
 280.412 +   next_out and avail_out are unused and unchanged.) The current implementation
 280.413 +   of inflateInit() does not process any header information -- that is deferred
 280.414 +   until inflate() is called.
 280.415 +*/
 280.416 +
 280.417 +
 280.418 +ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
 280.419 +/*
 280.420 +    inflate decompresses as much data as possible, and stops when the input
 280.421 +  buffer becomes empty or the output buffer becomes full.  It may introduce
 280.422 +  some output latency (reading input without producing any output) except when
 280.423 +  forced to flush.
 280.424 +
 280.425 +  The detailed semantics are as follows.  inflate performs one or both of the
 280.426 +  following actions:
 280.427 +
 280.428 +  - Decompress more input starting at next_in and update next_in and avail_in
 280.429 +    accordingly.  If not all input can be processed (because there is not
 280.430 +    enough room in the output buffer), next_in is updated and processing will
 280.431 +    resume at this point for the next call of inflate().
 280.432 +
 280.433 +  - Provide more output starting at next_out and update next_out and avail_out
 280.434 +    accordingly.  inflate() provides as much output as possible, until there is
 280.435 +    no more input data or no more space in the output buffer (see below about
 280.436 +    the flush parameter).
 280.437 +
 280.438 +    Before the call of inflate(), the application should ensure that at least
 280.439 +  one of the actions is possible, by providing more input and/or consuming more
 280.440 +  output, and updating the next_* and avail_* values accordingly.  The
 280.441 +  application can consume the uncompressed output when it wants, for example
 280.442 +  when the output buffer is full (avail_out == 0), or after each call of
 280.443 +  inflate().  If inflate returns Z_OK and with zero avail_out, it must be
 280.444 +  called again after making room in the output buffer because there might be
 280.445 +  more output pending.
 280.446 +
 280.447 +    The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH,
 280.448 +  Z_BLOCK, or Z_TREES.  Z_SYNC_FLUSH requests that inflate() flush as much
 280.449 +  output as possible to the output buffer.  Z_BLOCK requests that inflate()
 280.450 +  stop if and when it gets to the next deflate block boundary.  When decoding
 280.451 +  the zlib or gzip format, this will cause inflate() to return immediately
 280.452 +  after the header and before the first block.  When doing a raw inflate,
 280.453 +  inflate() will go ahead and process the first block, and will return when it
 280.454 +  gets to the end of that block, or when it runs out of data.
 280.455 +
 280.456 +    The Z_BLOCK option assists in appending to or combining deflate streams.
 280.457 +  Also to assist in this, on return inflate() will set strm->data_type to the
 280.458 +  number of unused bits in the last byte taken from strm->next_in, plus 64 if
 280.459 +  inflate() is currently decoding the last block in the deflate stream, plus
 280.460 +  128 if inflate() returned immediately after decoding an end-of-block code or
 280.461 +  decoding the complete header up to just before the first byte of the deflate
 280.462 +  stream.  The end-of-block will not be indicated until all of the uncompressed
 280.463 +  data from that block has been written to strm->next_out.  The number of
 280.464 +  unused bits may in general be greater than seven, except when bit 7 of
 280.465 +  data_type is set, in which case the number of unused bits will be less than
 280.466 +  eight.  data_type is set as noted here every time inflate() returns for all
 280.467 +  flush options, and so can be used to determine the amount of currently
 280.468 +  consumed input in bits.
 280.469 +
 280.470 +    The Z_TREES option behaves as Z_BLOCK does, but it also returns when the
 280.471 +  end of each deflate block header is reached, before any actual data in that
 280.472 +  block is decoded.  This allows the caller to determine the length of the
 280.473 +  deflate block header for later use in random access within a deflate block.
 280.474 +  256 is added to the value of strm->data_type when inflate() returns
 280.475 +  immediately after reaching the end of the deflate block header.
 280.476 +
 280.477 +    inflate() should normally be called until it returns Z_STREAM_END or an
 280.478 +  error.  However if all decompression is to be performed in a single step (a
 280.479 +  single call of inflate), the parameter flush should be set to Z_FINISH.  In
 280.480 +  this case all pending input is processed and all pending output is flushed;
 280.481 +  avail_out must be large enough to hold all the uncompressed data.  (The size
 280.482 +  of the uncompressed data may have been saved by the compressor for this
 280.483 +  purpose.) The next operation on this stream must be inflateEnd to deallocate
 280.484 +  the decompression state.  The use of Z_FINISH is never required, but can be
 280.485 +  used to inform inflate that a faster approach may be used for the single
 280.486 +  inflate() call.
 280.487 +
 280.488 +     In this implementation, inflate() always flushes as much output as
 280.489 +  possible to the output buffer, and always uses the faster approach on the
 280.490 +  first call.  So the only effect of the flush parameter in this implementation
 280.491 +  is on the return value of inflate(), as noted below, or when it returns early
 280.492 +  because Z_BLOCK or Z_TREES is used.
 280.493 +
 280.494 +     If a preset dictionary is needed after this call (see inflateSetDictionary
 280.495 +  below), inflate sets strm->adler to the adler32 checksum of the dictionary
 280.496 +  chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
 280.497 +  strm->adler to the adler32 checksum of all output produced so far (that is,
 280.498 +  total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
 280.499 +  below.  At the end of the stream, inflate() checks that its computed adler32
 280.500 +  checksum is equal to that saved by the compressor and returns Z_STREAM_END
 280.501 +  only if the checksum is correct.
 280.502 +
 280.503 +    inflate() can decompress and check either zlib-wrapped or gzip-wrapped
 280.504 +  deflate data.  The header type is detected automatically, if requested when
 280.505 +  initializing with inflateInit2().  Any information contained in the gzip
 280.506 +  header is not retained, so applications that need that information should
 280.507 +  instead use raw inflate, see inflateInit2() below, or inflateBack() and
 280.508 +  perform their own processing of the gzip header and trailer.
 280.509 +
 280.510 +    inflate() returns Z_OK if some progress has been made (more input processed
 280.511 +  or more output produced), Z_STREAM_END if the end of the compressed data has
 280.512 +  been reached and all uncompressed output has been produced, Z_NEED_DICT if a
 280.513 +  preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
 280.514 +  corrupted (input stream not conforming to the zlib format or incorrect check
 280.515 +  value), Z_STREAM_ERROR if the stream structure was inconsistent (for example
 280.516 +  next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory,
 280.517 +  Z_BUF_ERROR if no progress is possible or if there was not enough room in the
 280.518 +  output buffer when Z_FINISH is used.  Note that Z_BUF_ERROR is not fatal, and
 280.519 +  inflate() can be called again with more input and more output space to
 280.520 +  continue decompressing.  If Z_DATA_ERROR is returned, the application may
 280.521 +  then call inflateSync() to look for a good compression block if a partial
 280.522 +  recovery of the data is desired.
 280.523 +*/
 280.524 +
 280.525 +
 280.526 +ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
 280.527 +/*
 280.528 +     All dynamically allocated data structures for this stream are freed.
 280.529 +   This function discards any unprocessed input and does not flush any pending
 280.530 +   output.
 280.531 +
 280.532 +     inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
 280.533 +   was inconsistent.  In the error case, msg may be set but then points to a
 280.534 +   static string (which must not be deallocated).
 280.535 +*/
 280.536 +
 280.537 +
 280.538 +                        /* Advanced functions */
 280.539 +
 280.540 +/*
 280.541 +    The following functions are needed only in some special applications.
 280.542 +*/
 280.543 +
 280.544 +/*
 280.545 +ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
 280.546 +                                     int  level,
 280.547 +                                     int  method,
 280.548 +                                     int  windowBits,
 280.549 +                                     int  memLevel,
 280.550 +                                     int  strategy));
 280.551 +
 280.552 +     This is another version of deflateInit with more compression options.  The
 280.553 +   fields next_in, zalloc, zfree and opaque must be initialized before by the
 280.554 +   caller.
 280.555 +
 280.556 +     The method parameter is the compression method.  It must be Z_DEFLATED in
 280.557 +   this version of the library.
 280.558 +
 280.559 +     The windowBits parameter is the base two logarithm of the window size
 280.560 +   (the size of the history buffer).  It should be in the range 8..15 for this
 280.561 +   version of the library.  Larger values of this parameter result in better
 280.562 +   compression at the expense of memory usage.  The default value is 15 if
 280.563 +   deflateInit is used instead.
 280.564 +
 280.565 +     windowBits can also be -8..-15 for raw deflate.  In this case, -windowBits
 280.566 +   determines the window size.  deflate() will then generate raw deflate data
 280.567 +   with no zlib header or trailer, and will not compute an adler32 check value.
 280.568 +
 280.569 +     windowBits can also be greater than 15 for optional gzip encoding.  Add
 280.570 +   16 to windowBits to write a simple gzip header and trailer around the
 280.571 +   compressed data instead of a zlib wrapper.  The gzip header will have no
 280.572 +   file name, no extra data, no comment, no modification time (set to zero), no
 280.573 +   header crc, and the operating system will be set to 255 (unknown).  If a
 280.574 +   gzip stream is being written, strm->adler is a crc32 instead of an adler32.
 280.575 +
 280.576 +     The memLevel parameter specifies how much memory should be allocated
 280.577 +   for the internal compression state.  memLevel=1 uses minimum memory but is
 280.578 +   slow and reduces compression ratio; memLevel=9 uses maximum memory for
 280.579 +   optimal speed.  The default value is 8.  See zconf.h for total memory usage
 280.580 +   as a function of windowBits and memLevel.
 280.581 +
 280.582 +     The strategy parameter is used to tune the compression algorithm.  Use the
 280.583 +   value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
 280.584 +   filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no
 280.585 +   string match), or Z_RLE to limit match distances to one (run-length
 280.586 +   encoding).  Filtered data consists mostly of small values with a somewhat
 280.587 +   random distribution.  In this case, the compression algorithm is tuned to
 280.588 +   compress them better.  The effect of Z_FILTERED is to force more Huffman
 280.589 +   coding and less string matching; it is somewhat intermediate between
 280.590 +   Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY.  Z_RLE is designed to be almost as
 280.591 +   fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data.  The
 280.592 +   strategy parameter only affects the compression ratio but not the
 280.593 +   correctness of the compressed output even if it is not set appropriately.
 280.594 +   Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler
 280.595 +   decoder for special applications.
 280.596 +
 280.597 +     deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
 280.598 +   memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid
 280.599 +   method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is
 280.600 +   incompatible with the version assumed by the caller (ZLIB_VERSION).  msg is
 280.601 +   set to null if there is no error message.  deflateInit2 does not perform any
 280.602 +   compression: this will be done by deflate().
 280.603 +*/
 280.604 +
 280.605 +ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
 280.606 +                                             const Bytef *dictionary,
 280.607 +                                             uInt  dictLength));
 280.608 +/*
 280.609 +     Initializes the compression dictionary from the given byte sequence
 280.610 +   without producing any compressed output.  This function must be called
 280.611 +   immediately after deflateInit, deflateInit2 or deflateReset, before any call
 280.612 +   of deflate.  The compressor and decompressor must use exactly the same
 280.613 +   dictionary (see inflateSetDictionary).
 280.614 +
 280.615 +     The dictionary should consist of strings (byte sequences) that are likely
 280.616 +   to be encountered later in the data to be compressed, with the most commonly
 280.617 +   used strings preferably put towards the end of the dictionary.  Using a
 280.618 +   dictionary is most useful when the data to be compressed is short and can be
 280.619 +   predicted with good accuracy; the data can then be compressed better than
 280.620 +   with the default empty dictionary.
 280.621 +
 280.622 +     Depending on the size of the compression data structures selected by
 280.623 +   deflateInit or deflateInit2, a part of the dictionary may in effect be
 280.624 +   discarded, for example if the dictionary is larger than the window size
 280.625 +   provided in deflateInit or deflateInit2.  Thus the strings most likely to be
 280.626 +   useful should be put at the end of the dictionary, not at the front.  In
 280.627 +   addition, the current implementation of deflate will use at most the window
 280.628 +   size minus 262 bytes of the provided dictionary.
 280.629 +
 280.630 +     Upon return of this function, strm->adler is set to the adler32 value
 280.631 +   of the dictionary; the decompressor may later use this value to determine
 280.632 +   which dictionary has been used by the compressor.  (The adler32 value
 280.633 +   applies to the whole dictionary even if only a subset of the dictionary is
 280.634 +   actually used by the compressor.) If a raw deflate was requested, then the
 280.635 +   adler32 value is not computed and strm->adler is not set.
 280.636 +
 280.637 +     deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
 280.638 +   parameter is invalid (e.g.  dictionary being Z_NULL) or the stream state is
 280.639 +   inconsistent (for example if deflate has already been called for this stream
 280.640 +   or if the compression method is bsort).  deflateSetDictionary does not
 280.641 +   perform any compression: this will be done by deflate().
 280.642 +*/
 280.643 +
 280.644 +ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
 280.645 +                                    z_streamp source));
 280.646 +/*
 280.647 +     Sets the destination stream as a complete copy of the source stream.
 280.648 +
 280.649 +     This function can be useful when several compression strategies will be
 280.650 +   tried, for example when there are several ways of pre-processing the input
 280.651 +   data with a filter.  The streams that will be discarded should then be freed
 280.652 +   by calling deflateEnd.  Note that deflateCopy duplicates the internal
 280.653 +   compression state which can be quite large, so this strategy is slow and can
 280.654 +   consume lots of memory.
 280.655 +
 280.656 +     deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
 280.657 +   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
 280.658 +   (such as zalloc being Z_NULL).  msg is left unchanged in both source and
 280.659 +   destination.
 280.660 +*/
 280.661 +
 280.662 +ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
 280.663 +/*
 280.664 +     This function is equivalent to deflateEnd followed by deflateInit,
 280.665 +   but does not free and reallocate all the internal compression state.  The
 280.666 +   stream will keep the same compression level and any other attributes that
 280.667 +   may have been set by deflateInit2.
 280.668 +
 280.669 +     deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
 280.670 +   stream state was inconsistent (such as zalloc or state being Z_NULL).
 280.671 +*/
 280.672 +
 280.673 +ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
 280.674 +                                      int level,
 280.675 +                                      int strategy));
 280.676 +/*
 280.677 +     Dynamically update the compression level and compression strategy.  The
 280.678 +   interpretation of level and strategy is as in deflateInit2.  This can be
 280.679 +   used to switch between compression and straight copy of the input data, or
 280.680 +   to switch to a different kind of input data requiring a different strategy.
 280.681 +   If the compression level is changed, the input available so far is
 280.682 +   compressed with the old level (and may be flushed); the new level will take
 280.683 +   effect only at the next call of deflate().
 280.684 +
 280.685 +     Before the call of deflateParams, the stream state must be set as for
 280.686 +   a call of deflate(), since the currently available input may have to be
 280.687 +   compressed and flushed.  In particular, strm->avail_out must be non-zero.
 280.688 +
 280.689 +     deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
 280.690 +   stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if
 280.691 +   strm->avail_out was zero.
 280.692 +*/
 280.693 +
 280.694 +ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
 280.695 +                                    int good_length,
 280.696 +                                    int max_lazy,
 280.697 +                                    int nice_length,
 280.698 +                                    int max_chain));
 280.699 +/*
 280.700 +     Fine tune deflate's internal compression parameters.  This should only be
 280.701 +   used by someone who understands the algorithm used by zlib's deflate for
 280.702 +   searching for the best matching string, and even then only by the most
 280.703 +   fanatic optimizer trying to squeeze out the last compressed bit for their
 280.704 +   specific input data.  Read the deflate.c source code for the meaning of the
 280.705 +   max_lazy, good_length, nice_length, and max_chain parameters.
 280.706 +
 280.707 +     deflateTune() can be called after deflateInit() or deflateInit2(), and
 280.708 +   returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
 280.709 + */
 280.710 +
 280.711 +ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
 280.712 +                                       uLong sourceLen));
 280.713 +/*
 280.714 +     deflateBound() returns an upper bound on the compressed size after
 280.715 +   deflation of sourceLen bytes.  It must be called after deflateInit() or
 280.716 +   deflateInit2(), and after deflateSetHeader(), if used.  This would be used
 280.717 +   to allocate an output buffer for deflation in a single pass, and so would be
 280.718 +   called before deflate().
 280.719 +*/
 280.720 +
 280.721 +ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
 280.722 +                                     int bits,
 280.723 +                                     int value));
 280.724 +/*
 280.725 +     deflatePrime() inserts bits in the deflate output stream.  The intent
 280.726 +   is that this function is used to start off the deflate output with the bits
 280.727 +   leftover from a previous deflate stream when appending to it.  As such, this
 280.728 +   function can only be used for raw deflate, and must be used before the first
 280.729 +   deflate() call after a deflateInit2() or deflateReset().  bits must be less
 280.730 +   than or equal to 16, and that many of the least significant bits of value
 280.731 +   will be inserted in the output.
 280.732 +
 280.733 +     deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
 280.734 +   stream state was inconsistent.
 280.735 +*/
 280.736 +
 280.737 +ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
 280.738 +                                         gz_headerp head));
 280.739 +/*
 280.740 +     deflateSetHeader() provides gzip header information for when a gzip
 280.741 +   stream is requested by deflateInit2().  deflateSetHeader() may be called
 280.742 +   after deflateInit2() or deflateReset() and before the first call of
 280.743 +   deflate().  The text, time, os, extra field, name, and comment information
 280.744 +   in the provided gz_header structure are written to the gzip header (xflag is
 280.745 +   ignored -- the extra flags are set according to the compression level).  The
 280.746 +   caller must assure that, if not Z_NULL, name and comment are terminated with
 280.747 +   a zero byte, and that if extra is not Z_NULL, that extra_len bytes are
 280.748 +   available there.  If hcrc is true, a gzip header crc is included.  Note that
 280.749 +   the current versions of the command-line version of gzip (up through version
 280.750 +   1.3.x) do not support header crc's, and will report that it is a "multi-part
 280.751 +   gzip file" and give up.
 280.752 +
 280.753 +     If deflateSetHeader is not used, the default gzip header has text false,
 280.754 +   the time set to zero, and os set to 255, with no extra, name, or comment
 280.755 +   fields.  The gzip header is returned to the default state by deflateReset().
 280.756 +
 280.757 +     deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
 280.758 +   stream state was inconsistent.
 280.759 +*/
 280.760 +
 280.761 +/*
 280.762 +ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
 280.763 +                                     int  windowBits));
 280.764 +
 280.765 +     This is another version of inflateInit with an extra parameter.  The
 280.766 +   fields next_in, avail_in, zalloc, zfree and opaque must be initialized
 280.767 +   before by the caller.
 280.768 +
 280.769 +     The windowBits parameter is the base two logarithm of the maximum window
 280.770 +   size (the size of the history buffer).  It should be in the range 8..15 for
 280.771 +   this version of the library.  The default value is 15 if inflateInit is used
 280.772 +   instead.  windowBits must be greater than or equal to the windowBits value
 280.773 +   provided to deflateInit2() while compressing, or it must be equal to 15 if
 280.774 +   deflateInit2() was not used.  If a compressed stream with a larger window
 280.775 +   size is given as input, inflate() will return with the error code
 280.776 +   Z_DATA_ERROR instead of trying to allocate a larger window.
 280.777 +
 280.778 +     windowBits can also be zero to request that inflate use the window size in
 280.779 +   the zlib header of the compressed stream.
 280.780 +
 280.781 +     windowBits can also be -8..-15 for raw inflate.  In this case, -windowBits
 280.782 +   determines the window size.  inflate() will then process raw deflate data,
 280.783 +   not looking for a zlib or gzip header, not generating a check value, and not
 280.784 +   looking for any check values for comparison at the end of the stream.  This
 280.785 +   is for use with other formats that use the deflate compressed data format
 280.786 +   such as zip.  Those formats provide their own check values.  If a custom
 280.787 +   format is developed using the raw deflate format for compressed data, it is
 280.788 +   recommended that a check value such as an adler32 or a crc32 be applied to
 280.789 +   the uncompressed data as is done in the zlib, gzip, and zip formats.  For
 280.790 +   most applications, the zlib format should be used as is.  Note that comments
 280.791 +   above on the use in deflateInit2() applies to the magnitude of windowBits.
 280.792 +
 280.793 +     windowBits can also be greater than 15 for optional gzip decoding.  Add
 280.794 +   32 to windowBits to enable zlib and gzip decoding with automatic header
 280.795 +   detection, or add 16 to decode only the gzip format (the zlib format will
 280.796 +   return a Z_DATA_ERROR).  If a gzip stream is being decoded, strm->adler is a
 280.797 +   crc32 instead of an adler32.
 280.798 +
 280.799 +     inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
 280.800 +   memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
 280.801 +   version assumed by the caller, or Z_STREAM_ERROR if the parameters are
 280.802 +   invalid, such as a null pointer to the structure.  msg is set to null if
 280.803 +   there is no error message.  inflateInit2 does not perform any decompression
 280.804 +   apart from possibly reading the zlib header if present: actual decompression
 280.805 +   will be done by inflate().  (So next_in and avail_in may be modified, but
 280.806 +   next_out and avail_out are unused and unchanged.) The current implementation
 280.807 +   of inflateInit2() does not process any header information -- that is
 280.808 +   deferred until inflate() is called.
 280.809 +*/
 280.810 +
 280.811 +ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
 280.812 +                                             const Bytef *dictionary,
 280.813 +                                             uInt  dictLength));
 280.814 +/*
 280.815 +     Initializes the decompression dictionary from the given uncompressed byte
 280.816 +   sequence.  This function must be called immediately after a call of inflate,
 280.817 +   if that call returned Z_NEED_DICT.  The dictionary chosen by the compressor
 280.818 +   can be determined from the adler32 value returned by that call of inflate.
 280.819 +   The compressor and decompressor must use exactly the same dictionary (see
 280.820 +   deflateSetDictionary).  For raw inflate, this function can be called
 280.821 +   immediately after inflateInit2() or inflateReset() and before any call of
 280.822 +   inflate() to set the dictionary.  The application must insure that the
 280.823 +   dictionary that was used for compression is provided.
 280.824 +
 280.825 +     inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
 280.826 +   parameter is invalid (e.g.  dictionary being Z_NULL) or the stream state is
 280.827 +   inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
 280.828 +   expected one (incorrect adler32 value).  inflateSetDictionary does not
 280.829 +   perform any decompression: this will be done by subsequent calls of
 280.830 +   inflate().
 280.831 +*/
 280.832 +
 280.833 +ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
 280.834 +/*
 280.835 +     Skips invalid compressed data until a full flush point (see above the
 280.836 +   description of deflate with Z_FULL_FLUSH) can be found, or until all
 280.837 +   available input is skipped.  No output is provided.
 280.838 +
 280.839 +     inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
 280.840 +   if no more input was provided, Z_DATA_ERROR if no flush point has been
 280.841 +   found, or Z_STREAM_ERROR if the stream structure was inconsistent.  In the
 280.842 +   success case, the application may save the current current value of total_in
 280.843 +   which indicates where valid compressed data was found.  In the error case,
 280.844 +   the application may repeatedly call inflateSync, providing more input each
 280.845 +   time, until success or end of the input data.
 280.846 +*/
 280.847 +
 280.848 +ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
 280.849 +                                    z_streamp source));
 280.850 +/*
 280.851 +     Sets the destination stream as a complete copy of the source stream.
 280.852 +
 280.853 +     This function can be useful when randomly accessing a large stream.  The
 280.854 +   first pass through the stream can periodically record the inflate state,
 280.855 +   allowing restarting inflate at those points when randomly accessing the
 280.856 +   stream.
 280.857 +
 280.858 +     inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
 280.859 +   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
 280.860 +   (such as zalloc being Z_NULL).  msg is left unchanged in both source and
 280.861 +   destination.
 280.862 +*/
 280.863 +
 280.864 +ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
 280.865 +/*
 280.866 +     This function is equivalent to inflateEnd followed by inflateInit,
 280.867 +   but does not free and reallocate all the internal decompression state.  The
 280.868 +   stream will keep attributes that may have been set by inflateInit2.
 280.869 +
 280.870 +     inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
 280.871 +   stream state was inconsistent (such as zalloc or state being Z_NULL).
 280.872 +*/
 280.873 +
 280.874 +ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,
 280.875 +                                      int windowBits));
 280.876 +/*
 280.877 +     This function is the same as inflateReset, but it also permits changing
 280.878 +   the wrap and window size requests.  The windowBits parameter is interpreted
 280.879 +   the same as it is for inflateInit2.
 280.880 +
 280.881 +     inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source
 280.882 +   stream state was inconsistent (such as zalloc or state being Z_NULL), or if
 280.883 +   the windowBits parameter is invalid.
 280.884 +*/
 280.885 +
 280.886 +ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
 280.887 +                                     int bits,
 280.888 +                                     int value));
 280.889 +/*
 280.890 +     This function inserts bits in the inflate input stream.  The intent is
 280.891 +   that this function is used to start inflating at a bit position in the
 280.892 +   middle of a byte.  The provided bits will be used before any bytes are used
 280.893 +   from next_in.  This function should only be used with raw inflate, and
 280.894 +   should be used before the first inflate() call after inflateInit2() or
 280.895 +   inflateReset().  bits must be less than or equal to 16, and that many of the
 280.896 +   least significant bits of value will be inserted in the input.
 280.897 +
 280.898 +     If bits is negative, then the input stream bit buffer is emptied.  Then
 280.899 +   inflatePrime() can be called again to put bits in the buffer.  This is used
 280.900 +   to clear out bits leftover after feeding inflate a block description prior
 280.901 +   to feeding inflate codes.
 280.902 +
 280.903 +     inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
 280.904 +   stream state was inconsistent.
 280.905 +*/
 280.906 +
 280.907 +ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm));
 280.908 +/*
 280.909 +     This function returns two values, one in the lower 16 bits of the return
 280.910 +   value, and the other in the remaining upper bits, obtained by shifting the
 280.911 +   return value down 16 bits.  If the upper value is -1 and the lower value is
 280.912 +   zero, then inflate() is currently decoding information outside of a block.
 280.913 +   If the upper value is -1 and the lower value is non-zero, then inflate is in
 280.914 +   the middle of a stored block, with the lower value equaling the number of
 280.915 +   bytes from the input remaining to copy.  If the upper value is not -1, then
 280.916 +   it is the number of bits back from the current bit position in the input of
 280.917 +   the code (literal or length/distance pair) currently being processed.  In
 280.918 +   that case the lower value is the number of bytes already emitted for that
 280.919 +   code.
 280.920 +
 280.921 +     A code is being processed if inflate is waiting for more input to complete
 280.922 +   decoding of the code, or if it has completed decoding but is waiting for
 280.923 +   more output space to write the literal or match data.
 280.924 +
 280.925 +     inflateMark() is used to mark locations in the input data for random
 280.926 +   access, which may be at bit positions, and to note those cases where the
 280.927 +   output of a code may span boundaries of random access blocks.  The current
 280.928 +   location in the input stream can be determined from avail_in and data_type
 280.929 +   as noted in the description for the Z_BLOCK flush parameter for inflate.
 280.930 +
 280.931 +     inflateMark returns the value noted above or -1 << 16 if the provided
 280.932 +   source stream state was inconsistent.
 280.933 +*/
 280.934 +
 280.935 +ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
 280.936 +                                         gz_headerp head));
 280.937 +/*
 280.938 +     inflateGetHeader() requests that gzip header information be stored in the
 280.939 +   provided gz_header structure.  inflateGetHeader() may be called after
 280.940 +   inflateInit2() or inflateReset(), and before the first call of inflate().
 280.941 +   As inflate() processes the gzip stream, head->done is zero until the header
 280.942 +   is completed, at which time head->done is set to one.  If a zlib stream is
 280.943 +   being decoded, then head->done is set to -1 to indicate that there will be
 280.944 +   no gzip header information forthcoming.  Note that Z_BLOCK or Z_TREES can be
 280.945 +   used to force inflate() to return immediately after header processing is
 280.946 +   complete and before any actual data is decompressed.
 280.947 +
 280.948 +     The text, time, xflags, and os fields are filled in with the gzip header
 280.949 +   contents.  hcrc is set to true if there is a header CRC.  (The header CRC
 280.950 +   was valid if done is set to one.) If extra is not Z_NULL, then extra_max
 280.951 +   contains the maximum number of bytes to write to extra.  Once done is true,
 280.952 +   extra_len contains the actual extra field length, and extra contains the
 280.953 +   extra field, or that field truncated if extra_max is less than extra_len.
 280.954 +   If name is not Z_NULL, then up to name_max characters are written there,
 280.955 +   terminated with a zero unless the length is greater than name_max.  If
 280.956 +   comment is not Z_NULL, then up to comm_max characters are written there,
 280.957 +   terminated with a zero unless the length is greater than comm_max.  When any
 280.958 +   of extra, name, or comment are not Z_NULL and the respective field is not
 280.959 +   present in the header, then that field is set to Z_NULL to signal its
 280.960 +   absence.  This allows the use of deflateSetHeader() with the returned
 280.961 +   structure to duplicate the header.  However if those fields are set to
 280.962 +   allocated memory, then the application will need to save those pointers
 280.963 +   elsewhere so that they can be eventually freed.
 280.964 +
 280.965 +     If inflateGetHeader is not used, then the header information is simply
 280.966 +   discarded.  The header is always checked for validity, including the header
 280.967 +   CRC if present.  inflateReset() will reset the process to discard the header
 280.968 +   information.  The application would need to call inflateGetHeader() again to
 280.969 +   retrieve the header from the next gzip stream.
 280.970 +
 280.971 +     inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
 280.972 +   stream state was inconsistent.
 280.973 +*/
 280.974 +
 280.975 +/*
 280.976 +ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
 280.977 +                                        unsigned char FAR *window));
 280.978 +
 280.979 +     Initialize the internal stream state for decompression using inflateBack()
 280.980 +   calls.  The fields zalloc, zfree and opaque in strm must be initialized
 280.981 +   before the call.  If zalloc and zfree are Z_NULL, then the default library-
 280.982 +   derived memory allocation routines are used.  windowBits is the base two
 280.983 +   logarithm of the window size, in the range 8..15.  window is a caller
 280.984 +   supplied buffer of that size.  Except for special applications where it is
 280.985 +   assured that deflate was used with small window sizes, windowBits must be 15
 280.986 +   and a 32K byte window must be supplied to be able to decompress general
 280.987 +   deflate streams.
 280.988 +
 280.989 +     See inflateBack() for the usage of these routines.
 280.990 +
 280.991 +     inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
 280.992 +   the paramaters are invalid, Z_MEM_ERROR if the internal state could not be
 280.993 +   allocated, or Z_VERSION_ERROR if the version of the library does not match
 280.994 +   the version of the header file.
 280.995 +*/
 280.996 +
 280.997 +typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));
 280.998 +typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
 280.999 +
280.1000 +ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
280.1001 +                                    in_func in, void FAR *in_desc,
280.1002 +                                    out_func out, void FAR *out_desc));
280.1003 +/*
280.1004 +     inflateBack() does a raw inflate with a single call using a call-back
280.1005 +   interface for input and output.  This is more efficient than inflate() for
280.1006 +   file i/o applications in that it avoids copying between the output and the
280.1007 +   sliding window by simply making the window itself the output buffer.  This
280.1008 +   function trusts the application to not change the output buffer passed by
280.1009 +   the output function, at least until inflateBack() returns.
280.1010 +
280.1011 +     inflateBackInit() must be called first to allocate the internal state
280.1012 +   and to initialize the state with the user-provided window buffer.
280.1013 +   inflateBack() may then be used multiple times to inflate a complete, raw
280.1014 +   deflate stream with each call.  inflateBackEnd() is then called to free the
280.1015 +   allocated state.
280.1016 +
280.1017 +     A raw deflate stream is one with no zlib or gzip header or trailer.
280.1018 +   This routine would normally be used in a utility that reads zip or gzip
280.1019 +   files and writes out uncompressed files.  The utility would decode the
280.1020 +   header and process the trailer on its own, hence this routine expects only
280.1021 +   the raw deflate stream to decompress.  This is different from the normal
280.1022 +   behavior of inflate(), which expects either a zlib or gzip header and
280.1023 +   trailer around the deflate stream.
280.1024 +
280.1025 +     inflateBack() uses two subroutines supplied by the caller that are then
280.1026 +   called by inflateBack() for input and output.  inflateBack() calls those
280.1027 +   routines until it reads a complete deflate stream and writes out all of the
280.1028 +   uncompressed data, or until it encounters an error.  The function's
280.1029 +   parameters and return types are defined above in the in_func and out_func
280.1030 +   typedefs.  inflateBack() will call in(in_desc, &buf) which should return the
280.1031 +   number of bytes of provided input, and a pointer to that input in buf.  If
280.1032 +   there is no input available, in() must return zero--buf is ignored in that
280.1033 +   case--and inflateBack() will return a buffer error.  inflateBack() will call
280.1034 +   out(out_desc, buf, len) to write the uncompressed data buf[0..len-1].  out()
280.1035 +   should return zero on success, or non-zero on failure.  If out() returns
280.1036 +   non-zero, inflateBack() will return with an error.  Neither in() nor out()
280.1037 +   are permitted to change the contents of the window provided to
280.1038 +   inflateBackInit(), which is also the buffer that out() uses to write from.
280.1039 +   The length written by out() will be at most the window size.  Any non-zero
280.1040 +   amount of input may be provided by in().
280.1041 +
280.1042 +     For convenience, inflateBack() can be provided input on the first call by
280.1043 +   setting strm->next_in and strm->avail_in.  If that input is exhausted, then
280.1044 +   in() will be called.  Therefore strm->next_in must be initialized before
280.1045 +   calling inflateBack().  If strm->next_in is Z_NULL, then in() will be called
280.1046 +   immediately for input.  If strm->next_in is not Z_NULL, then strm->avail_in
280.1047 +   must also be initialized, and then if strm->avail_in is not zero, input will
280.1048 +   initially be taken from strm->next_in[0 ..  strm->avail_in - 1].
280.1049 +
280.1050 +     The in_desc and out_desc parameters of inflateBack() is passed as the
280.1051 +   first parameter of in() and out() respectively when they are called.  These
280.1052 +   descriptors can be optionally used to pass any information that the caller-
280.1053 +   supplied in() and out() functions need to do their job.
280.1054 +
280.1055 +     On return, inflateBack() will set strm->next_in and strm->avail_in to
280.1056 +   pass back any unused input that was provided by the last in() call.  The
280.1057 +   return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR
280.1058 +   if in() or out() returned an error, Z_DATA_ERROR if there was a format error
280.1059 +   in the deflate stream (in which case strm->msg is set to indicate the nature
280.1060 +   of the error), or Z_STREAM_ERROR if the stream was not properly initialized.
280.1061 +   In the case of Z_BUF_ERROR, an input or output error can be distinguished
280.1062 +   using strm->next_in which will be Z_NULL only if in() returned an error.  If
280.1063 +   strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning
280.1064 +   non-zero.  (in() will always be called before out(), so strm->next_in is
280.1065 +   assured to be defined if out() returns non-zero.) Note that inflateBack()
280.1066 +   cannot return Z_OK.
280.1067 +*/
280.1068 +
280.1069 +ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
280.1070 +/*
280.1071 +     All memory allocated by inflateBackInit() is freed.
280.1072 +
280.1073 +     inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream
280.1074 +   state was inconsistent.
280.1075 +*/
280.1076 +
280.1077 +ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
280.1078 +/* Return flags indicating compile-time options.
280.1079 +
280.1080 +    Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
280.1081 +     1.0: size of uInt
280.1082 +     3.2: size of uLong
280.1083 +     5.4: size of voidpf (pointer)
280.1084 +     7.6: size of z_off_t
280.1085 +
280.1086 +    Compiler, assembler, and debug options:
280.1087 +     8: DEBUG
280.1088 +     9: ASMV or ASMINF -- use ASM code
280.1089 +     10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
280.1090 +     11: 0 (reserved)
280.1091 +
280.1092 +    One-time table building (smaller code, but not thread-safe if true):
280.1093 +     12: BUILDFIXED -- build static block decoding tables when needed
280.1094 +     13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed
280.1095 +     14,15: 0 (reserved)
280.1096 +
280.1097 +    Library content (indicates missing functionality):
280.1098 +     16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking
280.1099 +                          deflate code when not needed)
280.1100 +     17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect
280.1101 +                    and decode gzip streams (to avoid linking crc code)
280.1102 +     18-19: 0 (reserved)
280.1103 +
280.1104 +    Operation variations (changes in library functionality):
280.1105 +     20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate
280.1106 +     21: FASTEST -- deflate algorithm with only one, lowest compression level
280.1107 +     22,23: 0 (reserved)
280.1108 +
280.1109 +    The sprintf variant used by gzprintf (zero is best):
280.1110 +     24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format
280.1111 +     25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!
280.1112 +     26: 0 = returns value, 1 = void -- 1 means inferred string length returned
280.1113 +
280.1114 +    Remainder:
280.1115 +     27-31: 0 (reserved)
280.1116 + */
280.1117 +
280.1118 +
280.1119 +                        /* utility functions */
280.1120 +
280.1121 +/*
280.1122 +     The following utility functions are implemented on top of the basic
280.1123 +   stream-oriented functions.  To simplify the interface, some default options
280.1124 +   are assumed (compression level and memory usage, standard memory allocation
280.1125 +   functions).  The source code of these utility functions can be modified if
280.1126 +   you need special options.
280.1127 +*/
280.1128 +
280.1129 +ZEXTERN int ZEXPORT compress OF((Bytef *dest,   uLongf *destLen,
280.1130 +                                 const Bytef *source, uLong sourceLen));
280.1131 +/*
280.1132 +     Compresses the source buffer into the destination buffer.  sourceLen is
280.1133 +   the byte length of the source buffer.  Upon entry, destLen is the total size
280.1134 +   of the destination buffer, which must be at least the value returned by
280.1135 +   compressBound(sourceLen).  Upon exit, destLen is the actual size of the
280.1136 +   compressed buffer.
280.1137 +
280.1138 +     compress returns Z_OK if success, Z_MEM_ERROR if there was not
280.1139 +   enough memory, Z_BUF_ERROR if there was not enough room in the output
280.1140 +   buffer.
280.1141 +*/
280.1142 +
280.1143 +ZEXTERN int ZEXPORT compress2 OF((Bytef *dest,   uLongf *destLen,
280.1144 +                                  const Bytef *source, uLong sourceLen,
280.1145 +                                  int level));
280.1146 +/*
280.1147 +     Compresses the source buffer into the destination buffer.  The level
280.1148 +   parameter has the same meaning as in deflateInit.  sourceLen is the byte
280.1149 +   length of the source buffer.  Upon entry, destLen is the total size of the
280.1150 +   destination buffer, which must be at least the value returned by
280.1151 +   compressBound(sourceLen).  Upon exit, destLen is the actual size of the
280.1152 +   compressed buffer.
280.1153 +
280.1154 +     compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
280.1155 +   memory, Z_BUF_ERROR if there was not enough room in the output buffer,
280.1156 +   Z_STREAM_ERROR if the level parameter is invalid.
280.1157 +*/
280.1158 +
280.1159 +ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
280.1160 +/*
280.1161 +     compressBound() returns an upper bound on the compressed size after
280.1162 +   compress() or compress2() on sourceLen bytes.  It would be used before a
280.1163 +   compress() or compress2() call to allocate the destination buffer.
280.1164 +*/
280.1165 +
280.1166 +ZEXTERN int ZEXPORT uncompress OF((Bytef *dest,   uLongf *destLen,
280.1167 +                                   const Bytef *source, uLong sourceLen));
280.1168 +/*
280.1169 +     Decompresses the source buffer into the destination buffer.  sourceLen is
280.1170 +   the byte length of the source buffer.  Upon entry, destLen is the total size
280.1171 +   of the destination buffer, which must be large enough to hold the entire
280.1172 +   uncompressed data.  (The size of the uncompressed data must have been saved
280.1173 +   previously by the compressor and transmitted to the decompressor by some
280.1174 +   mechanism outside the scope of this compression library.) Upon exit, destLen
280.1175 +   is the actual size of the uncompressed buffer.
280.1176 +
280.1177 +     uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
280.1178 +   enough memory, Z_BUF_ERROR if there was not enough room in the output
280.1179 +   buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete.
280.1180 +*/
280.1181 +
280.1182 +
280.1183 +                        /* gzip file access functions */
280.1184 +
280.1185 +/*
280.1186 +     This library supports reading and writing files in gzip (.gz) format with
280.1187 +   an interface similar to that of stdio, using the functions that start with
280.1188 +   "gz".  The gzip format is different from the zlib format.  gzip is a gzip
280.1189 +   wrapper, documented in RFC 1952, wrapped around a deflate stream.
280.1190 +*/
280.1191 +
280.1192 +typedef voidp gzFile;       /* opaque gzip file descriptor */
280.1193 +
280.1194 +/*
280.1195 +ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
280.1196 +
280.1197 +     Opens a gzip (.gz) file for reading or writing.  The mode parameter is as
280.1198 +   in fopen ("rb" or "wb") but can also include a compression level ("wb9") or
280.1199 +   a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only
280.1200 +   compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F'
280.1201 +   for fixed code compression as in "wb9F".  (See the description of
280.1202 +   deflateInit2 for more information about the strategy parameter.) Also "a"
280.1203 +   can be used instead of "w" to request that the gzip stream that will be
280.1204 +   written be appended to the file.  "+" will result in an error, since reading
280.1205 +   and writing to the same gzip file is not supported.
280.1206 +
280.1207 +     gzopen can be used to read a file which is not in gzip format; in this
280.1208 +   case gzread will directly read from the file without decompression.
280.1209 +
280.1210 +     gzopen returns NULL if the file could not be opened, if there was
280.1211 +   insufficient memory to allocate the gzFile state, or if an invalid mode was
280.1212 +   specified (an 'r', 'w', or 'a' was not provided, or '+' was provided).
280.1213 +   errno can be checked to determine if the reason gzopen failed was that the
280.1214 +   file could not be opened.
280.1215 +*/
280.1216 +
280.1217 +ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
280.1218 +/*
280.1219 +     gzdopen associates a gzFile with the file descriptor fd.  File descriptors
280.1220 +   are obtained from calls like open, dup, creat, pipe or fileno (if the file
280.1221 +   has been previously opened with fopen).  The mode parameter is as in gzopen.
280.1222 +
280.1223 +     The next call of gzclose on the returned gzFile will also close the file
280.1224 +   descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor
280.1225 +   fd.  If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd,
280.1226 +   mode);.  The duplicated descriptor should be saved to avoid a leak, since
280.1227 +   gzdopen does not close fd if it fails.
280.1228 +
280.1229 +     gzdopen returns NULL if there was insufficient memory to allocate the
280.1230 +   gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not
280.1231 +   provided, or '+' was provided), or if fd is -1.  The file descriptor is not
280.1232 +   used until the next gz* read, write, seek, or close operation, so gzdopen
280.1233 +   will not detect if fd is invalid (unless fd is -1).
280.1234 +*/
280.1235 +
280.1236 +ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
280.1237 +/*
280.1238 +     Set the internal buffer size used by this library's functions.  The
280.1239 +   default buffer size is 8192 bytes.  This function must be called after
280.1240 +   gzopen() or gzdopen(), and before any other calls that read or write the
280.1241 +   file.  The buffer memory allocation is always deferred to the first read or
280.1242 +   write.  Two buffers are allocated, either both of the specified size when
280.1243 +   writing, or one of the specified size and the other twice that size when
280.1244 +   reading.  A larger buffer size of, for example, 64K or 128K bytes will
280.1245 +   noticeably increase the speed of decompression (reading).
280.1246 +
280.1247 +     The new buffer size also affects the maximum length for gzprintf().
280.1248 +
280.1249 +     gzbuffer() returns 0 on success, or -1 on failure, such as being called
280.1250 +   too late.
280.1251 +*/
280.1252 +
280.1253 +ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
280.1254 +/*
280.1255 +     Dynamically update the compression level or strategy.  See the description
280.1256 +   of deflateInit2 for the meaning of these parameters.
280.1257 +
280.1258 +     gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
280.1259 +   opened for writing.
280.1260 +*/
280.1261 +
280.1262 +ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
280.1263 +/*
280.1264 +     Reads the given number of uncompressed bytes from the compressed file.  If
280.1265 +   the input file was not in gzip format, gzread copies the given number of
280.1266 +   bytes into the buffer.
280.1267 +
280.1268 +     After reaching the end of a gzip stream in the input, gzread will continue
280.1269 +   to read, looking for another gzip stream, or failing that, reading the rest
280.1270 +   of the input file directly without decompression.  The entire input file
280.1271 +   will be read if gzread is called until it returns less than the requested
280.1272 +   len.
280.1273 +
280.1274 +     gzread returns the number of uncompressed bytes actually read, less than
280.1275 +   len for end of file, or -1 for error.
280.1276 +*/
280.1277 +
280.1278 +ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
280.1279 +                                voidpc buf, unsigned len));
280.1280 +/*
280.1281 +     Writes the given number of uncompressed bytes into the compressed file.
280.1282 +   gzwrite returns the number of uncompressed bytes written or 0 in case of
280.1283 +   error.
280.1284 +*/
280.1285 +
280.1286 +ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
280.1287 +/*
280.1288 +     Converts, formats, and writes the arguments to the compressed file under
280.1289 +   control of the format string, as in fprintf.  gzprintf returns the number of
280.1290 +   uncompressed bytes actually written, or 0 in case of error.  The number of
280.1291 +   uncompressed bytes written is limited to 8191, or one less than the buffer
280.1292 +   size given to gzbuffer().  The caller should assure that this limit is not
280.1293 +   exceeded.  If it is exceeded, then gzprintf() will return an error (0) with
280.1294 +   nothing written.  In this case, there may also be a buffer overflow with
280.1295 +   unpredictable consequences, which is possible only if zlib was compiled with
280.1296 +   the insecure functions sprintf() or vsprintf() because the secure snprintf()
280.1297 +   or vsnprintf() functions were not available.  This can be determined using
280.1298 +   zlibCompileFlags().
280.1299 +*/
280.1300 +
280.1301 +ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
280.1302 +/*
280.1303 +     Writes the given null-terminated string to the compressed file, excluding
280.1304 +   the terminating null character.
280.1305 +
280.1306 +     gzputs returns the number of characters written, or -1 in case of error.
280.1307 +*/
280.1308 +
280.1309 +ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
280.1310 +/*
280.1311 +     Reads bytes from the compressed file until len-1 characters are read, or a
280.1312 +   newline character is read and transferred to buf, or an end-of-file
280.1313 +   condition is encountered.  If any characters are read or if len == 1, the
280.1314 +   string is terminated with a null character.  If no characters are read due
280.1315 +   to an end-of-file or len < 1, then the buffer is left untouched.
280.1316 +
280.1317 +     gzgets returns buf which is a null-terminated string, or it returns NULL
280.1318 +   for end-of-file or in case of error.  If there was an error, the contents at
280.1319 +   buf are indeterminate.
280.1320 +*/
280.1321 +
280.1322 +ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
280.1323 +/*
280.1324 +     Writes c, converted to an unsigned char, into the compressed file.  gzputc
280.1325 +   returns the value that was written, or -1 in case of error.
280.1326 +*/
280.1327 +
280.1328 +ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
280.1329 +/*
280.1330 +     Reads one byte from the compressed file.  gzgetc returns this byte or -1
280.1331 +   in case of end of file or error.
280.1332 +*/
280.1333 +
280.1334 +ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
280.1335 +/*
280.1336 +     Push one character back onto the stream to be read as the first character
280.1337 +   on the next read.  At least one character of push-back is allowed.
280.1338 +   gzungetc() returns the character pushed, or -1 on failure.  gzungetc() will
280.1339 +   fail if c is -1, and may fail if a character has been pushed but not read
280.1340 +   yet.  If gzungetc is used immediately after gzopen or gzdopen, at least the
280.1341 +   output buffer size of pushed characters is allowed.  (See gzbuffer above.)
280.1342 +   The pushed character will be discarded if the stream is repositioned with
280.1343 +   gzseek() or gzrewind().
280.1344 +*/
280.1345 +
280.1346 +ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
280.1347 +/*
280.1348 +     Flushes all pending output into the compressed file.  The parameter flush
280.1349 +   is as in the deflate() function.  The return value is the zlib error number
280.1350 +   (see function gzerror below).  gzflush is only permitted when writing.
280.1351 +
280.1352 +     If the flush parameter is Z_FINISH, the remaining data is written and the
280.1353 +   gzip stream is completed in the output.  If gzwrite() is called again, a new
280.1354 +   gzip stream will be started in the output.  gzread() is able to read such
280.1355 +   concatented gzip streams.
280.1356 +
280.1357 +     gzflush should be called only when strictly necessary because it will
280.1358 +   degrade compression if called too often.
280.1359 +*/
280.1360 +
280.1361 +/*
280.1362 +ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
280.1363 +                                   z_off_t offset, int whence));
280.1364 +
280.1365 +     Sets the starting position for the next gzread or gzwrite on the given
280.1366 +   compressed file.  The offset represents a number of bytes in the
280.1367 +   uncompressed data stream.  The whence parameter is defined as in lseek(2);
280.1368 +   the value SEEK_END is not supported.
280.1369 +
280.1370 +     If the file is opened for reading, this function is emulated but can be
280.1371 +   extremely slow.  If the file is opened for writing, only forward seeks are
280.1372 +   supported; gzseek then compresses a sequence of zeroes up to the new
280.1373 +   starting position.
280.1374 +
280.1375 +     gzseek returns the resulting offset location as measured in bytes from
280.1376 +   the beginning of the uncompressed stream, or -1 in case of error, in
280.1377 +   particular if the file is opened for writing and the new starting position
280.1378 +   would be before the current position.
280.1379 +*/
280.1380 +
280.1381 +ZEXTERN int ZEXPORT    gzrewind OF((gzFile file));
280.1382 +/*
280.1383 +     Rewinds the given file. This function is supported only for reading.
280.1384 +
280.1385 +     gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
280.1386 +*/
280.1387 +
280.1388 +/*
280.1389 +ZEXTERN z_off_t ZEXPORT    gztell OF((gzFile file));
280.1390 +
280.1391 +     Returns the starting position for the next gzread or gzwrite on the given
280.1392 +   compressed file.  This position represents a number of bytes in the
280.1393 +   uncompressed data stream, and is zero when starting, even if appending or
280.1394 +   reading a gzip stream from the middle of a file using gzdopen().
280.1395 +
280.1396 +     gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
280.1397 +*/
280.1398 +
280.1399 +/*
280.1400 +ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file));
280.1401 +
280.1402 +     Returns the current offset in the file being read or written.  This offset
280.1403 +   includes the count of bytes that precede the gzip stream, for example when
280.1404 +   appending or when using gzdopen() for reading.  When reading, the offset
280.1405 +   does not include as yet unused buffered input.  This information can be used
280.1406 +   for a progress indicator.  On error, gzoffset() returns -1.
280.1407 +*/
280.1408 +
280.1409 +ZEXTERN int ZEXPORT gzeof OF((gzFile file));
280.1410 +/*
280.1411 +     Returns true (1) if the end-of-file indicator has been set while reading,
280.1412 +   false (0) otherwise.  Note that the end-of-file indicator is set only if the
280.1413 +   read tried to go past the end of the input, but came up short.  Therefore,
280.1414 +   just like feof(), gzeof() may return false even if there is no more data to
280.1415 +   read, in the event that the last read request was for the exact number of
280.1416 +   bytes remaining in the input file.  This will happen if the input file size
280.1417 +   is an exact multiple of the buffer size.
280.1418 +
280.1419 +     If gzeof() returns true, then the read functions will return no more data,
280.1420 +   unless the end-of-file indicator is reset by gzclearerr() and the input file
280.1421 +   has grown since the previous end of file was detected.
280.1422 +*/
280.1423 +
280.1424 +ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
280.1425 +/*
280.1426 +     Returns true (1) if file is being copied directly while reading, or false
280.1427 +   (0) if file is a gzip stream being decompressed.  This state can change from
280.1428 +   false to true while reading the input file if the end of a gzip stream is
280.1429 +   reached, but is followed by data that is not another gzip stream.
280.1430 +
280.1431 +     If the input file is empty, gzdirect() will return true, since the input
280.1432 +   does not contain a gzip stream.
280.1433 +
280.1434 +     If gzdirect() is used immediately after gzopen() or gzdopen() it will
280.1435 +   cause buffers to be allocated to allow reading the file to determine if it
280.1436 +   is a gzip file.  Therefore if gzbuffer() is used, it should be called before
280.1437 +   gzdirect().
280.1438 +*/
280.1439 +
280.1440 +ZEXTERN int ZEXPORT    gzclose OF((gzFile file));
280.1441 +/*
280.1442 +     Flushes all pending output if necessary, closes the compressed file and
280.1443 +   deallocates the (de)compression state.  Note that once file is closed, you
280.1444 +   cannot call gzerror with file, since its structures have been deallocated.
280.1445 +   gzclose must not be called more than once on the same file, just as free
280.1446 +   must not be called more than once on the same allocation.
280.1447 +
280.1448 +     gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a
280.1449 +   file operation error, or Z_OK on success.
280.1450 +*/
280.1451 +
280.1452 +ZEXTERN int ZEXPORT gzclose_r OF((gzFile file));
280.1453 +ZEXTERN int ZEXPORT gzclose_w OF((gzFile file));
280.1454 +/*
280.1455 +     Same as gzclose(), but gzclose_r() is only for use when reading, and
280.1456 +   gzclose_w() is only for use when writing or appending.  The advantage to
280.1457 +   using these instead of gzclose() is that they avoid linking in zlib
280.1458 +   compression or decompression code that is not used when only reading or only
280.1459 +   writing respectively.  If gzclose() is used, then both compression and
280.1460 +   decompression code will be included the application when linking to a static
280.1461 +   zlib library.
280.1462 +*/
280.1463 +
280.1464 +ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
280.1465 +/*
280.1466 +     Returns the error message for the last error which occurred on the given
280.1467 +   compressed file.  errnum is set to zlib error number.  If an error occurred
280.1468 +   in the file system and not in the compression library, errnum is set to
280.1469 +   Z_ERRNO and the application may consult errno to get the exact error code.
280.1470 +
280.1471 +     The application must not modify the returned string.  Future calls to
280.1472 +   this function may invalidate the previously returned string.  If file is
280.1473 +   closed, then the string previously returned by gzerror will no longer be
280.1474 +   available.
280.1475 +
280.1476 +     gzerror() should be used to distinguish errors from end-of-file for those
280.1477 +   functions above that do not distinguish those cases in their return values.
280.1478 +*/
280.1479 +
280.1480 +ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
280.1481 +/*
280.1482 +     Clears the error and end-of-file flags for file.  This is analogous to the
280.1483 +   clearerr() function in stdio.  This is useful for continuing to read a gzip
280.1484 +   file that is being written concurrently.
280.1485 +*/
280.1486 +
280.1487 +
280.1488 +                        /* checksum functions */
280.1489 +
280.1490 +/*
280.1491 +     These functions are not related to compression but are exported
280.1492 +   anyway because they might be useful in applications using the compression
280.1493 +   library.
280.1494 +*/
280.1495 +
280.1496 +ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
280.1497 +/*
280.1498 +     Update a running Adler-32 checksum with the bytes buf[0..len-1] and
280.1499 +   return the updated checksum.  If buf is Z_NULL, this function returns the
280.1500 +   required initial value for the checksum.
280.1501 +
280.1502 +     An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
280.1503 +   much faster.
280.1504 +
280.1505 +   Usage example:
280.1506 +
280.1507 +     uLong adler = adler32(0L, Z_NULL, 0);
280.1508 +
280.1509 +     while (read_buffer(buffer, length) != EOF) {
280.1510 +       adler = adler32(adler, buffer, length);
280.1511 +     }
280.1512 +     if (adler != original_adler) error();
280.1513 +*/
280.1514 +
280.1515 +/*
280.1516 +ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
280.1517 +                                          z_off_t len2));
280.1518 +
280.1519 +     Combine two Adler-32 checksums into one.  For two sequences of bytes, seq1
280.1520 +   and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
280.1521 +   each, adler1 and adler2.  adler32_combine() returns the Adler-32 checksum of
280.1522 +   seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.
280.1523 +*/
280.1524 +
280.1525 +ZEXTERN uLong ZEXPORT crc32   OF((uLong crc, const Bytef *buf, uInt len));
280.1526 +/*
280.1527 +     Update a running CRC-32 with the bytes buf[0..len-1] and return the
280.1528 +   updated CRC-32.  If buf is Z_NULL, this function returns the required
280.1529 +   initial value for the for the crc.  Pre- and post-conditioning (one's
280.1530 +   complement) is performed within this function so it shouldn't be done by the
280.1531 +   application.
280.1532 +
280.1533 +   Usage example:
280.1534 +
280.1535 +     uLong crc = crc32(0L, Z_NULL, 0);
280.1536 +
280.1537 +     while (read_buffer(buffer, length) != EOF) {
280.1538 +       crc = crc32(crc, buffer, length);
280.1539 +     }
280.1540 +     if (crc != original_crc) error();
280.1541 +*/
280.1542 +
280.1543 +/*
280.1544 +ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
280.1545 +
280.1546 +     Combine two CRC-32 check values into one.  For two sequences of bytes,
280.1547 +   seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
280.1548 +   calculated for each, crc1 and crc2.  crc32_combine() returns the CRC-32
280.1549 +   check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
280.1550 +   len2.
280.1551 +*/
280.1552 +
280.1553 +
280.1554 +                        /* various hacks, don't look :) */
280.1555 +
280.1556 +/* deflateInit and inflateInit are macros to allow checking the zlib version
280.1557 + * and the compiler's view of z_stream:
280.1558 + */
280.1559 +ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
280.1560 +                                     const char *version, int stream_size));
280.1561 +ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
280.1562 +                                     const char *version, int stream_size));
280.1563 +ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int  level, int  method,
280.1564 +                                      int windowBits, int memLevel,
280.1565 +                                      int strategy, const char *version,
280.1566 +                                      int stream_size));
280.1567 +ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int  windowBits,
280.1568 +                                      const char *version, int stream_size));
280.1569 +ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
280.1570 +                                         unsigned char FAR *window,
280.1571 +                                         const char *version,
280.1572 +                                         int stream_size));
280.1573 +#define deflateInit(strm, level) \
280.1574 +        deflateInit_((strm), (level),       ZLIB_VERSION, sizeof(z_stream))
280.1575 +#define inflateInit(strm) \
280.1576 +        inflateInit_((strm),                ZLIB_VERSION, sizeof(z_stream))
280.1577 +#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
280.1578 +        deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
280.1579 +                      (strategy),           ZLIB_VERSION, sizeof(z_stream))
280.1580 +#define inflateInit2(strm, windowBits) \
280.1581 +        inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
280.1582 +#define inflateBackInit(strm, windowBits, window) \
280.1583 +        inflateBackInit_((strm), (windowBits), (window), \
280.1584 +                                            ZLIB_VERSION, sizeof(z_stream))
280.1585 +
280.1586 +/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
280.1587 + * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
280.1588 + * both are true, the application gets the *64 functions, and the regular
280.1589 + * functions are changed to 64 bits) -- in case these are set on systems
280.1590 + * without large file support, _LFS64_LARGEFILE must also be true
280.1591 + */
280.1592 +#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
280.1593 +   ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
280.1594 +   ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
280.1595 +   ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
280.1596 +   ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
280.1597 +   ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t));
280.1598 +   ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));
280.1599 +#endif
280.1600 +
280.1601 +#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0
280.1602 +#  define gzopen gzopen64
280.1603 +#  define gzseek gzseek64
280.1604 +#  define gztell gztell64
280.1605 +#  define gzoffset gzoffset64
280.1606 +#  define adler32_combine adler32_combine64
280.1607 +#  define crc32_combine crc32_combine64
280.1608 +#  ifdef _LARGEFILE64_SOURCE
280.1609 +     ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
280.1610 +     ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
280.1611 +     ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));
280.1612 +     ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile));
280.1613 +     ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
280.1614 +     ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
280.1615 +#  endif
280.1616 +#else
280.1617 +   ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *));
280.1618 +   ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int));
280.1619 +   ZEXTERN z_off_t ZEXPORT gztell OF((gzFile));
280.1620 +   ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile));
280.1621 +   ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
280.1622 +   ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
280.1623 +#endif
280.1624 +
280.1625 +/* hack for buggy compilers */
280.1626 +#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
280.1627 +    struct internal_state {int dummy;};
280.1628 +#endif
280.1629 +
280.1630 +/* undocumented functions */
280.1631 +ZEXTERN const char   * ZEXPORT zError           OF((int));
280.1632 +ZEXTERN int            ZEXPORT inflateSyncPoint OF((z_streamp));
280.1633 +ZEXTERN const unsigned long FAR * ZEXPORT get_crc_table    OF((void));
280.1634 +ZEXTERN int            ZEXPORT inflateUndermine OF((z_streamp, int));
280.1635 +
280.1636 +#ifdef __cplusplus
280.1637 +}
280.1638 +#endif
280.1639 +
280.1640 +#endif /* ZLIB_H */
   281.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   281.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/zutil.c	Mon Dec 19 10:06:23 2011 -0800
   281.3 @@ -0,0 +1,342 @@
   281.4 +/*
   281.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   281.6 + *
   281.7 + * This code is free software; you can redistribute it and/or modify it
   281.8 + * under the terms of the GNU General Public License version 2 only, as
   281.9 + * published by the Free Software Foundation.  Oracle designates this
  281.10 + * particular file as subject to the "Classpath" exception as provided
  281.11 + * by Oracle in the LICENSE file that accompanied this code.
  281.12 + *
  281.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
  281.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  281.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  281.16 + * version 2 for more details (a copy is included in the LICENSE file that
  281.17 + * accompanied this code).
  281.18 + *
  281.19 + * You should have received a copy of the GNU General Public License version
  281.20 + * 2 along with this work; if not, write to the Free Software Foundation,
  281.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  281.22 + *
  281.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  281.24 + * or visit www.oracle.com if you need additional information or have any
  281.25 + * questions.
  281.26 + */
  281.27 +
  281.28 +/* zutil.c -- target dependent utility functions for the compression library
  281.29 + * Copyright (C) 1995-2005, 2010 Jean-loup Gailly.
  281.30 + * For conditions of distribution and use, see copyright notice in zlib.h
  281.31 + */
  281.32 +
  281.33 +/* @(#) $Id$ */
  281.34 +
  281.35 +#include "zutil.h"
  281.36 +
  281.37 +#ifndef NO_DUMMY_DECL
  281.38 +struct internal_state      {int dummy;}; /* for buggy compilers */
  281.39 +#endif
  281.40 +
  281.41 +const char * const z_errmsg[10] = {
  281.42 +"need dictionary",     /* Z_NEED_DICT       2  */
  281.43 +"stream end",          /* Z_STREAM_END      1  */
  281.44 +"",                    /* Z_OK              0  */
  281.45 +"file error",          /* Z_ERRNO         (-1) */
  281.46 +"stream error",        /* Z_STREAM_ERROR  (-2) */
  281.47 +"data error",          /* Z_DATA_ERROR    (-3) */
  281.48 +"insufficient memory", /* Z_MEM_ERROR     (-4) */
  281.49 +"buffer error",        /* Z_BUF_ERROR     (-5) */
  281.50 +"incompatible version",/* Z_VERSION_ERROR (-6) */
  281.51 +""};
  281.52 +
  281.53 +
  281.54 +const char * ZEXPORT zlibVersion()
  281.55 +{
  281.56 +    return ZLIB_VERSION;
  281.57 +}
  281.58 +
  281.59 +uLong ZEXPORT zlibCompileFlags()
  281.60 +{
  281.61 +    uLong flags;
  281.62 +
  281.63 +    flags = 0;
  281.64 +    switch ((int)(sizeof(uInt))) {
  281.65 +    case 2:     break;
  281.66 +    case 4:     flags += 1;     break;
  281.67 +    case 8:     flags += 2;     break;
  281.68 +    default:    flags += 3;
  281.69 +    }
  281.70 +    switch ((int)(sizeof(uLong))) {
  281.71 +    case 2:     break;
  281.72 +    case 4:     flags += 1 << 2;        break;
  281.73 +    case 8:     flags += 2 << 2;        break;
  281.74 +    default:    flags += 3 << 2;
  281.75 +    }
  281.76 +    switch ((int)(sizeof(voidpf))) {
  281.77 +    case 2:     break;
  281.78 +    case 4:     flags += 1 << 4;        break;
  281.79 +    case 8:     flags += 2 << 4;        break;
  281.80 +    default:    flags += 3 << 4;
  281.81 +    }
  281.82 +    switch ((int)(sizeof(z_off_t))) {
  281.83 +    case 2:     break;
  281.84 +    case 4:     flags += 1 << 6;        break;
  281.85 +    case 8:     flags += 2 << 6;        break;
  281.86 +    default:    flags += 3 << 6;
  281.87 +    }
  281.88 +#ifdef DEBUG
  281.89 +    flags += 1 << 8;
  281.90 +#endif
  281.91 +#if defined(ASMV) || defined(ASMINF)
  281.92 +    flags += 1 << 9;
  281.93 +#endif
  281.94 +#ifdef ZLIB_WINAPI
  281.95 +    flags += 1 << 10;
  281.96 +#endif
  281.97 +#ifdef BUILDFIXED
  281.98 +    flags += 1 << 12;
  281.99 +#endif
 281.100 +#ifdef DYNAMIC_CRC_TABLE
 281.101 +    flags += 1 << 13;
 281.102 +#endif
 281.103 +#ifdef NO_GZCOMPRESS
 281.104 +    flags += 1L << 16;
 281.105 +#endif
 281.106 +#ifdef NO_GZIP
 281.107 +    flags += 1L << 17;
 281.108 +#endif
 281.109 +#ifdef PKZIP_BUG_WORKAROUND
 281.110 +    flags += 1L << 20;
 281.111 +#endif
 281.112 +#ifdef FASTEST
 281.113 +    flags += 1L << 21;
 281.114 +#endif
 281.115 +#ifdef STDC
 281.116 +#  ifdef NO_vsnprintf
 281.117 +        flags += 1L << 25;
 281.118 +#    ifdef HAS_vsprintf_void
 281.119 +        flags += 1L << 26;
 281.120 +#    endif
 281.121 +#  else
 281.122 +#    ifdef HAS_vsnprintf_void
 281.123 +        flags += 1L << 26;
 281.124 +#    endif
 281.125 +#  endif
 281.126 +#else
 281.127 +        flags += 1L << 24;
 281.128 +#  ifdef NO_snprintf
 281.129 +        flags += 1L << 25;
 281.130 +#    ifdef HAS_sprintf_void
 281.131 +        flags += 1L << 26;
 281.132 +#    endif
 281.133 +#  else
 281.134 +#    ifdef HAS_snprintf_void
 281.135 +        flags += 1L << 26;
 281.136 +#    endif
 281.137 +#  endif
 281.138 +#endif
 281.139 +    return flags;
 281.140 +}
 281.141 +
 281.142 +#ifdef DEBUG
 281.143 +
 281.144 +#  ifndef verbose
 281.145 +#    define verbose 0
 281.146 +#  endif
 281.147 +int ZLIB_INTERNAL z_verbose = verbose;
 281.148 +
 281.149 +void ZLIB_INTERNAL z_error (m)
 281.150 +    char *m;
 281.151 +{
 281.152 +    fprintf(stderr, "%s\n", m);
 281.153 +    exit(1);
 281.154 +}
 281.155 +#endif
 281.156 +
 281.157 +/* exported to allow conversion of error code to string for compress() and
 281.158 + * uncompress()
 281.159 + */
 281.160 +const char * ZEXPORT zError(err)
 281.161 +    int err;
 281.162 +{
 281.163 +    return ERR_MSG(err);
 281.164 +}
 281.165 +
 281.166 +#if defined(_WIN32_WCE)
 281.167 +    /* The Microsoft C Run-Time Library for Windows CE doesn't have
 281.168 +     * errno.  We define it as a global variable to simplify porting.
 281.169 +     * Its value is always 0 and should not be used.
 281.170 +     */
 281.171 +    int errno = 0;
 281.172 +#endif
 281.173 +
 281.174 +#ifndef HAVE_MEMCPY
 281.175 +
 281.176 +void ZLIB_INTERNAL zmemcpy(dest, source, len)
 281.177 +    Bytef* dest;
 281.178 +    const Bytef* source;
 281.179 +    uInt  len;
 281.180 +{
 281.181 +    if (len == 0) return;
 281.182 +    do {
 281.183 +        *dest++ = *source++; /* ??? to be unrolled */
 281.184 +    } while (--len != 0);
 281.185 +}
 281.186 +
 281.187 +int ZLIB_INTERNAL zmemcmp(s1, s2, len)
 281.188 +    const Bytef* s1;
 281.189 +    const Bytef* s2;
 281.190 +    uInt  len;
 281.191 +{
 281.192 +    uInt j;
 281.193 +
 281.194 +    for (j = 0; j < len; j++) {
 281.195 +        if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
 281.196 +    }
 281.197 +    return 0;
 281.198 +}
 281.199 +
 281.200 +void ZLIB_INTERNAL zmemzero(dest, len)
 281.201 +    Bytef* dest;
 281.202 +    uInt  len;
 281.203 +{
 281.204 +    if (len == 0) return;
 281.205 +    do {
 281.206 +        *dest++ = 0;  /* ??? to be unrolled */
 281.207 +    } while (--len != 0);
 281.208 +}
 281.209 +#endif
 281.210 +
 281.211 +
 281.212 +#ifdef SYS16BIT
 281.213 +
 281.214 +#ifdef __TURBOC__
 281.215 +/* Turbo C in 16-bit mode */
 281.216 +
 281.217 +#  define MY_ZCALLOC
 281.218 +
 281.219 +/* Turbo C malloc() does not allow dynamic allocation of 64K bytes
 281.220 + * and farmalloc(64K) returns a pointer with an offset of 8, so we
 281.221 + * must fix the pointer. Warning: the pointer must be put back to its
 281.222 + * original form in order to free it, use zcfree().
 281.223 + */
 281.224 +
 281.225 +#define MAX_PTR 10
 281.226 +/* 10*64K = 640K */
 281.227 +
 281.228 +local int next_ptr = 0;
 281.229 +
 281.230 +typedef struct ptr_table_s {
 281.231 +    voidpf org_ptr;
 281.232 +    voidpf new_ptr;
 281.233 +} ptr_table;
 281.234 +
 281.235 +local ptr_table table[MAX_PTR];
 281.236 +/* This table is used to remember the original form of pointers
 281.237 + * to large buffers (64K). Such pointers are normalized with a zero offset.
 281.238 + * Since MSDOS is not a preemptive multitasking OS, this table is not
 281.239 + * protected from concurrent access. This hack doesn't work anyway on
 281.240 + * a protected system like OS/2. Use Microsoft C instead.
 281.241 + */
 281.242 +
 281.243 +voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size)
 281.244 +{
 281.245 +    voidpf buf = opaque; /* just to make some compilers happy */
 281.246 +    ulg bsize = (ulg)items*size;
 281.247 +
 281.248 +    /* If we allocate less than 65520 bytes, we assume that farmalloc
 281.249 +     * will return a usable pointer which doesn't have to be normalized.
 281.250 +     */
 281.251 +    if (bsize < 65520L) {
 281.252 +        buf = farmalloc(bsize);
 281.253 +        if (*(ush*)&buf != 0) return buf;
 281.254 +    } else {
 281.255 +        buf = farmalloc(bsize + 16L);
 281.256 +    }
 281.257 +    if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
 281.258 +    table[next_ptr].org_ptr = buf;
 281.259 +
 281.260 +    /* Normalize the pointer to seg:0 */
 281.261 +    *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
 281.262 +    *(ush*)&buf = 0;
 281.263 +    table[next_ptr++].new_ptr = buf;
 281.264 +    return buf;
 281.265 +}
 281.266 +
 281.267 +void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
 281.268 +{
 281.269 +    int n;
 281.270 +    if (*(ush*)&ptr != 0) { /* object < 64K */
 281.271 +        farfree(ptr);
 281.272 +        return;
 281.273 +    }
 281.274 +    /* Find the original pointer */
 281.275 +    for (n = 0; n < next_ptr; n++) {
 281.276 +        if (ptr != table[n].new_ptr) continue;
 281.277 +
 281.278 +        farfree(table[n].org_ptr);
 281.279 +        while (++n < next_ptr) {
 281.280 +            table[n-1] = table[n];
 281.281 +        }
 281.282 +        next_ptr--;
 281.283 +        return;
 281.284 +    }
 281.285 +    ptr = opaque; /* just to make some compilers happy */
 281.286 +    Assert(0, "zcfree: ptr not found");
 281.287 +}
 281.288 +
 281.289 +#endif /* __TURBOC__ */
 281.290 +
 281.291 +
 281.292 +#ifdef M_I86
 281.293 +/* Microsoft C in 16-bit mode */
 281.294 +
 281.295 +#  define MY_ZCALLOC
 281.296 +
 281.297 +#if (!defined(_MSC_VER) || (_MSC_VER <= 600))
 281.298 +#  define _halloc  halloc
 281.299 +#  define _hfree   hfree
 281.300 +#endif
 281.301 +
 281.302 +voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size)
 281.303 +{
 281.304 +    if (opaque) opaque = 0; /* to make compiler happy */
 281.305 +    return _halloc((long)items, size);
 281.306 +}
 281.307 +
 281.308 +void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
 281.309 +{
 281.310 +    if (opaque) opaque = 0; /* to make compiler happy */
 281.311 +    _hfree(ptr);
 281.312 +}
 281.313 +
 281.314 +#endif /* M_I86 */
 281.315 +
 281.316 +#endif /* SYS16BIT */
 281.317 +
 281.318 +
 281.319 +#ifndef MY_ZCALLOC /* Any system without a special alloc function */
 281.320 +
 281.321 +#ifndef STDC
 281.322 +extern voidp  malloc OF((uInt size));
 281.323 +extern voidp  calloc OF((uInt items, uInt size));
 281.324 +extern void   free   OF((voidpf ptr));
 281.325 +#endif
 281.326 +
 281.327 +voidpf ZLIB_INTERNAL zcalloc (opaque, items, size)
 281.328 +    voidpf opaque;
 281.329 +    unsigned items;
 281.330 +    unsigned size;
 281.331 +{
 281.332 +    if (opaque) items += size - size; /* make compiler happy */
 281.333 +    return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
 281.334 +                              (voidpf)calloc(items, size);
 281.335 +}
 281.336 +
 281.337 +void ZLIB_INTERNAL zcfree (opaque, ptr)
 281.338 +    voidpf opaque;
 281.339 +    voidpf ptr;
 281.340 +{
 281.341 +    free(ptr);
 281.342 +    if (opaque) return; /* make compiler happy */
 281.343 +}
 281.344 +
 281.345 +#endif /* MY_ZCALLOC */
   282.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   282.2 +++ b/src/share/native/java/util/zip/zlib-1.2.5/zutil.h	Mon Dec 19 10:06:23 2011 -0800
   282.3 @@ -0,0 +1,298 @@
   282.4 +/*
   282.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   282.6 + *
   282.7 + * This code is free software; you can redistribute it and/or modify it
   282.8 + * under the terms of the GNU General Public License version 2 only, as
   282.9 + * published by the Free Software Foundation.  Oracle designates this
  282.10 + * particular file as subject to the "Classpath" exception as provided
  282.11 + * by Oracle in the LICENSE file that accompanied this code.
  282.12 + *
  282.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
  282.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  282.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  282.16 + * version 2 for more details (a copy is included in the LICENSE file that
  282.17 + * accompanied this code).
  282.18 + *
  282.19 + * You should have received a copy of the GNU General Public License version
  282.20 + * 2 along with this work; if not, write to the Free Software Foundation,
  282.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  282.22 + *
  282.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  282.24 + * or visit www.oracle.com if you need additional information or have any
  282.25 + * questions.
  282.26 + */
  282.27 +
  282.28 +/* zutil.h -- internal interface and configuration of the compression library
  282.29 + * Copyright (C) 1995-2010 Jean-loup Gailly.
  282.30 + * For conditions of distribution and use, see copyright notice in zlib.h
  282.31 + */
  282.32 +
  282.33 +/* WARNING: this file should *not* be used by applications. It is
  282.34 +   part of the implementation of the compression library and is
  282.35 +   subject to change. Applications should only use zlib.h.
  282.36 + */
  282.37 +
  282.38 +/* @(#) $Id$ */
  282.39 +
  282.40 +#ifndef ZUTIL_H
  282.41 +#define ZUTIL_H
  282.42 +
  282.43 +#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ)
  282.44 +#  define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
  282.45 +#else
  282.46 +#  define ZLIB_INTERNAL
  282.47 +#endif
  282.48 +
  282.49 +#include "zlib.h"
  282.50 +
  282.51 +#ifdef STDC
  282.52 +#  if !(defined(_WIN32_WCE) && defined(_MSC_VER))
  282.53 +#    include <stddef.h>
  282.54 +#  endif
  282.55 +#  include <string.h>
  282.56 +#  include <stdlib.h>
  282.57 +#endif
  282.58 +
  282.59 +#ifndef local
  282.60 +#  define local static
  282.61 +#endif
  282.62 +/* compile with -Dlocal if your debugger can't find static symbols */
  282.63 +
  282.64 +typedef unsigned char  uch;
  282.65 +typedef uch FAR uchf;
  282.66 +typedef unsigned short ush;
  282.67 +typedef ush FAR ushf;
  282.68 +typedef unsigned long  ulg;
  282.69 +
  282.70 +extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
  282.71 +/* (size given to avoid silly warnings with Visual C++) */
  282.72 +
  282.73 +#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
  282.74 +
  282.75 +#define ERR_RETURN(strm,err) \
  282.76 +  return (strm->msg = (char*)ERR_MSG(err), (err))
  282.77 +/* To be used only when the state is known to be valid */
  282.78 +
  282.79 +        /* common constants */
  282.80 +
  282.81 +#ifndef DEF_WBITS
  282.82 +#  define DEF_WBITS MAX_WBITS
  282.83 +#endif
  282.84 +/* default windowBits for decompression. MAX_WBITS is for compression only */
  282.85 +
  282.86 +#if MAX_MEM_LEVEL >= 8
  282.87 +#  define DEF_MEM_LEVEL 8
  282.88 +#else
  282.89 +#  define DEF_MEM_LEVEL  MAX_MEM_LEVEL
  282.90 +#endif
  282.91 +/* default memLevel */
  282.92 +
  282.93 +#define STORED_BLOCK 0
  282.94 +#define STATIC_TREES 1
  282.95 +#define DYN_TREES    2
  282.96 +/* The three kinds of block type */
  282.97 +
  282.98 +#define MIN_MATCH  3
  282.99 +#define MAX_MATCH  258
 282.100 +/* The minimum and maximum match lengths */
 282.101 +
 282.102 +#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
 282.103 +
 282.104 +        /* target dependencies */
 282.105 +
 282.106 +#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
 282.107 +#  define OS_CODE  0x00
 282.108 +#  if defined(__TURBOC__) || defined(__BORLANDC__)
 282.109 +#    if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
 282.110 +       /* Allow compilation with ANSI keywords only enabled */
 282.111 +       void _Cdecl farfree( void *block );
 282.112 +       void *_Cdecl farmalloc( unsigned long nbytes );
 282.113 +#    else
 282.114 +#      include <alloc.h>
 282.115 +#    endif
 282.116 +#  else /* MSC or DJGPP */
 282.117 +#    include <malloc.h>
 282.118 +#  endif
 282.119 +#endif
 282.120 +
 282.121 +#ifdef AMIGA
 282.122 +#  define OS_CODE  0x01
 282.123 +#endif
 282.124 +
 282.125 +#if defined(VAXC) || defined(VMS)
 282.126 +#  define OS_CODE  0x02
 282.127 +#  define F_OPEN(name, mode) \
 282.128 +     fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
 282.129 +#endif
 282.130 +
 282.131 +#if defined(ATARI) || defined(atarist)
 282.132 +#  define OS_CODE  0x05
 282.133 +#endif
 282.134 +
 282.135 +#ifdef OS2
 282.136 +#  define OS_CODE  0x06
 282.137 +#  ifdef M_I86
 282.138 +#    include <malloc.h>
 282.139 +#  endif
 282.140 +#endif
 282.141 +
 282.142 +#if defined(MACOS) || defined(TARGET_OS_MAC)
 282.143 +#  define OS_CODE  0x07
 282.144 +#  if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
 282.145 +#    include <unix.h> /* for fdopen */
 282.146 +#  else
 282.147 +#    ifndef fdopen
 282.148 +#      define fdopen(fd,mode) NULL /* No fdopen() */
 282.149 +#    endif
 282.150 +#  endif
 282.151 +#endif
 282.152 +
 282.153 +#ifdef TOPS20
 282.154 +#  define OS_CODE  0x0a
 282.155 +#endif
 282.156 +
 282.157 +#ifdef WIN32
 282.158 +#  ifndef __CYGWIN__  /* Cygwin is Unix, not Win32 */
 282.159 +#    define OS_CODE  0x0b
 282.160 +#  endif
 282.161 +#endif
 282.162 +
 282.163 +#ifdef __50SERIES /* Prime/PRIMOS */
 282.164 +#  define OS_CODE  0x0f
 282.165 +#endif
 282.166 +
 282.167 +#if defined(_BEOS_) || defined(RISCOS)
 282.168 +#  define fdopen(fd,mode) NULL /* No fdopen() */
 282.169 +#endif
 282.170 +
 282.171 +#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
 282.172 +#  if defined(_WIN32_WCE)
 282.173 +#    define fdopen(fd,mode) NULL /* No fdopen() */
 282.174 +#    ifndef _PTRDIFF_T_DEFINED
 282.175 +       typedef int ptrdiff_t;
 282.176 +#      define _PTRDIFF_T_DEFINED
 282.177 +#    endif
 282.178 +#  else
 282.179 +#    define fdopen(fd,type)  _fdopen(fd,type)
 282.180 +#  endif
 282.181 +#endif
 282.182 +
 282.183 +#if defined(__BORLANDC__)
 282.184 +  #pragma warn -8004
 282.185 +  #pragma warn -8008
 282.186 +  #pragma warn -8066
 282.187 +#endif
 282.188 +
 282.189 +/* provide prototypes for these when building zlib without LFS */
 282.190 +#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
 282.191 +    ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
 282.192 +    ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
 282.193 +#endif
 282.194 +
 282.195 +        /* common defaults */
 282.196 +
 282.197 +#ifndef OS_CODE
 282.198 +#  define OS_CODE  0x03  /* assume Unix */
 282.199 +#endif
 282.200 +
 282.201 +#ifndef F_OPEN
 282.202 +#  define F_OPEN(name, mode) fopen((name), (mode))
 282.203 +#endif
 282.204 +
 282.205 +         /* functions */
 282.206 +
 282.207 +#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
 282.208 +#  ifndef HAVE_VSNPRINTF
 282.209 +#    define HAVE_VSNPRINTF
 282.210 +#  endif
 282.211 +#endif
 282.212 +#if defined(__CYGWIN__)
 282.213 +#  ifndef HAVE_VSNPRINTF
 282.214 +#    define HAVE_VSNPRINTF
 282.215 +#  endif
 282.216 +#endif
 282.217 +#ifndef HAVE_VSNPRINTF
 282.218 +#  ifdef MSDOS
 282.219 +     /* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
 282.220 +        but for now we just assume it doesn't. */
 282.221 +#    define NO_vsnprintf
 282.222 +#  endif
 282.223 +#  ifdef __TURBOC__
 282.224 +#    define NO_vsnprintf
 282.225 +#  endif
 282.226 +#  ifdef WIN32
 282.227 +     /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
 282.228 +#    if !defined(vsnprintf) && !defined(NO_vsnprintf)
 282.229 +#      if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 )
 282.230 +#         define vsnprintf _vsnprintf
 282.231 +#      endif
 282.232 +#    endif
 282.233 +#  endif
 282.234 +#  ifdef __SASC
 282.235 +#    define NO_vsnprintf
 282.236 +#  endif
 282.237 +#endif
 282.238 +#ifdef VMS
 282.239 +#  define NO_vsnprintf
 282.240 +#endif
 282.241 +
 282.242 +#if defined(pyr)
 282.243 +#  define NO_MEMCPY
 282.244 +#endif
 282.245 +#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
 282.246 + /* Use our own functions for small and medium model with MSC <= 5.0.
 282.247 +  * You may have to use the same strategy for Borland C (untested).
 282.248 +  * The __SC__ check is for Symantec.
 282.249 +  */
 282.250 +#  define NO_MEMCPY
 282.251 +#endif
 282.252 +#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
 282.253 +#  define HAVE_MEMCPY
 282.254 +#endif
 282.255 +#ifdef HAVE_MEMCPY
 282.256 +#  ifdef SMALL_MEDIUM /* MSDOS small or medium model */
 282.257 +#    define zmemcpy _fmemcpy
 282.258 +#    define zmemcmp _fmemcmp
 282.259 +#    define zmemzero(dest, len) _fmemset(dest, 0, len)
 282.260 +#  else
 282.261 +#    define zmemcpy memcpy
 282.262 +#    define zmemcmp memcmp
 282.263 +#    define zmemzero(dest, len) memset(dest, 0, len)
 282.264 +#  endif
 282.265 +#else
 282.266 +   void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
 282.267 +   int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
 282.268 +   void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len));
 282.269 +#endif
 282.270 +
 282.271 +/* Diagnostic functions */
 282.272 +#ifdef DEBUG
 282.273 +#  include <stdio.h>
 282.274 +   extern int ZLIB_INTERNAL z_verbose;
 282.275 +   extern void ZLIB_INTERNAL z_error OF((char *m));
 282.276 +#  define Assert(cond,msg) {if(!(cond)) z_error(msg);}
 282.277 +#  define Trace(x) {if (z_verbose>=0) fprintf x ;}
 282.278 +#  define Tracev(x) {if (z_verbose>0) fprintf x ;}
 282.279 +#  define Tracevv(x) {if (z_verbose>1) fprintf x ;}
 282.280 +#  define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
 282.281 +#  define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
 282.282 +#else
 282.283 +#  define Assert(cond,msg)
 282.284 +#  define Trace(x)
 282.285 +#  define Tracev(x)
 282.286 +#  define Tracevv(x)
 282.287 +#  define Tracec(c,x)
 282.288 +#  define Tracecv(c,x)
 282.289 +#endif
 282.290 +
 282.291 +
 282.292 +voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,
 282.293 +                        unsigned size));
 282.294 +void ZLIB_INTERNAL zcfree  OF((voidpf opaque, voidpf ptr));
 282.295 +
 282.296 +#define ZALLOC(strm, items, size) \
 282.297 +           (*((strm)->zalloc))((strm)->opaque, (items), (size))
 282.298 +#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
 282.299 +#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
 282.300 +
 282.301 +#endif /* ZUTIL_H */
   283.1 --- a/src/solaris/classes/sun/awt/X11/ListHelper.java	Tue Dec 06 16:31:58 2011 -0800
   283.2 +++ b/src/solaris/classes/sun/awt/X11/ListHelper.java	Mon Dec 19 10:06:23 2011 -0800
   283.3 @@ -29,10 +29,8 @@
   283.4  import java.awt.event.MouseEvent;
   283.5  import java.awt.event.MouseWheelEvent;
   283.6  import java.awt.event.AdjustmentEvent;
   283.7 -import java.util.List;
   283.8  import java.util.ArrayList;
   283.9  import java.util.Iterator;
  283.10 -import sun.awt.motif.X11FontMetrics;
  283.11  import sun.util.logging.PlatformLogger;
  283.12  
  283.13  // FIXME: implement multi-select
   284.1 --- a/src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java	Tue Dec 06 16:31:58 2011 -0800
   284.2 +++ b/src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java	Mon Dec 19 10:06:23 2011 -0800
   284.3 @@ -35,7 +35,6 @@
   284.4  import java.awt.image.VolatileImage;
   284.5  import java.awt.peer.*;
   284.6  import sun.awt.*;
   284.7 -import sun.awt.motif.X11FontMetrics;
   284.8  import java.lang.reflect.*;
   284.9  import sun.util.logging.PlatformLogger;
  284.10  import java.util.*;
   285.1 --- a/src/solaris/classes/sun/awt/X11/XEmbedChildProxyPeer.java	Tue Dec 06 16:31:58 2011 -0800
   285.2 +++ b/src/solaris/classes/sun/awt/X11/XEmbedChildProxyPeer.java	Mon Dec 19 10:06:23 2011 -0800
   285.3 @@ -34,8 +34,6 @@
   285.4  import java.awt.peer.*;
   285.5  import sun.java2d.pipe.Region;
   285.6  import sun.awt.*;
   285.7 -import sun.awt.motif.MToolkit;
   285.8 -import sun.awt.motif.X11FontMetrics;
   285.9  
  285.10  public class XEmbedChildProxyPeer implements ComponentPeer, XEventDispatcher{
  285.11      XEmbeddingContainer container;
   286.1 --- a/src/solaris/classes/sun/awt/X11/XToolkit.java	Tue Dec 06 16:31:58 2011 -0800
   286.2 +++ b/src/solaris/classes/sun/awt/X11/XToolkit.java	Mon Dec 19 10:06:23 2011 -0800
   286.3 @@ -51,6 +51,7 @@
   286.4  import sun.awt.*;
   286.5  import sun.font.FontConfigManager;
   286.6  import sun.font.FontManager;
   286.7 +import sun.java2d.SunGraphicsEnvironment;
   286.8  import sun.misc.PerformanceLogger;
   286.9  import sun.print.PrintJob2D;
  286.10  import sun.security.action.GetBooleanAction;
  286.11 @@ -109,7 +110,7 @@
  286.12      static int awt_multiclick_time;
  286.13      static boolean securityWarningEnabled;
  286.14  
  286.15 -    private static int screenWidth = -1, screenHeight = -1; // Dimensions of default screen
  286.16 +    private static volatile int screenWidth = -1, screenHeight = -1; // Dimensions of default screen
  286.17      static long awt_defaultFg; // Pixel
  286.18      private static XMouseInfoPeer xPeer;
  286.19      private static Method m_removeSourceEvents;
  286.20 @@ -310,6 +311,19 @@
  286.21              System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
  286.22  
  286.23              saved_error_handler = XlibWrapper.SetToolkitErrorHandler();
  286.24 +
  286.25 +            // Detect display mode changes
  286.26 +            XlibWrapper.XSelectInput(XToolkit.getDisplay(), XToolkit.getDefaultRootWindow(), XConstants.StructureNotifyMask);
  286.27 +            XToolkit.addEventDispatcher(XToolkit.getDefaultRootWindow(), new XEventDispatcher() {
  286.28 +                @Override
  286.29 +                public void dispatchEvent(XEvent ev) {
  286.30 +                    if (ev.get_type() == XConstants.ConfigureNotify) {
  286.31 +                        ((X11GraphicsEnvironment)GraphicsEnvironment.
  286.32 +                         getLocalGraphicsEnvironment()).
  286.33 +                            displayChanged();
  286.34 +                    }
  286.35 +                }
  286.36 +            });
  286.37          } finally {
  286.38              awtUnlock();
  286.39          }
  286.40 @@ -684,29 +698,49 @@
  286.41          }
  286.42      }
  286.43  
  286.44 -    static int getDefaultScreenWidth() {
  286.45 -        if (screenWidth == -1) {
  286.46 -            long display = getDisplay();
  286.47 +    static {
  286.48 +        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
  286.49 +        if (ge instanceof SunGraphicsEnvironment) {
  286.50 +            ((SunGraphicsEnvironment)ge).addDisplayChangedListener(
  286.51 +                new DisplayChangedListener() {
  286.52 +                    @Override
  286.53 +                    public void displayChanged() {
  286.54 +                        // 7045370: Reset the cached values
  286.55 +                        XToolkit.screenWidth = -1;
  286.56 +                        XToolkit.screenHeight = -1;
  286.57 +                    }
  286.58 +
  286.59 +                    @Override
  286.60 +                    public void paletteChanged() {}
  286.61 +            });
  286.62 +        }
  286.63 +    }
  286.64 +
  286.65 +    private static void initScreenSize() {
  286.66 +        if (screenWidth == -1 || screenHeight == -1) {
  286.67              awtLock();
  286.68              try {
  286.69 -                screenWidth = (int) XlibWrapper.DisplayWidth(display, XlibWrapper.DefaultScreen(display));
  286.70 +                XWindowAttributes pattr = new XWindowAttributes();
  286.71 +                try {
  286.72 +                    XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(), XToolkit.getDefaultRootWindow(), pattr.pData);
  286.73 +                    screenWidth  = (int) pattr.get_width();
  286.74 +                    screenHeight = (int) pattr.get_height();
  286.75 +                } finally {
  286.76 +                    pattr.dispose();
  286.77 +                }
  286.78              } finally {
  286.79                  awtUnlock();
  286.80              }
  286.81          }
  286.82 +    }
  286.83 +
  286.84 +    static int getDefaultScreenWidth() {
  286.85 +        initScreenSize();
  286.86          return screenWidth;
  286.87      }
  286.88  
  286.89      static int getDefaultScreenHeight() {
  286.90 -        if (screenHeight == -1) {
  286.91 -            long display = getDisplay();
  286.92 -            awtLock();
  286.93 -            try {
  286.94 -                screenHeight = (int) XlibWrapper.DisplayHeight(display, XlibWrapper.DefaultScreen(display));
  286.95 -            } finally {
  286.96 -                awtUnlock();
  286.97 -            }
  286.98 -        }
  286.99 +        initScreenSize();
 286.100          return screenHeight;
 286.101      }
 286.102  
   287.1 --- a/src/solaris/classes/sun/awt/X11/XWindowPeer.java	Tue Dec 06 16:31:58 2011 -0800
   287.2 +++ b/src/solaris/classes/sun/awt/X11/XWindowPeer.java	Mon Dec 19 10:06:23 2011 -0800
   287.3 @@ -208,12 +208,19 @@
   287.4          return name;
   287.5      }
   287.6  
   287.7 +    private static native String getLocalHostname();
   287.8 +    private static native int getJvmPID();
   287.9 +
  287.10      void postInit(XCreateWindowParams params) {
  287.11          super.postInit(params);
  287.12  
  287.13          // Init WM_PROTOCOLS atom
  287.14          initWMProtocols();
  287.15  
  287.16 +        // Set _NET_WM_PID and WM_CLIENT_MACHINE using this JVM
  287.17 +        XAtom.get("WM_CLIENT_MACHINE").setProperty(getWindow(), getLocalHostname());
  287.18 +        XAtom.get("_NET_WM_PID").setCard32Property(getWindow(), getJvmPID());
  287.19 +
  287.20          // Set WM_TRANSIENT_FOR and group_leader
  287.21          Window t_window = (Window)target;
  287.22          Window owner = t_window.getOwner();
   288.1 --- a/src/solaris/classes/sun/awt/X11GraphicsDevice.java	Tue Dec 06 16:31:58 2011 -0800
   288.2 +++ b/src/solaris/classes/sun/awt/X11GraphicsDevice.java	Mon Dec 19 10:06:23 2011 -0800
   288.3 @@ -487,14 +487,9 @@
   288.4       * X11GraphicsEnvironment when the display mode has been changed.
   288.5       */
   288.6      public synchronized void displayChanged() {
   288.7 -        // reset the list of configs (and default config)
   288.8 -        defaultConfig = null;
   288.9 -        configs = null;
  288.10 -        doubleBufferVisuals = null;
  288.11 -
  288.12 -        // reset the native data structures associated with this device (they
  288.13 -        // will be reinitialized when the GraphicsConfigs are configured)
  288.14 -        resetNativeData(screen);
  288.15 +        // On X11 the visuals do not change, and therefore we don't need
  288.16 +        // to reset the defaultConfig, config, doubleBufferVisuals,
  288.17 +        // neither do we need to reset the native data.
  288.18  
  288.19          // pass on to all top-level windows on this screen
  288.20          topLevels.notifyListeners();
   289.1 --- a/src/solaris/classes/sun/awt/motif/AWTLockAccess.java	Tue Dec 06 16:31:58 2011 -0800
   289.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   289.3 @@ -1,34 +0,0 @@
   289.4 -/*
   289.5 - * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
   289.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   289.7 - *
   289.8 - * This code is free software; you can redistribute it and/or modify it
   289.9 - * under the terms of the GNU General Public License version 2 only, as
  289.10 - * published by the Free Software Foundation.  Oracle designates this
  289.11 - * particular file as subject to the "Classpath" exception as provided
  289.12 - * by Oracle in the LICENSE file that accompanied this code.
  289.13 - *
  289.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
  289.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  289.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  289.17 - * version 2 for more details (a copy is included in the LICENSE file that
  289.18 - * accompanied this code).
  289.19 - *
  289.20 - * You should have received a copy of the GNU General Public License version
  289.21 - * 2 along with this work; if not, write to the Free Software Foundation,
  289.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  289.23 - *
  289.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  289.25 - * or visit www.oracle.com if you need additional information or have any
  289.26 - * questions.
  289.27 - */
  289.28 -
  289.29 -package sun.awt.motif;
  289.30 -
  289.31 -final class AWTLockAccess {
  289.32 -    static native void awtLock();
  289.33 -    static native void awtUnlock();
  289.34 -    static void awtWait() { awtWait(0); }
  289.35 -    static native void awtWait(long timeout);
  289.36 -    static native void awtNotifyAll();
  289.37 -}
   290.1 --- a/src/solaris/classes/sun/awt/motif/MFontConfiguration.java	Tue Dec 06 16:31:58 2011 -0800
   290.2 +++ b/src/solaris/classes/sun/awt/motif/MFontConfiguration.java	Mon Dec 19 10:06:23 2011 -0800
   290.3 @@ -25,26 +25,19 @@
   290.4  
   290.5  package sun.awt.motif;
   290.6  
   290.7 -import java.awt.Font;
   290.8 -import java.io.BufferedReader;
   290.9 +import sun.awt.FontConfiguration;
  290.10 +import sun.awt.X11FontManager;
  290.11 +import sun.font.FontUtilities;
  290.12 +import sun.font.SunFontManager;
  290.13 +import sun.util.logging.PlatformLogger;
  290.14 +
  290.15  import java.io.File;
  290.16  import java.io.FileInputStream;
  290.17 -import java.io.InputStreamReader;
  290.18  import java.nio.charset.Charset;
  290.19  import java.util.HashMap;
  290.20  import java.util.HashSet;
  290.21 -import java.util.Locale;
  290.22  import java.util.Properties;
  290.23  import java.util.Scanner;
  290.24 -import sun.awt.FontConfiguration;
  290.25 -import sun.awt.X11FontManager;
  290.26 -import sun.awt.X11GraphicsEnvironment;
  290.27 -import sun.font.FontManager;
  290.28 -import sun.font.SunFontManager;
  290.29 -import sun.font.FontManagerFactory;
  290.30 -import sun.font.FontUtilities;
  290.31 -import sun.java2d.SunGraphicsEnvironment;
  290.32 -import sun.util.logging.PlatformLogger;
  290.33  
  290.34  public class MFontConfiguration extends FontConfiguration {
  290.35  
  290.36 @@ -258,47 +251,6 @@
  290.37          return Charset.forName("ISO8859_1");
  290.38      }
  290.39  
  290.40 -    /* methods for Motif support *********************************************/
  290.41 -
  290.42 -    private String[][] motifFontSets = new String[NUM_FONTS][NUM_STYLES];
  290.43 -
  290.44 -    public String getMotifFontSet(String fontName, int style) {
  290.45 -        assert isLogicalFontFamilyName(fontName);
  290.46 -        fontName = fontName.toLowerCase(Locale.ENGLISH);
  290.47 -        int fontIndex = getFontIndex(fontName);
  290.48 -        int styleIndex = getStyleIndex(style);
  290.49 -        return getMotifFontSet(fontIndex, styleIndex);
  290.50 -    }
  290.51 -
  290.52 -    private String getMotifFontSet(int fontIndex, int styleIndex) {
  290.53 -        String fontSet = motifFontSets[fontIndex][styleIndex];
  290.54 -        if (fontSet == null) {
  290.55 -            fontSet = buildMotifFontSet(fontIndex, styleIndex);
  290.56 -            motifFontSets[fontIndex][styleIndex] = fontSet;
  290.57 -        }
  290.58 -        return fontSet;
  290.59 -    }
  290.60 -
  290.61 -    private String buildMotifFontSet(int fontIndex, int styleIndex) {
  290.62 -        StringBuilder buffer = new StringBuilder();
  290.63 -        short[] scripts = getCoreScripts(fontIndex);
  290.64 -        for (int i = 0; i < scripts.length; i++) {
  290.65 -            short nameID = getComponentFontIDMotif(scripts[i], fontIndex, styleIndex);
  290.66 -            if (nameID == 0) {
  290.67 -                nameID = getComponentFontID(scripts[i], fontIndex, styleIndex);
  290.68 -            }
  290.69 -            String name = getComponentFontName(nameID);
  290.70 -            if (name == null || name.endsWith("fontspecific")) {
  290.71 -                continue;
  290.72 -            }
  290.73 -            if (buffer.length() > 0) {
  290.74 -                buffer.append(',');
  290.75 -            }
  290.76 -            buffer.append(name);
  290.77 -        }
  290.78 -        return buffer.toString();
  290.79 -    }
  290.80 -
  290.81      protected String getFaceNameFromComponentFontName(String componentFontName) {
  290.82          return null;
  290.83      }
  290.84 @@ -315,36 +267,6 @@
  290.85          return ((X11FontManager) fontManager).getFileNameFromXLFD(componentFontName);
  290.86      }
  290.87  
  290.88 -    /**
  290.89 -     * Get default font for Motif widgets to use, preventing them from
  290.90 -     * wasting time accessing inappropriate X resources.  This is called
  290.91 -     * only from native code.
  290.92 -     *
  290.93 -     * This is part of a Motif specific performance enhancement.  By
  290.94 -     * default, when Motif widgets are created and initialized, Motif will
  290.95 -     * set up default fonts for the widgets, which we ALWAYS override.
  290.96 -     * This set up includes finding the default font in the widget's X
  290.97 -     * resources and fairly expensive requests of the X server to identify
  290.98 -     * the specific font or fontset.  We avoid all of this overhead by
  290.99 -     * providing a well known font to use at the creation of widgets, where
 290.100 -     * possible.
 290.101 -     *
 290.102 -     * The X11 fonts are specified by XLFD strings which have %d as a
 290.103 -     * marker to indicate where the fontsize should be substituted.  [The
 290.104 -     * libc function sprintf() is used to replace it.]  The value 140
 290.105 -     * specifies a font size of 14 points.
 290.106 -     */
 290.107 -    private static String getDefaultMotifFontSet() {
 290.108 -        String font = ((MFontConfiguration) getFontConfiguration()).getMotifFontSet("sansserif", Font.PLAIN);
 290.109 -        if (font != null) {
 290.110 -            int i;
 290.111 -            while ((i = font.indexOf("%d")) >= 0) {
 290.112 -                font = font.substring(0, i) + "140" + font.substring(i+2);
 290.113 -            }
 290.114 -        }
 290.115 -        return font;
 290.116 -    }
 290.117 -
 290.118      public HashSet<String> getAWTFontPathSet() {
 290.119          HashSet<String> fontDirs = new HashSet<String>();
 290.120          short[] scripts = getCoreScripts(0);
   291.1 --- a/src/solaris/classes/sun/awt/motif/MFontPeer.java	Tue Dec 06 16:31:58 2011 -0800
   291.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   291.3 @@ -1,65 +0,0 @@
   291.4 -/*
   291.5 - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
   291.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   291.7 - *
   291.8 - * This code is free software; you can redistribute it and/or modify it
   291.9 - * under the terms of the GNU General Public License version 2 only, as
  291.10 - * published by the Free Software Foundation.  Oracle designates this
  291.11 - * particular file as subject to the "Classpath" exception as provided
  291.12 - * by Oracle in the LICENSE file that accompanied this code.
  291.13 - *
  291.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
  291.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  291.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  291.17 - * version 2 for more details (a copy is included in the LICENSE file that
  291.18 - * accompanied this code).
  291.19 - *
  291.20 - * You should have received a copy of the GNU General Public License version
  291.21 - * 2 along with this work; if not, write to the Free Software Foundation,
  291.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  291.23 - *
  291.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  291.25 - * or visit www.oracle.com if you need additional information or have any
  291.26 - * questions.
  291.27 - */
  291.28 -package sun.awt.motif;
  291.29 -
  291.30 -import java.awt.GraphicsEnvironment;
  291.31 -import sun.awt.PlatformFont;
  291.32 -
  291.33 -public class MFontPeer extends PlatformFont {
  291.34 -
  291.35 -    /*
  291.36 -     * XLFD name for XFontSet.
  291.37 -     */
  291.38 -    private String xfsname;
  291.39 -
  291.40 -    /*
  291.41 -     * converter name for this XFontSet encoding.
  291.42 -     */
  291.43 -    private String converter;
  291.44 -
  291.45 -    static {
  291.46 -        if (!GraphicsEnvironment.isHeadless()) {
  291.47 -            initIDs();
  291.48 -        }
  291.49 -    }
  291.50 -
  291.51 -    /**
  291.52 -     * Initialize JNI field and method IDs for fields that may be
  291.53 -       accessed from C.
  291.54 -     */
  291.55 -    private static native void initIDs();
  291.56 -
  291.57 -    public MFontPeer(String name, int style){
  291.58 -        super(name, style);
  291.59 -
  291.60 -        if (fontConfig != null) {
  291.61 -            xfsname = ((MFontConfiguration) fontConfig).getMotifFontSet(familyName, style);
  291.62 -        }
  291.63 -    }
  291.64 -
  291.65 -    protected char getMissingGlyphCharacter() {
  291.66 -        return '\u274F';
  291.67 -    }
  291.68 -}
   292.1 --- a/src/solaris/classes/sun/awt/motif/MToolkit.java	Tue Dec 06 16:31:58 2011 -0800
   292.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   292.3 @@ -1,849 +0,0 @@
   292.4 -/*
   292.5 - * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
   292.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   292.7 - *
   292.8 - * This code is free software; you can redistribute it and/or modify it
   292.9 - * under the terms of the GNU General Public License version 2 only, as
  292.10 - * published by the Free Software Foundation.  Oracle designates this
  292.11 - * particular file as subject to the "Classpath" exception as provided
  292.12 - * by Oracle in the LICENSE file that accompanied this code.
  292.13 - *
  292.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
  292.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  292.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  292.17 - * version 2 for more details (a copy is included in the LICENSE file that
  292.18 - * accompanied this code).
  292.19 - *
  292.20 - * You should have received a copy of the GNU General Public License version
  292.21 - * 2 along with this work; if not, write to the Free Software Foundation,
  292.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  292.23 - *
  292.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  292.25 - * or visit www.oracle.com if you need additional information or have any
  292.26 - * questions.
  292.27 - */
  292.28 -
  292.29 -package sun.awt.motif;
  292.30 -
  292.31 -import java.awt.*;
  292.32 -import java.awt.im.InputMethodHighlight;
  292.33 -import java.awt.im.spi.InputMethodDescriptor;
  292.34 -import java.awt.image.*;
  292.35 -import java.awt.peer.*;
  292.36 -import java.awt.datatransfer.Clipboard;
  292.37 -import java.awt.event.*;
  292.38 -import java.lang.reflect.*;
  292.39 -import java.lang.Math;
  292.40 -import java.io.*;
  292.41 -import java.security.AccessController;
  292.42 -import java.security.PrivilegedAction;
  292.43 -import java.security.PrivilegedActionException;
  292.44 -import java.security.PrivilegedExceptionAction;
  292.45 -
  292.46 -import java.util.Properties;
  292.47 -import java.util.Map;
  292.48 -import java.util.Iterator;
  292.49 -
  292.50 -import sun.awt.AppContext;
  292.51 -import sun.awt.AWTAutoShutdown;
  292.52 -import sun.awt.SunToolkit;
  292.53 -import sun.awt.UNIXToolkit;
  292.54 -import sun.awt.GlobalCursorManager;
  292.55 -import sun.awt.datatransfer.DataTransferer;
  292.56 -
  292.57 -import java.awt.dnd.DragSource;
  292.58 -import java.awt.dnd.DragGestureListener;
  292.59 -import java.awt.dnd.DragGestureEvent;
  292.60 -import java.awt.dnd.DragGestureRecognizer;
  292.61 -import java.awt.dnd.MouseDragGestureRecognizer;
  292.62 -import java.awt.dnd.InvalidDnDOperationException;
  292.63 -import java.awt.dnd.peer.DragSourceContextPeer;
  292.64 -
  292.65 -//import sun.awt.motif.MInputMethod;
  292.66 -import sun.awt.X11FontManager;
  292.67 -import sun.awt.X11GraphicsConfig;
  292.68 -import sun.awt.X11GraphicsEnvironment;
  292.69 -import sun.awt.XSettings;
  292.70 -
  292.71 -//import sun.awt.motif.MDragSourceContextPeer;
  292.72 -
  292.73 -import sun.print.PrintJob2D;
  292.74 -
  292.75 -import sun.misc.PerformanceLogger;
  292.76 -import sun.misc.Unsafe;
  292.77 -
  292.78 -import sun.security.action.GetBooleanAction;
  292.79 -import sun.util.logging.PlatformLogger;
  292.80 -
  292.81 -public class MToolkit extends UNIXToolkit implements Runnable {
  292.82 -
  292.83 -    private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.motif.MToolkit");
  292.84 -
  292.85 -    // the system clipboard - CLIPBOARD selection
  292.86 -    //X11Clipboard clipboard;
  292.87 -    // the system selection - PRIMARY selection
  292.88 -    //X11Clipboard selection;
  292.89 -
  292.90 -    // Dynamic Layout Resize client code setting
  292.91 -    protected static boolean dynamicLayoutSetting = false;
  292.92 -
  292.93 -    /**
  292.94 -     * True when the x settings have been loaded.
  292.95 -     */
  292.96 -    private boolean loadedXSettings;
  292.97 -
  292.98 -    /**
  292.99 -     * XSETTINGS for the default screen.
 292.100 -     * <p>
 292.101 -     * <strong>XXX:</strong> see <code>MToolkit.parseXSettings</code>
 292.102 -     * and <code>awt_xsettings_update</code> in
 292.103 -     * <samp>awt_MToolkit.c</samp>
 292.104 -     */
 292.105 -    private XSettings xs;
 292.106 -
 292.107 -    /*
 292.108 -     * Note: The MToolkit object depends on the static initializer
 292.109 -     * of X11GraphicsEnvironment to initialize the connection to
 292.110 -     * the X11 server.
 292.111 -     */
 292.112 -    static final X11GraphicsConfig config;
 292.113 -
 292.114 -    private static final boolean motifdnd;
 292.115 -
 292.116 -    static {
 292.117 -        if (GraphicsEnvironment.isHeadless()) {
 292.118 -            config = null;
 292.119 -        } else {
 292.120 -            config = (X11GraphicsConfig) (GraphicsEnvironment.
 292.121 -                             getLocalGraphicsEnvironment().
 292.122 -                             getDefaultScreenDevice().
 292.123 -                             getDefaultConfiguration());
 292.124 -        }
 292.125 -
 292.126 -        motifdnd = ((Boolean)java.security.AccessController.doPrivileged(
 292.127 -            new GetBooleanAction("awt.dnd.motifdnd"))).booleanValue();
 292.128 -    }
 292.129 -
 292.130 -    //public static final String DATA_TRANSFERER_CLASS_NAME = "sun.awt.motif.MDataTransferer";
 292.131 -
 292.132 -    public MToolkit() {
 292.133 -        super();
 292.134 -        if (PerformanceLogger.loggingEnabled()) {
 292.135 -            PerformanceLogger.setTime("MToolkit construction");
 292.136 -        }
 292.137 -        if (!GraphicsEnvironment.isHeadless()) {
 292.138 -            String mainClassName = null;
 292.139 -
 292.140 -            StackTraceElement trace[] = (new Throwable()).getStackTrace();
 292.141 -            int bottom = trace.length - 1;
 292.142 -            if (bottom >= 0) {
 292.143 -                mainClassName = trace[bottom].getClassName();
 292.144 -            }
 292.145 -            if (mainClassName == null || mainClassName.equals("")) {
 292.146 -                mainClassName = "AWT";
 292.147 -            }
 292.148 -
 292.149 -            init(mainClassName);
 292.150 -            //SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);
 292.151 -
 292.152 -            Thread toolkitThread = new Thread(this, "AWT-Motif");
 292.153 -            toolkitThread.setPriority(Thread.NORM_PRIORITY + 1);
 292.154 -            toolkitThread.setDaemon(true);
 292.155 -
 292.156 -            PrivilegedAction<Void> a = new PrivilegedAction<Void>() {
 292.157 -                public Void run() {
 292.158 -                    ThreadGroup mainTG = Thread.currentThread().getThreadGroup();
 292.159 -                    ThreadGroup parentTG = mainTG.getParent();
 292.160 -
 292.161 -                    while (parentTG != null) {
 292.162 -                        mainTG = parentTG;
 292.163 -                        parentTG = mainTG.getParent();
 292.164 -                    }
 292.165 -                    Thread shutdownThread = new Thread(mainTG, new Runnable() {
 292.166 -                            public void run() {
 292.167 -                                shutdown();
 292.168 -                            }
 292.169 -                        }, "Shutdown-Thread");
 292.170 -                    shutdownThread.setContextClassLoader(null);
 292.171 -                    Runtime.getRuntime().addShutdownHook(shutdownThread);
 292.172 -                    return null;
 292.173 -                }
 292.174 -            };
 292.175 -            AccessController.doPrivileged(a);
 292.176 -
 292.177 -            /*
 292.178 -             * Fix for 4701990.
 292.179 -             * AWTAutoShutdown state must be changed before the toolkit thread
 292.180 -             * starts to avoid race condition.
 292.181 -             */
 292.182 -            AWTAutoShutdown.notifyToolkitThreadBusy();
 292.183 -
 292.184 -            toolkitThread.start();
 292.185 -        }
 292.186 -    }
 292.187 -
 292.188 -    public native void init(String mainClassName);
 292.189 -    public native void run();
 292.190 -    private native void shutdown();
 292.191 -
 292.192 -    /*
 292.193 -     * Create peer objects.
 292.194 -     */
 292.195 -
 292.196 -    public ButtonPeer createButton(Button target) {
 292.197 -        //ButtonPeer peer = new MButtonPeer(target);
 292.198 -        //targetCreatedPeer(target, peer);
 292.199 -        //return peer;
 292.200 -        return null;
 292.201 -    }
 292.202 -
 292.203 -    public TextFieldPeer createTextField(TextField target) {
 292.204 -        //TextFieldPeer peer = new MTextFieldPeer(target);
 292.205 -        //targetCreatedPeer(target, peer);
 292.206 -        //return peer;
 292.207 -        return null;
 292.208 -    }
 292.209 -
 292.210 -    public LabelPeer createLabel(Label target) {
 292.211 -        //LabelPeer peer = new MLabelPeer(target);
 292.212 -        //targetCreatedPeer(target, peer);
 292.213 -        //return peer;
 292.214 -        return null;
 292.215 -    }
 292.216 -
 292.217 -    public ListPeer createList(List target) {
 292.218 -        //ListPeer peer = new MListPeer(target);
 292.219 -        //targetCreatedPeer(target, peer);
 292.220 -        //return peer;
 292.221 -        return null;
 292.222 -    }
 292.223 -
 292.224 -    public CheckboxPeer createCheckbox(Checkbox target) {
 292.225 -        //CheckboxPeer peer = new MCheckboxPeer(target);
 292.226 -        //targetCreatedPeer(target, peer);
 292.227 -        //return peer;
 292.228 -        return null;
 292.229 -    }
 292.230 -
 292.231 -    public ScrollbarPeer createScrollbar(Scrollbar target) {
 292.232 -        //ScrollbarPeer peer = new MScrollbarPeer(target);
 292.233 -        //targetCreatedPeer(target, peer);
 292.234 -        //return peer;
 292.235 -        return null;
 292.236 -    }
 292.237 -
 292.238 -    public ScrollPanePeer createScrollPane(ScrollPane target) {
 292.239 -        //ScrollPanePeer peer = new MScrollPanePeer(target);
 292.240 -        //targetCreatedPeer(target, peer);
 292.241 -        //return peer;
 292.242 -        return null;
 292.243 -    }
 292.244 -
 292.245 -    public TextAreaPeer createTextArea(TextArea target) {
 292.246 -        //TextAreaPeer peer = new MTextAreaPeer(target);
 292.247 -        //targetCreatedPeer(target, peer);
 292.248 -        //return peer;
 292.249 -        return null;
 292.250 -    }
 292.251 -
 292.252 -    public ChoicePeer createChoice(Choice target) {
 292.253 -        //ChoicePeer peer = new MChoicePeer(target);
 292.254 -        //targetCreatedPeer(target, peer);
 292.255 -        //return peer;
 292.256 -        return null;
 292.257 -    }
 292.258 -
 292.259 -    public FramePeer  createFrame(Frame target) {
 292.260 -        //FramePeer peer = new MFramePeer(target);
 292.261 -        //targetCreatedPeer(target, peer);
 292.262 -        //return peer;
 292.263 -        return null;
 292.264 -    }
 292.265 -
 292.266 -    public CanvasPeer createCanvas(Canvas target) {
 292.267 -        //CanvasPeer peer = (isXEmbedServerRequested() ? new MEmbedCanvasPeer(target) : new MCanvasPeer(target));
 292.268 -        //targetCreatedPeer(target, peer);
 292.269 -        //return peer;
 292.270 -        return null;
 292.271 -    }
 292.272 -
 292.273 -    public PanelPeer createPanel(Panel target) {
 292.274 -        //PanelPeer peer = new MPanelPeer(target);
 292.275 -        //targetCreatedPeer(target, peer);
 292.276 -        //return peer;
 292.277 -        return null;
 292.278 -    }
 292.279 -
 292.280 -    public WindowPeer createWindow(Window target) {
 292.281 -        //WindowPeer peer = new MWindowPeer(target);
 292.282 -        //targetCreatedPeer(target, peer);
 292.283 -        //return peer;
 292.284 -        return null;
 292.285 -    }
 292.286 -
 292.287 -    public DialogPeer createDialog(Dialog target) {
 292.288 -        //DialogPeer peer = new MDialogPeer(target);
 292.289 -        //targetCreatedPeer(target, peer);
 292.290 -        //return peer;
 292.291 -        return null;
 292.292 -    }
 292.293 -
 292.294 -    public FileDialogPeer createFileDialog(FileDialog target) {
 292.295 -        //FileDialogPeer peer = new MFileDialogPeer(target);
 292.296 -        //targetCreatedPeer(target, peer);
 292.297 -        //return peer;
 292.298 -        return null;
 292.299 -    }
 292.300 -
 292.301 -    public MenuBarPeer createMenuBar(MenuBar target) {
 292.302 -        //MenuBarPeer peer = new MMenuBarPeer(target);
 292.303 -        //targetCreatedPeer(target, peer);
 292.304 -        //return peer;
 292.305 -        return null;
 292.306 -    }
 292.307 -
 292.308 -    public MenuPeer createMenu(Menu target) {
 292.309 -        //MenuPeer peer = new MMenuPeer(target);
 292.310 -        //targetCreatedPeer(target, peer);
 292.311 -        //return peer;
 292.312 -        return null;
 292.313 -    }
 292.314 -
 292.315 -    public PopupMenuPeer createPopupMenu(PopupMenu target) {
 292.316 -        //PopupMenuPeer peer = new MPopupMenuPeer(target);
 292.317 -        //targetCreatedPeer(target, peer);
 292.318 -        //return peer;
 292.319 -        return null;
 292.320 -    }
 292.321 -
 292.322 -    public MenuItemPeer createMenuItem(MenuItem target) {
 292.323 -        //MenuItemPeer peer = new MMenuItemPeer(target);
 292.324 -        //targetCreatedPeer(target, peer);
 292.325 -        //return peer;
 292.326 -        return null;
 292.327 -    }
 292.328 -
 292.329 -    public CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target) {
 292.330 -        //CheckboxMenuItemPeer peer = new MCheckboxMenuItemPeer(target);
 292.331 -        //targetCreatedPeer(target, peer);
 292.332 -        //return peer;
 292.333 -        return null;
 292.334 -    }
 292.335 -
 292.336 -    public KeyboardFocusManagerPeer createKeyboardFocusManagerPeer(KeyboardFocusManager manager) {
 292.337 -        return null;
 292.338 -    }
 292.339 -
 292.340 -    //public MEmbeddedFramePeer createEmbeddedFrame(MEmbeddedFrame target)
 292.341 -    //{
 292.342 -        //MEmbeddedFramePeer peer = new MEmbeddedFramePeer(target);
 292.343 -        //targetCreatedPeer(target, peer);
 292.344 -        //return peer;
 292.345 -    //    return null;
 292.346 -    //}
 292.347 -
 292.348 -
 292.349 -    public FontPeer getFontPeer(String name, int style){
 292.350 -        return new MFontPeer(name, style);
 292.351 -    }
 292.352 -
 292.353 -    /*
 292.354 -     * On X, support for dynamic layout on resizing is governed by the
 292.355 -     * window manager.  If the window manager supports it, it happens
 292.356 -     * automatically.  The setter method for this property is
 292.357 -     * irrelevant on X.
 292.358 -     */
 292.359 -    public void setDynamicLayout(boolean b) {
 292.360 -        dynamicLayoutSetting = b;
 292.361 -    }
 292.362 -
 292.363 -    protected boolean isDynamicLayoutSet() {
 292.364 -        return dynamicLayoutSetting;
 292.365 -    }
 292.366 -
 292.367 -    /* Called from isDynamicLayoutActive() and from
 292.368 -     * lazilyLoadDynamicLayoutSupportedProperty()
 292.369 -     */
 292.370 -    protected native boolean isDynamicLayoutSupportedNative();
 292.371 -
 292.372 -    public boolean isDynamicLayoutActive() {
 292.373 -        return isDynamicLayoutSupportedNative();
 292.374 -    }
 292.375 -
 292.376 -    public native boolean isFrameStateSupported(int state);
 292.377 -
 292.378 -    public TrayIconPeer createTrayIcon(TrayIcon target) throws HeadlessException {
 292.379 -        return null;
 292.380 -    }
 292.381 -
 292.382 -    public SystemTrayPeer createSystemTray(SystemTray target) throws HeadlessException {
 292.383 -        return null;
 292.384 -    }
 292.385 -
 292.386 -    public boolean isTraySupported() {
 292.387 -        return false;
 292.388 -    }
 292.389 -
 292.390 -    static native ColorModel makeColorModel();
 292.391 -    static ColorModel screenmodel;
 292.392 -
 292.393 -    static ColorModel getStaticColorModel() {
 292.394 -        if (screenmodel == null) {
 292.395 -            screenmodel = config.getColorModel ();
 292.396 -        }
 292.397 -        return screenmodel;
 292.398 -    }
 292.399 -
 292.400 -    public ColorModel getColorModel() {
 292.401 -        return getStaticColorModel();
 292.402 -    }
 292.403 -
 292.404 -    public native int getScreenResolution();
 292.405 -
 292.406 -    public Insets getScreenInsets(GraphicsConfiguration gc) {
 292.407 -        return new Insets(0,0,0,0);
 292.408 -    }
 292.409 -
 292.410 -    protected native int getScreenWidth();
 292.411 -    protected native int getScreenHeight();
 292.412 -
 292.413 -    public FontMetrics getFontMetrics(Font font) {
 292.414 -        /*
 292.415 -        // REMIND: platform font flag should be obsolete soon
 292.416 -        if (!RasterOutputManager.usesPlatformFont()) {
 292.417 -            return super.getFontMetrics(font);
 292.418 -        } else {
 292.419 -            return X11FontMetrics.getFontMetrics(font);
 292.420 -        }
 292.421 -        */
 292.422 -        return super.getFontMetrics(font);
 292.423 -    }
 292.424 -
 292.425 -    public PrintJob getPrintJob(final Frame frame, final String doctitle,
 292.426 -                                final Properties props) {
 292.427 -
 292.428 -        if (GraphicsEnvironment.isHeadless()) {
 292.429 -            throw new IllegalArgumentException();
 292.430 -        }
 292.431 -
 292.432 -        PrintJob2D printJob = new PrintJob2D(frame, doctitle, props);
 292.433 -
 292.434 -        if (printJob.printDialog() == false) {
 292.435 -            printJob = null;
 292.436 -        }
 292.437 -
 292.438 -        return printJob;
 292.439 -    }
 292.440 -
 292.441 -    public PrintJob getPrintJob(final Frame frame, final String doctitle,
 292.442 -                                final JobAttributes jobAttributes,
 292.443 -                                final PageAttributes pageAttributes) {
 292.444 -
 292.445 -
 292.446 -        if (GraphicsEnvironment.isHeadless()) {
 292.447 -            throw new IllegalArgumentException();
 292.448 -        }
 292.449 -
 292.450 -        PrintJob2D printJob = new PrintJob2D(frame, doctitle,
 292.451 -                                             jobAttributes, pageAttributes);
 292.452 -
 292.453 -        if (printJob.printDialog() == false) {
 292.454 -            printJob = null;
 292.455 -        }
 292.456 -
 292.457 -        return printJob;
 292.458 -    }
 292.459 -
 292.460 -    public native void beep();
 292.461 -
 292.462 -    public  Clipboard getSystemClipboard() {
 292.463 -        //SecurityManager security = System.getSecurityManager();
 292.464 -        //if (security != null) {
 292.465 -        //  security.checkSystemClipboardAccess();
 292.466 -        //}
 292.467 -        //synchronized (this) {
 292.468 -        //    if (clipboard == null) {
 292.469 -        //        clipboard = new X11Clipboard("System", "CLIPBOARD");
 292.470 -        //    }
 292.471 -        //}
 292.472 -        //return clipboard;
 292.473 -        return null;
 292.474 -    }
 292.475 -
 292.476 -    public Clipboard getSystemSelection() {
 292.477 -        //SecurityManager security = System.getSecurityManager();
 292.478 -        //if (security != null) {
 292.479 -        //    security.checkSystemClipboardAccess();
 292.480 -        //}
 292.481 -        //synchronized (this) {
 292.482 -        //    if (selection == null) {
 292.483 -        //        selection = new X11Clipboard("Selection", "PRIMARY");
 292.484 -        //    }
 292.485 -        //}
 292.486 -        //return selection;
 292.487 -        return null;
 292.488 -    }
 292.489 -
 292.490 -    public boolean getLockingKeyState(int key) {
 292.491 -        if (! (key == KeyEvent.VK_CAPS_LOCK || key == KeyEvent.VK_NUM_LOCK ||
 292.492 -               key == KeyEvent.VK_SCROLL_LOCK || key == KeyEvent.VK_KANA_LOCK)) {
 292.493 -            throw new IllegalArgumentException("invalid key for Toolkit.getLockingKeyState");
 292.494 -        }
 292.495 -        return getLockingKeyStateNative(key);
 292.496 -    }
 292.497 -
 292.498 -    public native boolean getLockingKeyStateNative(int key);
 292.499 -
 292.500 -    public native void loadSystemColors(int[] systemColors);
 292.501 -
 292.502 -    /**
 292.503 -     * Give native peers the ability to query the native container
 292.504 -     * given a native component (e.g. the direct parent may be lightweight).
 292.505 -     */
 292.506 -    public static Container getNativeContainer(Component c) {
 292.507 -        return Toolkit.getNativeContainer(c);
 292.508 -    }
 292.509 -
 292.510 -    protected static final Object targetToPeer(Object target) {
 292.511 -        return SunToolkit.targetToPeer(target);
 292.512 -    }
 292.513 -
 292.514 -    protected static final void targetDisposedPeer(Object target, Object peer) {
 292.515 -        SunToolkit.targetDisposedPeer(target, peer);
 292.516 -    }
 292.517 -
 292.518 -    public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
 292.519 -        //if (MToolkit.useMotifDnD()) {
 292.520 -        //    return MDragSourceContextPeer.createDragSourceContextPeer(dge);
 292.521 -        //} else {
 292.522 -        //    return X11DragSourceContextPeer.createDragSourceContextPeer(dge);
 292.523 -        //}
 292.524 -        return null;
 292.525 -    }
 292.526 -
 292.527 -    public <T extends DragGestureRecognizer> T
 292.528 -        createDragGestureRecognizer(Class<T> abstractRecognizerClass,
 292.529 -                                    DragSource ds, Component c, int srcActions,
 292.530 -                                    DragGestureListener dgl)
 292.531 -    {
 292.532 -        //if (MouseDragGestureRecognizer.class.equals(abstractRecognizerClass))
 292.533 -        //    return (T)new MMouseDragGestureRecognizer(ds, c, srcActions, dgl);
 292.534 -        //else
 292.535 -            return null;
 292.536 -    }
 292.537 -
 292.538 -    /**
 292.539 -     * Returns a new input method adapter descriptor for native input methods.
 292.540 -     */
 292.541 -    public InputMethodDescriptor getInputMethodAdapterDescriptor() throws AWTException {
 292.542 -        return null; // return new MInputMethodDescriptor();
 292.543 -    }
 292.544 -
 292.545 -    /**
 292.546 -     * Returns a style map for the input method highlight.
 292.547 -     */
 292.548 -    public Map mapInputMethodHighlight(InputMethodHighlight highlight) {
 292.549 -        return null; //return MInputMethod.mapInputMethodHighlight(highlight);
 292.550 -    }
 292.551 -
 292.552 -    /**
 292.553 -     * Returns a new custom cursor.
 292.554 -     */
 292.555 -    public Cursor createCustomCursor(Image cursor, Point hotSpot, String name)
 292.556 -        throws IndexOutOfBoundsException {
 292.557 -        return null; //return new MCustomCursor(cursor, hotSpot, name);
 292.558 -    }
 292.559 -
 292.560 -    /**
 292.561 -     * Returns the supported cursor size
 292.562 -     */
 292.563 -    public Dimension getBestCursorSize(int preferredWidth, int preferredHeight) {
 292.564 -        return null; //MCustomCursor.getBestCursorSize(
 292.565 -            //java.lang.Math.max(1,preferredWidth), java.lang.Math.max(1,preferredHeight));
 292.566 -    }
 292.567 -
 292.568 -    public int getMaximumCursorColors() {
 292.569 -        return 2;  // Black and white.
 292.570 -    }
 292.571 -
 292.572 -    private final static String prefix  = "DnD.Cursor.";
 292.573 -    private final static String postfix = ".32x32";
 292.574 -    private static final String dndPrefix  = "DnD.";
 292.575 -
 292.576 -    protected Object lazilyLoadDesktopProperty(String name) {
 292.577 -        if (name.startsWith(prefix)) {
 292.578 -            String cursorName = name.substring(prefix.length(), name.length()) + postfix;
 292.579 -
 292.580 -            try {
 292.581 -                return Cursor.getSystemCustomCursor(cursorName);
 292.582 -            } catch (AWTException awte) {
 292.583 -                System.err.println("cannot load system cursor: " + cursorName);
 292.584 -
 292.585 -                return null;
 292.586 -            }
 292.587 -        }
 292.588 -
 292.589 -        if (name.equals("awt.dynamicLayoutSupported")) {
 292.590 -            return lazilyLoadDynamicLayoutSupportedProperty(name);
 292.591 -        }
 292.592 -
 292.593 -        if (!loadedXSettings &&
 292.594 -            (name.startsWith("gnome.") ||
 292.595 -             name.equals(SunToolkit.DESKTOPFONTHINTS) ||
 292.596 -             name.startsWith(dndPrefix))) {
 292.597 -            loadedXSettings = true;
 292.598 -            if (!GraphicsEnvironment.isHeadless()) {
 292.599 -                loadXSettings();
 292.600 -                desktopProperties.put(SunToolkit.DESKTOPFONTHINTS,
 292.601 -                                      SunToolkit.getDesktopFontHints());
 292.602 -                return desktopProperties.get(name);
 292.603 -            }
 292.604 -        }
 292.605 -
 292.606 -        return super.lazilyLoadDesktopProperty(name);
 292.607 -    }
 292.608 -
 292.609 -    /*
 292.610 -     * Called from lazilyLoadDesktopProperty because we may not know if
 292.611 -     * the user has quit the previous window manager and started another.
 292.612 -     */
 292.613 -    protected Boolean lazilyLoadDynamicLayoutSupportedProperty(String name) {
 292.614 -        boolean nativeDynamic = isDynamicLayoutSupportedNative();
 292.615 -
 292.616 -        if (log.isLoggable(PlatformLogger.FINER)) {
 292.617 -            log.finer("nativeDynamic == " + nativeDynamic);
 292.618 -        }
 292.619 -
 292.620 -        return Boolean.valueOf(nativeDynamic);
 292.621 -    }
 292.622 -
 292.623 -    private native int getMulticlickTime();
 292.624 -
 292.625 -    protected void initializeDesktopProperties() {
 292.626 -        desktopProperties.put("DnD.Autoscroll.initialDelay",     Integer.valueOf(50));
 292.627 -        desktopProperties.put("DnD.Autoscroll.interval",         Integer.valueOf(50));
 292.628 -        desktopProperties.put("DnD.Autoscroll.cursorHysteresis", Integer.valueOf(5));
 292.629 -
 292.630 -        /* As of 1.4, no wheel mice are supported on Solaris
 292.631 -         * however, they are on Linux, and there isn't a way to detect them,
 292.632 -         * so we leave this property unset to indicate we're not sure if there's
 292.633 -         * a wheel mouse or not.
 292.634 -         */
 292.635 -        //desktopProperties.put("awt.wheelMousePresent", Boolean.valueOf(false));
 292.636 -
 292.637 -        // We don't want to call getMultilclickTime() if we're headless
 292.638 -        if (!GraphicsEnvironment.isHeadless()) {
 292.639 -            desktopProperties.put("awt.multiClickInterval",
 292.640 -                                  Integer.valueOf(getMulticlickTime()));
 292.641 -            desktopProperties.put("awt.mouse.numButtons",
 292.642 -                                  Integer.valueOf(getNumberOfButtons()));
 292.643 -        }
 292.644 -    }
 292.645 -
 292.646 -    public RobotPeer createRobot(Robot target, GraphicsDevice screen) {
 292.647 -        /* 'target' is unused for now... */
 292.648 -        //return new MRobotPeer(screen.getDefaultConfiguration());
 292.649 -        return null;
 292.650 -    }
 292.651 -
 292.652 -    static boolean useMotifDnD() {
 292.653 -        return motifdnd;
 292.654 -    }
 292.655 -
 292.656 -    //
 292.657 -    // The following support Gnome's equivalent of desktop properties.
 292.658 -    // A writeup of this can be found at:
 292.659 -    // http://www.freedesktop.org/standards/xsettings/xsettings.html
 292.660 -    //
 292.661 -
 292.662 -    /**
 292.663 -     * Triggers a callback to parseXSettings with the x settings values
 292.664 -     * from the window server. Note that this will NOT call
 292.665 -     * parseXSettings if we are not running on a GNOME desktop.
 292.666 -     */
 292.667 -    private native void loadXSettings();
 292.668 -
 292.669 -    /**
 292.670 -     * Callback from the native side indicating some, or all, of the
 292.671 -     * desktop properties have changed and need to be reloaded.
 292.672 -     * <code>data</code> is the byte array directly from the x server and
 292.673 -     * may be in little endian format.
 292.674 -     * <p>
 292.675 -     * NB: This could be called from any thread if triggered by
 292.676 -     * <code>loadXSettings</code>.  It is called from the toolkit
 292.677 -     * thread if triggered by an XSETTINGS change.
 292.678 -     */
 292.679 -    private void parseXSettings(int screen_XXX_ignored, byte[] data) {
 292.680 -        // XXX: notyet: map screen -> per screen XSettings object
 292.681 -        // for now native code only calls us for default screen
 292.682 -        // see awt_MToolkit.c awt_xsettings_update().
 292.683 -        if (xs == null) {
 292.684 -            xs = new XSettings();
 292.685 -        }
 292.686 -
 292.687 -        Map updatedSettings = xs.update(data);
 292.688 -        if (updatedSettings == null || updatedSettings.isEmpty()) {
 292.689 -            return;
 292.690 -        }
 292.691 -
 292.692 -        Iterator i = updatedSettings.entrySet().iterator();
 292.693 -        while (i.hasNext()) {
 292.694 -            Map.Entry e = (Map.Entry)i.next();
 292.695 -            String name = (String)e.getKey();
 292.696 -
 292.697 -            name = "gnome." + name;
 292.698 -            setDesktopProperty(name, e.getValue());
 292.699 -
 292.700 -            // XXX: we probably want to do something smarter.  In
 292.701 -            // particular, "Net" properties are of interest to the
 292.702 -            // "core" AWT itself.  E.g.
 292.703 -            //
 292.704 -            // Net/DndDragThreshold -> ???
 292.705 -            // Net/DoubleClickTime  -> awt.multiClickInterval
 292.706 -        }
 292.707 -
 292.708 -        setDesktopProperty(SunToolkit.DESKTOPFONTHINTS,
 292.709 -                           SunToolkit.getDesktopFontHints());
 292.710 -
 292.711 -        Integer dragThreshold = null;
 292.712 -        synchronized (this) {
 292.713 -            dragThreshold = (Integer)desktopProperties.get("gnome.Net/DndDragThreshold");
 292.714 -        }
 292.715 -        if (dragThreshold != null) {
 292.716 -            setDesktopProperty("DnD.gestureMotionThreshold", dragThreshold);
 292.717 -        }
 292.718 -    }
 292.719 -
 292.720 -    protected boolean needsXEmbedImpl() {
 292.721 -        return true;
 292.722 -    }
 292.723 -
 292.724 -    public boolean isModalityTypeSupported(Dialog.ModalityType modalityType) {
 292.725 -        return (modalityType == Dialog.ModalityType.MODELESS) ||
 292.726 -               (modalityType == Dialog.ModalityType.APPLICATION_MODAL);
 292.727 -    }
 292.728 -
 292.729 -    public boolean isModalExclusionTypeSupported(Dialog.ModalExclusionType exclusionType) {
 292.730 -        return (exclusionType == Dialog.ModalExclusionType.NO_EXCLUDE);
 292.731 -    }
 292.732 -
 292.733 -    private native boolean isSyncUpdated();
 292.734 -    private native boolean isSyncFailed();
 292.735 -    private native int getEventNumber();
 292.736 -    private native void updateSyncSelection();
 292.737 -    private static final long WORKAROUND_SLEEP = 100;
 292.738 -
 292.739 -    /**
 292.740 -     * @inheritDoc
 292.741 -     */
 292.742 -    protected boolean syncNativeQueue(final long timeout) {
 292.743 -        awtLock();
 292.744 -        try {
 292.745 -            long event_number = getEventNumber();
 292.746 -            updateSyncSelection();
 292.747 -
 292.748 -            // Wait for selection notify for oops on win
 292.749 -            long start = System.currentTimeMillis();
 292.750 -            while (!isSyncUpdated() && !isSyncFailed()) {
 292.751 -                try {
 292.752 -                    awtLockWait(timeout);
 292.753 -                } catch (InterruptedException e) {
 292.754 -                    throw new RuntimeException(e);
 292.755 -                }
 292.756 -                // This "while" is a protection from spurious
 292.757 -                // wake-ups.  However, we shouldn't wait for too long
 292.758 -                if (((System.currentTimeMillis() - start) > timeout) && (timeout >= 0)) {
 292.759 -                    throw new OperationTimedOut();
 292.760 -                }
 292.761 -            }
 292.762 -            if (isSyncFailed() && getEventNumber() - event_number == 1) {
 292.763 -                awtUnlock();
 292.764 -                try {
 292.765 -                    Thread.sleep(WORKAROUND_SLEEP);
 292.766 -                } catch (InterruptedException ie) {
 292.767 -                    throw new RuntimeException(ie);
 292.768 -                } finally {
 292.769 -                    awtLock();
 292.770 -                }
 292.771 -            }
 292.772 -            return getEventNumber() - event_number > 2;
 292.773 -        } finally {
 292.774 -            awtUnlock();
 292.775 -        }
 292.776 -    }
 292.777 -
 292.778 -    public  void grab(Window w) {
 292.779 -        WindowPeer peer = (WindowPeer)w.getPeer();
 292.780 -        if (peer != null) {
 292.781 -            nativeGrab(peer);
 292.782 -        }
 292.783 -    }
 292.784 -
 292.785 -    public void ungrab(Window w) {
 292.786 -        WindowPeer peer = (WindowPeer)w.getPeer();
 292.787 -        if (peer != null) {
 292.788 -            nativeUnGrab(peer);
 292.789 -        }
 292.790 -    }
 292.791 -    private native void nativeGrab(WindowPeer peer);
 292.792 -    private native void nativeUnGrab(WindowPeer peer);
 292.793 -
 292.794 -
 292.795 -    public boolean isDesktopSupported(){
 292.796 -        return false;
 292.797 -    }
 292.798 -
 292.799 -    public DesktopPeer createDesktopPeer(Desktop target)
 292.800 -    throws HeadlessException{
 292.801 -        throw new UnsupportedOperationException();
 292.802 -    }
 292.803 -
 292.804 -    public final static int
 292.805 -        UNDETERMINED_WM = 1,
 292.806 -        NO_WM = 2,
 292.807 -        OTHER_WM = 3,
 292.808 -        OPENLOOK_WM = 4,
 292.809 -        MOTIF_WM = 5,
 292.810 -        CDE_WM = 6,
 292.811 -        ENLIGHTEN_WM = 7,
 292.812 -        KDE2_WM = 8,
 292.813 -        SAWFISH_WM = 9,
 292.814 -        ICE_WM = 10,
 292.815 -        METACITY_WM = 11,
 292.816 -        COMPIZ_WM = 12,
 292.817 -        LG3D_WM = 13;
 292.818 -
 292.819 -    public static int getWMID() {
 292.820 -        String wmName = getWMName();
 292.821 -
 292.822 -        if ("NO_WM".equals(wmName)) {
 292.823 -            return NO_WM;
 292.824 -        } else if ("OTHER_WM".equals(wmName)) {
 292.825 -            return OTHER_WM;
 292.826 -        } else if ("ENLIGHTEN_WM".equals(wmName)) {
 292.827 -            return ENLIGHTEN_WM;
 292.828 -        } else if ("KDE2_WM".equals(wmName)) {
 292.829 -            return KDE2_WM;
 292.830 -        } else if ("SAWFISH_WM".equals(wmName)) {
 292.831 -            return SAWFISH_WM;
 292.832 -        } else if ("ICE_WM".equals(wmName)) {
 292.833 -            return ICE_WM;
 292.834 -        } else if ("METACITY_WM".equals(wmName)) {
 292.835 -            return METACITY_WM;
 292.836 -        } else if ("OPENLOOK_WM".equals(wmName)) {
 292.837 -            return OPENLOOK_WM;
 292.838 -        } else if ("MOTIF_WM".equals(wmName)) {
 292.839 -            return MOTIF_WM;
 292.840 -        } else if ("CDE_WM".equals(wmName)) {
 292.841 -            return CDE_WM;
 292.842 -        } else if ("COMPIZ_WM".equals(wmName)) {
 292.843 -            return COMPIZ_WM;
 292.844 -        } else if ("LG3D_WM".equals(wmName)) {
 292.845 -            return LG3D_WM;
 292.846 -        }
 292.847 -        return UNDETERMINED_WM;
 292.848 -    }
 292.849 -
 292.850 -    private static native String getWMName();
 292.851 -
 292.852 -} // class MToolkit
   293.1 --- a/src/solaris/classes/sun/awt/motif/MToolkitThreadBlockedHandler.java	Tue Dec 06 16:31:58 2011 -0800
   293.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   293.3 @@ -1,49 +0,0 @@
   293.4 -/*
   293.5 - * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
   293.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   293.7 - *
   293.8 - * This code is free software; you can redistribute it and/or modify it
   293.9 - * under the terms of the GNU General Public License version 2 only, as
  293.10 - * published by the Free Software Foundation.  Oracle designates this
  293.11 - * particular file as subject to the "Classpath" exception as provided
  293.12 - * by Oracle in the LICENSE file that accompanied this code.
  293.13 - *
  293.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
  293.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  293.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  293.17 - * version 2 for more details (a copy is included in the LICENSE file that
  293.18 - * accompanied this code).
  293.19 - *
  293.20 - * You should have received a copy of the GNU General Public License version
  293.21 - * 2 along with this work; if not, write to the Free Software Foundation,
  293.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  293.23 - *
  293.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  293.25 - * or visit www.oracle.com if you need additional information or have any
  293.26 - * questions.
  293.27 - */
  293.28 -
  293.29 -package sun.awt.motif;
  293.30 -
  293.31 -import sun.awt.datatransfer.ToolkitThreadBlockedHandler;
  293.32 -import sun.awt.SunToolkit;
  293.33 -
  293.34 -final class MToolkitThreadBlockedHandler implements
  293.35 -                                 ToolkitThreadBlockedHandler {
  293.36 -    private static ToolkitThreadBlockedHandler priveleged_lock = null;
  293.37 -    static {
  293.38 -        priveleged_lock = new MToolkitThreadBlockedHandler();
  293.39 -    }
  293.40 -    private MToolkitThreadBlockedHandler() {}
  293.41 -    static ToolkitThreadBlockedHandler getToolkitThreadBlockedHandler() {
  293.42 -        return priveleged_lock;
  293.43 -    }
  293.44 -    public void lock() {
  293.45 -        SunToolkit.awtLock();
  293.46 -    }
  293.47 -    public void unlock() {
  293.48 -        SunToolkit.awtUnlock();
  293.49 -    }
  293.50 -    public native void enter();
  293.51 -    public native void exit();
  293.52 -}
   294.1 --- a/src/solaris/classes/sun/awt/motif/MWindowAttributes.java	Tue Dec 06 16:31:58 2011 -0800
   294.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   294.3 @@ -1,72 +0,0 @@
   294.4 -/*
   294.5 - * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
   294.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   294.7 - *
   294.8 - * This code is free software; you can redistribute it and/or modify it
   294.9 - * under the terms of the GNU General Public License version 2 only, as
  294.10 - * published by the Free Software Foundation.  Oracle designates this
  294.11 - * particular file as subject to the "Classpath" exception as provided
  294.12 - * by Oracle in the LICENSE file that accompanied this code.
  294.13 - *
  294.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
  294.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  294.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  294.17 - * version 2 for more details (a copy is included in the LICENSE file that
  294.18 - * accompanied this code).
  294.19 - *
  294.20 - * You should have received a copy of the GNU General Public License version
  294.21 - * 2 along with this work; if not, write to the Free Software Foundation,
  294.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  294.23 - *
  294.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  294.25 - * or visit www.oracle.com if you need additional information or have any
  294.26 - * questions.
  294.27 - */
  294.28 -package sun.awt.motif;
  294.29 -import java.awt.Image;
  294.30 -
  294.31 -class MWindowAttributes {
  294.32 -    static int NORMAL           = 0;
  294.33 -    static int ICONIC           = 1;
  294.34 -    static int MAXIMIZED        = 2;
  294.35 -
  294.36 -    static int AWT_DECOR_NONE        = 0;
  294.37 -    static int AWT_DECOR_ALL         = 1;
  294.38 -    static int AWT_DECOR_BORDER      = 2;
  294.39 -    static int AWT_DECOR_RESIZEH     = 4;
  294.40 -    static int AWT_DECOR_TITLE       = 8;
  294.41 -    static int AWT_DECOR_MENU        = 0x10;
  294.42 -    static int AWT_DECOR_MINIMIZE    = 0x20;
  294.43 -    static int AWT_DECOR_MAXIMIZE    = 0x40;
  294.44 -    static int AWT_UNOBSCURED        = 0;   // X11 VisibilityUnobscured
  294.45 -    static int AWT_PARTIALLY_OBSCURED = 1;  // X11 VisibilityPartiallyObscured
  294.46 -    static int AWT_FULLY_OBSCURED    =  2;  // X11 VisibilityFullyObscured
  294.47 -    static int AWT_UNKNOWN_OBSCURITY = 3;
  294.48 -
  294.49 -    boolean nativeDecor;
  294.50 -    boolean initialFocus;
  294.51 -    boolean isResizable;
  294.52 -    int initialState;
  294.53 -    int visibilityState; // updated by native X11 event handling code.
  294.54 -    String title;
  294.55 -    java.awt.Image icon;
  294.56 -    int decorations;            // for future expansion to be able to
  294.57 -                                // specify native decorations
  294.58 -
  294.59 -    private static native void initIDs();
  294.60 -
  294.61 -    static {
  294.62 -        initIDs();
  294.63 -    }
  294.64 -
  294.65 -    MWindowAttributes() {
  294.66 -        nativeDecor = false;
  294.67 -        initialFocus = false;
  294.68 -        isResizable = false;
  294.69 -        initialState = NORMAL;
  294.70 -        visibilityState = AWT_UNKNOWN_OBSCURITY;
  294.71 -        title = null;
  294.72 -        icon = null;
  294.73 -        decorations = 0;
  294.74 -    }
  294.75 -}
   295.1 --- a/src/solaris/classes/sun/awt/motif/X11FontMetrics.java	Tue Dec 06 16:31:58 2011 -0800
   295.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   295.3 @@ -1,230 +0,0 @@
   295.4 -/*
   295.5 - * Copyright (c) 1995, 2004, Oracle and/or its affiliates. All rights reserved.
   295.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   295.7 - *
   295.8 - * This code is free software; you can redistribute it and/or modify it
   295.9 - * under the terms of the GNU General Public License version 2 only, as
  295.10 - * published by the Free Software Foundation.  Oracle designates this
  295.11 - * particular file as subject to the "Classpath" exception as provided
  295.12 - * by Oracle in the LICENSE file that accompanied this code.
  295.13 - *
  295.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
  295.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  295.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  295.17 - * version 2 for more details (a copy is included in the LICENSE file that
  295.18 - * accompanied this code).
  295.19 - *
  295.20 - * You should have received a copy of the GNU General Public License version
  295.21 - * 2 along with this work; if not, write to the Free Software Foundation,
  295.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  295.23 - *
  295.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  295.25 - * or visit www.oracle.com if you need additional information or have any
  295.26 - * questions.
  295.27 - */
  295.28 -
  295.29 -package sun.awt.motif;
  295.30 -
  295.31 -import java.awt.*;
  295.32 -import java.util.Hashtable;
  295.33 -import sun.awt.PlatformFont;
  295.34 -
  295.35 -/**
  295.36 - * A font metrics object for a WServer font.
  295.37 - *
  295.38 - * @author Jim Graham
  295.39 - */
  295.40 -public class X11FontMetrics extends FontMetrics {
  295.41 -    /**
  295.42 -     * The widths of the first 256 characters.
  295.43 -     */
  295.44 -    int widths[];
  295.45 -
  295.46 -    /**
  295.47 -     * The standard ascent of the font.  This is the logical height
  295.48 -     * above the baseline for the Alphanumeric characters and should
  295.49 -     * be used for determining line spacing.  Note, however, that some
  295.50 -     * characters in the font may extend above this height.
  295.51 -     */
  295.52 -    int ascent;
  295.53 -
  295.54 -    /**
  295.55 -     * The standard descent of the font.  This is the logical height
  295.56 -     * below the baseline for the Alphanumeric characters and should
  295.57 -     * be used for determining line spacing.  Note, however, that some
  295.58 -     * characters in the font may extend below this height.
  295.59 -     */
  295.60 -    int descent;
  295.61 -
  295.62 -    /**
  295.63 -     * The standard leading for the font.  This is the logical amount
  295.64 -     * of space to be reserved between the descent of one line of text
  295.65 -     * and the ascent of the next line.  The height metric is calculated
  295.66 -     * to include this extra space.
  295.67 -     */
  295.68 -    int leading;
  295.69 -
  295.70 -    /**
  295.71 -     * The standard height of a line of text in this font.  This is
  295.72 -     * the distance between the baseline of adjacent lines of text.
  295.73 -     * It is the sum of the ascent+descent+leading.  There is no
  295.74 -     * guarantee that lines of text spaced at this distance will be
  295.75 -     * disjoint; such lines may overlap if some characters overshoot
  295.76 -     * the standard ascent and descent metrics.
  295.77 -     */
  295.78 -    int height;
  295.79 -
  295.80 -    /**
  295.81 -     * The maximum ascent for all characters in this font.  No character
  295.82 -     * will extend further above the baseline than this metric.
  295.83 -     */
  295.84 -    int maxAscent;
  295.85 -
  295.86 -    /**
  295.87 -     * The maximum descent for all characters in this font.  No character
  295.88 -     * will descend further below the baseline than this metric.
  295.89 -     */
  295.90 -    int maxDescent;
  295.91 -
  295.92 -    /**
  295.93 -     * The maximum possible height of a line of text in this font.
  295.94 -     * Adjacent lines of text spaced this distance apart will be
  295.95 -     * guaranteed not to overlap.  Note, however, that many paragraphs
  295.96 -     * that contain ordinary alphanumeric text may look too widely
  295.97 -     * spaced if this metric is used to determine line spacing.  The
  295.98 -     * height field should be preferred unless the text in a given
  295.99 -     * line contains particularly tall characters.
 295.100 -     */
 295.101 -    int maxHeight;
 295.102 -
 295.103 -    /**
 295.104 -     * The maximum advance width of any character in this font.
 295.105 -     */
 295.106 -    int maxAdvance;
 295.107 -
 295.108 -    static {
 295.109 -        initIDs();
 295.110 -    }
 295.111 -
 295.112 -    /**
 295.113 -     * Initialize JNI field and method IDs for fields that may be
 295.114 -       accessed from C.
 295.115 -     */
 295.116 -    private static native void initIDs();
 295.117 -
 295.118 -     /**
 295.119 -     * Calculate the metrics from the given WServer and font.
 295.120 -     */
 295.121 -    public X11FontMetrics(Font font) {
 295.122 -        super(font);
 295.123 -        init();
 295.124 -    }
 295.125 -
 295.126 -    /**
 295.127 -     * Get leading
 295.128 -     */
 295.129 -    public int getLeading() {
 295.130 -        return leading;
 295.131 -    }
 295.132 -
 295.133 -    /**
 295.134 -     * Get ascent.
 295.135 -     */
 295.136 -    public int getAscent() {
 295.137 -        return ascent;
 295.138 -    }
 295.139 -
 295.140 -    /**
 295.141 -     * Get descent
 295.142 -     */
 295.143 -    public int getDescent() {
 295.144 -        return descent;
 295.145 -    }
 295.146 -
 295.147 -    /**
 295.148 -     * Get height
 295.149 -     */
 295.150 -    public int getHeight() {
 295.151 -        return height;
 295.152 -    }
 295.153 -
 295.154 -    /**
 295.155 -     * Get maxAscent
 295.156 -     */
 295.157 -    public int getMaxAscent() {
 295.158 -        return maxAscent;
 295.159 -    }
 295.160 -
 295.161 -    /**
 295.162 -     * Get maxDescent
 295.163 -     */
 295.164 -    public int getMaxDescent() {
 295.165 -        return maxDescent;
 295.166 -    }
 295.167 -
 295.168 -    /**
 295.169 -     * Get maxAdvance
 295.170 -     */
 295.171 -    public int getMaxAdvance() {
 295.172 -        return maxAdvance;
 295.173 -    }
 295.174 -
 295.175 -    /**
 295.176 -     * Return the width of the specified string in this Font.
 295.177 -     */
 295.178 -    public int stringWidth(String string) {
 295.179 -        return charsWidth(string.toCharArray(), 0, string.length());
 295.180 -    }
 295.181 -
 295.182 -    /**
 295.183 -     * Return the width of the specified char[] in this Font.
 295.184 -     */
 295.185 -    public int charsWidth(char chars[], int offset, int length) {
 295.186 -        Font font = getFont();
 295.187 -        PlatformFont pf = ((PlatformFont) font.getPeer());
 295.188 -        if (pf.mightHaveMultiFontMetrics()) {
 295.189 -            return getMFCharsWidth(chars, offset, length, font);
 295.190 -        } else {
 295.191 -            if (widths != null) {
 295.192 -                int w = 0;
 295.193 -                for (int i = offset; i < offset + length; i++) {
 295.194 -                    int ch = chars[i];
 295.195 -                    if (ch < 0 || ch >= widths.length) {
 295.196 -                        w += maxAdvance;
 295.197 -                    } else {
 295.198 -                        w += widths[ch];
 295.199 -                    }
 295.200 -                }
 295.201 -                return w;
 295.202 -            } else {
 295.203 -                return maxAdvance * length;
 295.204 -            }
 295.205 -        }
 295.206 -    }
 295.207 -
 295.208 -    private native int getMFCharsWidth(char chars[], int offset, int length, Font font);
 295.209 -
 295.210 -    /**
 295.211 -     * Return the width of the specified byte[] in this Font.
 295.212 -     */
 295.213 -    public native int bytesWidth(byte data[], int off, int len);
 295.214 -
 295.215 -    /**
 295.216 -     * Get the widths of the first 256 characters in the font.
 295.217 -     */
 295.218 -    public int[] getWidths() {
 295.219 -        return widths;
 295.220 -    }
 295.221 -
 295.222 -    native void init();
 295.223 -
 295.224 -    static Hashtable table = new Hashtable();
 295.225 -
 295.226 -    static synchronized FontMetrics getFontMetrics(Font font) {
 295.227 -        FontMetrics fm = (FontMetrics)table.get(font);
 295.228 -        if (fm == null) {
 295.229 -            table.put(font, fm = new X11FontMetrics(font));
 295.230 -        }
 295.231 -        return fm;
 295.232 -    }
 295.233 -}
   296.1 --- a/src/solaris/classes/sun/java2d/x11/X11Renderer.java	Tue Dec 06 16:31:58 2011 -0800
   296.2 +++ b/src/solaris/classes/sun/java2d/x11/X11Renderer.java	Mon Dec 19 10:06:23 2011 -0800
   296.3 @@ -299,7 +299,7 @@
   296.4      private void doPath(SunGraphics2D sg2d, Shape s, boolean isFill) {
   296.5          Path2D.Float p2df;
   296.6          int transx, transy;
   296.7 -        if (sg2d.transformState <= sg2d.TRANSFORM_INT_TRANSLATE) {
   296.8 +        if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) {
   296.9              if (s instanceof Path2D.Float) {
  296.10                  p2df = (Path2D.Float)s;
  296.11              } else {
  296.12 @@ -323,10 +323,10 @@
  296.13      }
  296.14  
  296.15      public void draw(SunGraphics2D sg2d, Shape s) {
  296.16 -        if (sg2d.strokeState == sg2d.STROKE_THIN) {
  296.17 +        if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
  296.18              // Delegate to drawPolygon() if possible...
  296.19              if (s instanceof Polygon &&
  296.20 -                sg2d.transformState < sg2d.TRANSFORM_TRANSLATESCALE)
  296.21 +                sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE)
  296.22              {
  296.23                  Polygon p = (Polygon) s;
  296.24                  drawPolygon(sg2d, p.xpoints, p.ypoints, p.npoints);
  296.25 @@ -336,7 +336,7 @@
  296.26              // Otherwise we will use drawPath() for
  296.27              // high-quality thin paths.
  296.28              doPath(sg2d, s, false);
  296.29 -        } else if (sg2d.strokeState < sg2d.STROKE_CUSTOM) {
  296.30 +        } else if (sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM) {
  296.31              // REMIND: X11 can handle uniform scaled wide lines
  296.32              // and dashed lines itself if we set the appropriate
  296.33              // XGC attributes (TBD).
  296.34 @@ -360,10 +360,10 @@
  296.35      }
  296.36  
  296.37      public void fill(SunGraphics2D sg2d, Shape s) {
  296.38 -        if (sg2d.strokeState == sg2d.STROKE_THIN) {
  296.39 +        if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) {
  296.40              // Delegate to fillPolygon() if possible...
  296.41              if (s instanceof Polygon &&
  296.42 -                sg2d.transformState < sg2d.TRANSFORM_TRANSLATESCALE)
  296.43 +                sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE)
  296.44              {
  296.45                  Polygon p = (Polygon) s;
  296.46                  fillPolygon(sg2d, p.xpoints, p.ypoints, p.npoints);
  296.47 @@ -378,7 +378,7 @@
  296.48  
  296.49          AffineTransform at;
  296.50          int transx, transy;
  296.51 -        if (sg2d.transformState < sg2d.TRANSFORM_TRANSLATESCALE) {
  296.52 +        if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
  296.53              // Transform (translation) will be done by XFillSpans
  296.54              at = null;
  296.55              transx = sg2d.transX;
   297.1 --- a/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java	Tue Dec 06 16:31:58 2011 -0800
   297.2 +++ b/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java	Mon Dec 19 10:06:23 2011 -0800
   297.3 @@ -295,9 +295,9 @@
   297.4  
   297.5      public void validatePipe(SunGraphics2D sg2d) {
   297.6          if (sg2d.antialiasHint != SunHints.INTVAL_ANTIALIAS_ON &&
   297.7 -            sg2d.paintState <= sg2d.PAINT_ALPHACOLOR &&
   297.8 -            (sg2d.compositeState <= sg2d.COMP_ISCOPY ||
   297.9 -             sg2d.compositeState == sg2d.COMP_XOR))
  297.10 +            sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR &&
  297.11 +            (sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY ||
  297.12 +             sg2d.compositeState == SunGraphics2D.COMP_XOR))
  297.13          {
  297.14              if (x11txpipe == null) {
  297.15                  /*
  297.16 @@ -315,7 +315,7 @@
  297.17                  return;
  297.18              }
  297.19  
  297.20 -            if (sg2d.clipState == sg2d.CLIP_SHAPE) {
  297.21 +            if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
  297.22                  // Do this to init textpipe correctly; we will override the
  297.23                  // other non-text pipes below
  297.24                  // REMIND: we should clean this up eventually instead of
  297.25 @@ -329,7 +329,7 @@
  297.26                  case SunHints.INTVAL_TEXT_ANTIALIAS_OFF:
  297.27                      // Use X11 pipe even if DGA is available since DGA
  297.28                      // text slows everything down when mixed with X11 calls
  297.29 -                    if (sg2d.compositeState == sg2d.COMP_ISCOPY) {
  297.30 +                    if (sg2d.compositeState == SunGraphics2D.COMP_ISCOPY) {
  297.31                          sg2d.textpipe = x11textpipe;
  297.32                      } else {
  297.33                          sg2d.textpipe = solidTextRenderer;
  297.34 @@ -353,7 +353,7 @@
  297.35                      case SunHints.INTVAL_TEXT_ANTIALIAS_OFF:
  297.36                      // Use X11 pipe even if DGA is available since DGA
  297.37                      // text slows everything down when mixed with X11 calls
  297.38 -                    if (sg2d.compositeState == sg2d.COMP_ISCOPY) {
  297.39 +                    if (sg2d.compositeState == SunGraphics2D.COMP_ISCOPY) {
  297.40                          sg2d.textpipe = x11textpipe;
  297.41                      } else {
  297.42                          sg2d.textpipe = solidTextRenderer;
  297.43 @@ -370,10 +370,10 @@
  297.44                  }
  297.45              }
  297.46  
  297.47 -            if (sg2d.transformState >= sg2d.TRANSFORM_TRANSLATESCALE) {
  297.48 +            if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
  297.49                  sg2d.drawpipe = x11txpipe;
  297.50                  sg2d.fillpipe = x11txpipe;
  297.51 -            } else if (sg2d.strokeState != sg2d.STROKE_THIN){
  297.52 +            } else if (sg2d.strokeState != SunGraphics2D.STROKE_THIN){
  297.53                  sg2d.drawpipe = x11txpipe;
  297.54                  sg2d.fillpipe = x11pipe;
  297.55              } else {
  297.56 @@ -398,8 +398,8 @@
  297.57      }
  297.58  
  297.59      public RenderLoops getRenderLoops(SunGraphics2D sg2d) {
  297.60 -        if (sg2d.paintState <= sg2d.PAINT_ALPHACOLOR &&
  297.61 -            sg2d.compositeState <= sg2d.COMP_ISCOPY)
  297.62 +        if (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR &&
  297.63 +            sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY)
  297.64          {
  297.65              return solidloops;
  297.66          }
  297.67 @@ -488,7 +488,7 @@
  297.68              makePipes();
  297.69          }
  297.70          CompositeType comptype = sg2d.imageComp;
  297.71 -        if (sg2d.transformState < sg2d.TRANSFORM_TRANSLATESCALE &&
  297.72 +        if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE &&
  297.73              (CompositeType.SrcOverNoEa.equals(comptype) ||
  297.74               CompositeType.SrcNoEa.equals(comptype)))
  297.75          {
   298.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   298.2 +++ b/src/solaris/native/sun/awt/HeadlessToolkit.c	Mon Dec 19 10:06:23 2011 -0800
   298.3 @@ -0,0 +1,44 @@
   298.4 +/*
   298.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   298.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   298.7 + *
   298.8 + * This code is free software; you can redistribute it and/or modify it
   298.9 + * under the terms of the GNU General Public License version 2 only, as
  298.10 + * published by the Free Software Foundation.  Oracle designates this
  298.11 + * particular file as subject to the "Classpath" exception as provided
  298.12 + * by Oracle in the LICENSE file that accompanied this code.
  298.13 + *
  298.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
  298.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  298.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  298.17 + * version 2 for more details (a copy is included in the LICENSE file that
  298.18 + * accompanied this code).
  298.19 + *
  298.20 + * You should have received a copy of the GNU General Public License version
  298.21 + * 2 along with this work; if not, write to the Free Software Foundation,
  298.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  298.23 + *
  298.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  298.25 + * or visit www.oracle.com if you need additional information or have any
  298.26 + * questions.
  298.27 + */
  298.28 +
  298.29 +#include <jni.h>
  298.30 +#include <jni_util.h>
  298.31 +
  298.32 +#ifdef HEADLESS
  298.33 +
  298.34 +extern JavaVM *jvm;
  298.35 +
  298.36 +JNIEXPORT jint JNICALL
  298.37 +JNI_OnLoad(JavaVM *vm, void *reserved)
  298.38 +{
  298.39 +    jvm = vm;
  298.40 +    return JNI_VERSION_1_2;
  298.41 +}
  298.42 +
  298.43 +JNIEXPORT jboolean JNICALL AWTIsHeadless() {
  298.44 +    return JNI_TRUE;
  298.45 +}
  298.46 +
  298.47 +#endif
   299.1 --- a/src/solaris/native/sun/awt/MouseInfo.c	Tue Dec 06 16:31:58 2011 -0800
   299.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   299.3 @@ -1,141 +0,0 @@
   299.4 -/*
   299.5 - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
   299.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   299.7 - *
   299.8 - * This code is free software; you can redistribute it and/or modify it
   299.9 - * under the terms of the GNU General Public License version 2 only, as
  299.10 - * published by the Free Software Foundation.  Oracle designates this
  299.11 - * particular file as subject to the "Classpath" exception as provided
  299.12 - * by Oracle in the LICENSE file that accompanied this code.
  299.13 - *
  299.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
  299.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  299.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  299.17 - * version 2 for more details (a copy is included in the LICENSE file that
  299.18 - * accompanied this code).
  299.19 - *
  299.20 - * You should have received a copy of the GNU General Public License version
  299.21 - * 2 along with this work; if not, write to the Free Software Foundation,
  299.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  299.23 - *
  299.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  299.25 - * or visit www.oracle.com if you need additional information or have any
  299.26 - * questions.
  299.27 - */
  299.28 -
  299.29 -#ifdef HEADLESS
  299.30 -    #error This file should not be included in headless library
  299.31 -#endif
  299.32 -
  299.33 -#include "awt_p.h"
  299.34 -#include "awt_Component.h"
  299.35 -
  299.36 -#include <jni.h>
  299.37 -#include <jni_util.h>
  299.38 -
  299.39 -extern int awt_numScreens;
  299.40 -extern AwtScreenDataPtr x11Screens;
  299.41 -extern struct ComponentIDs componentIDs;
  299.42 -extern struct MComponentPeerIDs mComponentPeerIDs;
  299.43 -
  299.44 -/*
  299.45 - * Class:     sun_awt_DefaultMouseInfoPeer
  299.46 - * Method:    fillPointWithCoords
  299.47 - * Signature: (Ljava/awt/Point)I
  299.48 - */
  299.49 -JNIEXPORT jint JNICALL
  299.50 -Java_sun_awt_DefaultMouseInfoPeer_fillPointWithCoords(JNIEnv *env, jclass cls,
  299.51 -                                                          jobject point)
  299.52 -{
  299.53 -     static jclass pointClass = NULL;
  299.54 -     jclass pointClassLocal;
  299.55 -     static jfieldID xID, yID;
  299.56 -     Window rootWindow, childWindow;
  299.57 -     int i;
  299.58 -     int32_t xr, yr, xw, yw;
  299.59 -     uint32_t keys;
  299.60 -     Bool pointerFound;
  299.61 -
  299.62 -     AWT_LOCK();
  299.63 -     if (pointClass == NULL) {
  299.64 -         pointClassLocal = (*env)->FindClass(env, "java/awt/Point");
  299.65 -         DASSERT(pointClassLocal != NULL);
  299.66 -         if (pointClassLocal == NULL) {
  299.67 -             AWT_UNLOCK();
  299.68 -             return (jint)0;
  299.69 -         }
  299.70 -         pointClass = (jclass)(*env)->NewGlobalRef(env, pointClassLocal);
  299.71 -         (*env)->DeleteLocalRef(env, pointClassLocal);
  299.72 -         xID = (*env)->GetFieldID(env, pointClass, "x", "I");
  299.73 -         yID = (*env)->GetFieldID(env, pointClass, "y", "I");
  299.74 -     }
  299.75 -
  299.76 -     for (i = 0; i < awt_numScreens; i++) {
  299.77 -         pointerFound = XQueryPointer(awt_display, x11Screens[i].root,
  299.78 -                           &rootWindow, &childWindow,
  299.79 -                           &xr, &yr, &xw, &yw, &keys);
  299.80 -         if (pointerFound) {
  299.81 -             (*env)->SetIntField(env, point, xID, xr);
  299.82 -             (*env)->SetIntField(env, point, yID, yr);
  299.83 -             AWT_UNLOCK();
  299.84 -             return (jint)i;
  299.85 -         }
  299.86 -     }
  299.87 -     /* This should never happen */
  299.88 -     DASSERT(FALSE);
  299.89 -     AWT_UNLOCK();
  299.90 -     return (jint)0;
  299.91 -}
  299.92 -
  299.93 -/*
  299.94 - * Class:     sun_awt_DefaultMouseInfoPeer
  299.95 - * Method:    isWindowUnderMouse
  299.96 - * Signature: (Ljava/awt/Window)Z
  299.97 - */
  299.98 -JNIEXPORT jboolean JNICALL Java_sun_awt_DefaultMouseInfoPeer_isWindowUnderMouse
  299.99 -  (JNIEnv * env, jclass cls, jobject window)
 299.100 -{
 299.101 -    Window rootWindow = None, parentWindow = None, siblingWindow = None;
 299.102 -    Window * children = NULL;
 299.103 -    int i = 0;
 299.104 -    int is_the_same_screen = 0;
 299.105 -    int32_t xr = 0, yr = 0, xw = 0, yw = 0;
 299.106 -    uint32_t keys = 0;
 299.107 -    uint32_t nchildren = 0;
 299.108 -    Bool pointerFound = 0;
 299.109 -    struct FrameData *wdata = NULL;
 299.110 -    jobject winPeer = NULL;
 299.111 -
 299.112 -    if ((*env)->EnsureLocalCapacity(env, 1) < 0) {
 299.113 -        return JNI_FALSE;
 299.114 -    }
 299.115 -    winPeer = (*env)->GetObjectField(env, window, componentIDs.peer);
 299.116 -    if (JNU_IsNull(env, winPeer)) {
 299.117 -        return JNI_FALSE;
 299.118 -    }
 299.119 -
 299.120 -    wdata = (struct FrameData *)
 299.121 -        JNU_GetLongFieldAsPtr(env, winPeer, mComponentPeerIDs.pData);
 299.122 -    (*env)->DeleteLocalRef(env, winPeer);
 299.123 -
 299.124 -    if (wdata == NULL) {
 299.125 -        return JNI_FALSE;
 299.126 -    }
 299.127 -
 299.128 -    AWT_LOCK();
 299.129 -
 299.130 -    XQueryTree(awt_display, XtWindow(wdata->winData.comp.widget),
 299.131 -                    &rootWindow, &parentWindow, &children, &nchildren);
 299.132 -
 299.133 -    is_the_same_screen = XQueryPointer(awt_display, parentWindow,
 299.134 -            &rootWindow, &siblingWindow, &xr, &yr, &xw, &yw, &keys);
 299.135 -
 299.136 -    if (siblingWindow == XtWindow(wdata->winData.comp.widget) && is_the_same_screen) {
 299.137 -        AWT_UNLOCK();
 299.138 -        return JNI_TRUE;
 299.139 -    }
 299.140 -
 299.141 -    AWT_UNLOCK();
 299.142 -    return JNI_FALSE ;
 299.143 -
 299.144 -}
   300.1 --- a/src/solaris/native/sun/awt/XDrawingArea.c	Tue Dec 06 16:31:58 2011 -0800
   300.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   300.3 @@ -1,163 +0,0 @@
   300.4 -/*
   300.5 - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
   300.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   300.7 - *
   300.8 - * This code is free software; you can redistribute it and/or modify it
   300.9 - * under the terms of the GNU General Public License version 2 only, as
  300.10 - * published by the Free Software Foundation.  Oracle designates this
  300.11 - * particular file as subject to the "Classpath" exception as provided
  300.12 - * by Oracle in the LICENSE file that accompanied this code.
  300.13 - *
  300.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
  300.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  300.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  300.17 - * version 2 for more details (a copy is included in the LICENSE file that
  300.18 - * accompanied this code).
  300.19 - *
  300.20 - * You should have received a copy of the GNU General Public License version
  300.21 - * 2 along with this work; if not, write to the Free Software Foundation,
  300.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  300.23 - *
  300.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  300.25 - * or visit www.oracle.com if you need additional information or have any
  300.26 - * questions.
  300.27 - */
  300.28 -
  300.29 -/*
  300.30 - */
  300.31 -
  300.32 -#include <X11/IntrinsicP.h>
  300.33 -#include "XDrawingAreaP.h"
  300.34 -#include <Xm/XmP.h>
  300.35 -
  300.36 -#include <stdio.h>
  300.37 -#include <malloc.h>
  300.38 -
  300.39 -#ifdef DEBUG
  300.40 -#include <jvm.h>  /* To get jio_fprintf() */
  300.41 -#endif
  300.42 -
  300.43 -/******************************************************************
  300.44 - *
  300.45 - * Provides Canvas widget which allows the X11 visual to be
  300.46 - * changed (the Motif DrawingArea restricts the visual to that
  300.47 - * of the parent widget).
  300.48 - *
  300.49 - ******************************************************************/
  300.50 -
  300.51 -
  300.52 -static XmNavigability WidgetNavigable();
  300.53 -static void ClassInitialize();
  300.54 -
  300.55 -static XmBaseClassExtRec baseClassExtRec = {
  300.56 -    NULL,
  300.57 -    NULLQUARK,
  300.58 -    XmBaseClassExtVersion,
  300.59 -    sizeof(XmBaseClassExtRec),
  300.60 -    NULL,                               /* InitializePrehook    */
  300.61 -    NULL,                               /* SetValuesPrehook     */
  300.62 -    NULL,                               /* InitializePosthook   */
  300.63 -    NULL,                               /* SetValuesPosthook    */
  300.64 -    NULL,                               /* secondaryObjectClass */
  300.65 -    NULL,                               /* secondaryCreate      */
  300.66 -    NULL,                               /* getSecRes data       */
  300.67 -    { 0 },                              /* fastSubclass flags   */
  300.68 -    NULL,                               /* getValuesPrehook     */
  300.69 -    NULL,                               /* getValuesPosthook    */
  300.70 -    NULL,                               /* classPartInitPrehook */
  300.71 -    NULL,                               /* classPartInitPosthook*/
  300.72 -    NULL,                               /* ext_resources        */
  300.73 -    NULL,                               /* compiled_ext_resources*/
  300.74 -    0,                                  /* num_ext_resources    */
  300.75 -    FALSE,                              /* use_sub_resources    */
  300.76 -    WidgetNavigable,                    /* widgetNavigable      */
  300.77 -    NULL                                /* focusChange          */
  300.78 -};
  300.79 -
  300.80 -XDrawingAreaClassRec xDrawingAreaClassRec = {
  300.81 -{
  300.82 -    /* Core class part */
  300.83 -
  300.84 -    /* superclass         */    (WidgetClass)&xmDrawingAreaClassRec,
  300.85 -    /* class_name         */    "XDrawingArea",
  300.86 -    /* widget_size        */    sizeof(XDrawingAreaRec),
  300.87 -    /* class_initialize   */    ClassInitialize,
  300.88 -    /* class_part_initialize*/  NULL,
  300.89 -    /* class_inited       */    FALSE,
  300.90 -    /* initialize         */    NULL,
  300.91 -    /* initialize_hook    */    NULL,
  300.92 -    /* realize            */    XtInheritRealize,
  300.93 -    /* actions            */    NULL,
  300.94 -    /* num_actions        */    0,
  300.95 -    /* resources          */    NULL,
  300.96 -    /* num_resources      */    0,
  300.97 -    /* xrm_class          */    NULLQUARK,
  300.98 -    /* compress_motion    */    FALSE,
  300.99 -    /* compress_exposure  */    FALSE,
 300.100 -    /* compress_enterleave*/    FALSE,
 300.101 -    /* visible_interest   */    FALSE,
 300.102 -    /* destroy            */    NULL,
 300.103 -    /* resize             */    XtInheritResize,
 300.104 -    /* expose             */    XtInheritExpose,
 300.105 -    /* set_values         */    NULL,
 300.106 -    /* set_values_hook    */    NULL,
 300.107 -    /* set_values_almost  */    XtInheritSetValuesAlmost,
 300.108 -    /* get_values_hook    */    NULL,
 300.109 -    /* accept_focus       */    NULL,
 300.110 -    /* version            */    XtVersion,
 300.111 -    /* callback_offsets   */    NULL,
 300.112 -    /* tm_table           */    NULL,
 300.113 -    /* query_geometry       */  NULL,
 300.114 -    /* display_accelerator  */  NULL,
 300.115 -    /* extension            */  (XtPointer)&baseClassExtRec
 300.116 -  },
 300.117 -
 300.118 -   {            /* composite_class fields */
 300.119 -      XtInheritGeometryManager,                 /* geometry_manager   */
 300.120 -      XtInheritChangeManaged,                   /* change_managed     */
 300.121 -      XtInheritInsertChild,                     /* insert_child       */
 300.122 -      XtInheritDeleteChild,                     /* delete_child       */
 300.123 -      NULL,                                     /* extension          */
 300.124 -   },
 300.125 -
 300.126 -   {            /* constraint_class fields */
 300.127 -      NULL,                                     /* resource list        */
 300.128 -      0,                                        /* num resources        */
 300.129 -      0,                                        /* constraint size      */
 300.130 -      NULL,                                     /* init proc            */
 300.131 -      NULL,                                     /* destroy proc         */
 300.132 -      NULL,                                     /* set values proc      */
 300.133 -      NULL,                                     /* extension            */
 300.134 -   },
 300.135 -
 300.136 -   {            /* manager_class fields */
 300.137 -      XtInheritTranslations,                    /* translations           */
 300.138 -      NULL,                                     /* syn_resources          */
 300.139 -      0,                                        /* num_get_resources      */
 300.140 -      NULL,                                     /* syn_cont_resources     */
 300.141 -      0,                                        /* num_get_cont_resources */
 300.142 -      XmInheritParentProcess,                   /* parent_process         */
 300.143 -      NULL,                                     /* extension           */
 300.144 -   },
 300.145 -
 300.146 -   {            /* drawingArea class */
 300.147 -           /* extension */      NULL
 300.148 -   },
 300.149 -
 300.150 -   /* XDrawingArea class part */
 300.151 -   {
 300.152 -        /* extension    */      NULL
 300.153 -   }
 300.154 -};
 300.155 -
 300.156 -WidgetClass xDrawingAreaClass = (WidgetClass)&xDrawingAreaClassRec;
 300.157 -
 300.158 -static void ClassInitialize( void )
 300.159 -{
 300.160 -    baseClassExtRec.record_type = XmQmotif ;
 300.161 -}
 300.162 -
 300.163 -static XmNavigability WidgetNavigable(Widget wid)
 300.164 -{
 300.165 -    return XmCONTROL_NAVIGABLE;
 300.166 -}
   301.1 --- a/src/solaris/native/sun/awt/XDrawingArea.h	Tue Dec 06 16:31:58 2011 -0800
   301.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   301.3 @@ -1,37 +0,0 @@
   301.4 -/*
   301.5 - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
   301.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   301.7 - *
   301.8 - * This code is free software; you can redistribute it and/or modify it
   301.9 - * under the terms of the GNU General Public License version 2 only, as
  301.10 - * published by the Free Software Foundation.  Oracle designates this
  301.11 - * particular file as subject to the "Classpath" exception as provided
  301.12 - * by Oracle in the LICENSE file that accompanied this code.
  301.13 - *
  301.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
  301.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  301.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  301.17 - * version 2 for more details (a copy is included in the LICENSE file that
  301.18 - * accompanied this code).
  301.19 - *
  301.20 - * You should have received a copy of the GNU General Public License version
  301.21 - * 2 along with this work; if not, write to the Free Software Foundation,
  301.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  301.23 - *
  301.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  301.25 - * or visit www.oracle.com if you need additional information or have any
  301.26 - * questions.
  301.27 - */
  301.28 -
  301.29 -/*
  301.30 - */
  301.31 -
  301.32 -#ifndef _XDrawingArea_h_
  301.33 -#define _XDrawingArea_h_
  301.34 -
  301.35 -extern WidgetClass xDrawingAreaClass;
  301.36 -
  301.37 -typedef struct _XDrawingAreaClassRec    *XDrawingAreaWidgetClass;
  301.38 -typedef struct _XDrawingAreaRec         *XDrawingAreaWidget;
  301.39 -
  301.40 -#endif /* !_VDrawingArea_h_ */
   302.1 --- a/src/solaris/native/sun/awt/XDrawingAreaP.h	Tue Dec 06 16:31:58 2011 -0800
   302.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   302.3 @@ -1,77 +0,0 @@
   302.4 -/*
   302.5 - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
   302.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   302.7 - *
   302.8 - * This code is free software; you can redistribute it and/or modify it
   302.9 - * under the terms of the GNU General Public License version 2 only, as
  302.10 - * published by the Free Software Foundation.  Oracle designates this
  302.11 - * particular file as subject to the "Classpath" exception as provided
  302.12 - * by Oracle in the LICENSE file that accompanied this code.
  302.13 - *
  302.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
  302.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  302.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  302.17 - * version 2 for more details (a copy is included in the LICENSE file that
  302.18 - * accompanied this code).
  302.19 - *
  302.20 - * You should have received a copy of the GNU General Public License version
  302.21 - * 2 along with this work; if not, write to the Free Software Foundation,
  302.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  302.23 - *
  302.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  302.25 - * or visit www.oracle.com if you need additional information or have any
  302.26 - * questions.
  302.27 - */
  302.28 -
  302.29 -/*
  302.30 - */
  302.31 -
  302.32 -#ifndef _XDrawingAreaP_h_
  302.33 -#define _XDrawingAreaP_h_
  302.34 -
  302.35 -#include <Xm/DrawingAP.h>
  302.36 -#include "XDrawingArea.h"
  302.37 -
  302.38 -
  302.39 -/***************************************************************
  302.40 - * VDrawingArea Widget Data Structures
  302.41 - *
  302.42 - *
  302.43 - **************************************************************/
  302.44 -
  302.45 -/* Define part class structure */
  302.46 -typedef struct _XDrawingAreaClass {
  302.47 -        XtPointer                       extension;
  302.48 -} XDrawingAreaClassPart;
  302.49 -
  302.50 -/* Define the full class record */
  302.51 -typedef struct _XDrawingAreaClassRec {
  302.52 -        CoreClassPart           core_class;
  302.53 -        CompositeClassPart      composite_class;
  302.54 -        ConstraintClassPart     constraint_class;
  302.55 -        XmManagerClassPart      manager_class;
  302.56 -        XmDrawingAreaClassPart  drawing_area_class;
  302.57 -        XDrawingAreaClassPart   xdrawingarea_class;
  302.58 -} XDrawingAreaClassRec;
  302.59 -
  302.60 -/* External definition for class record */
  302.61 -extern XDrawingAreaClassRec xDrawingAreaClassRec;
  302.62 -
  302.63 -/****************************************************************
  302.64 - *
  302.65 -* Full instance record declaration
  302.66 - *
  302.67 - ****************************************************************/
  302.68 -
  302.69 -typedef struct _XDrawingAreaRec
  302.70 -{
  302.71 -        CorePart                core;
  302.72 -        CompositePart           composite;
  302.73 -        ConstraintPart          constraint;
  302.74 -        XmManagerPart           manager;
  302.75 -        XmDrawingAreaPart       drawing_area;
  302.76 -} XDrawingAreaRec;
  302.77 -
  302.78 -
  302.79 -
  302.80 -#endif /* !_VDrawingAreaP_h_ */
   303.1 --- a/src/solaris/native/sun/awt/awt.h	Tue Dec 06 16:31:58 2011 -0800
   303.2 +++ b/src/solaris/native/sun/awt/awt.h	Mon Dec 19 10:06:23 2011 -0800
   303.3 @@ -90,74 +90,12 @@
   303.4   * Unfortunately AWT_LOCK debugging does not work with XAWT due to mixed
   303.5   * Java/C use of AWT lock.
   303.6   */
   303.7 -#if defined(DEBUG_AWT_LOCK) && !defined(XAWT)
   303.8 -extern int awt_locked;
   303.9 -extern char *lastF;
  303.10 -extern int lastL;
  303.11 -
  303.12 -#define AWT_LOCK() do {                                                 \
  303.13 -    if (!awtLockInited) {                                               \
  303.14 -        jio_fprintf(stderr, "AWT lock error, awt_lock is null\n");      \
  303.15 -    }                                                                   \
  303.16 -    if (awt_locked < 0) {                                               \
  303.17 -        jio_fprintf(stderr,                                             \
  303.18 -                    "AWT lock error (%s,%d) (last held by %s,%d) %d\n", \
  303.19 -                    __FILE__, __LINE__, lastF, lastL, awt_locked);      \
  303.20 -    }                                                                   \
  303.21 -    lastF = __FILE__;                                                   \
  303.22 -    lastL = __LINE__;                                                   \
  303.23 -    AWT_LOCK_IMPL();                                                    \
  303.24 -    ++awt_locked;                                                       \
  303.25 -} while (0)
  303.26 -
  303.27 -#define AWT_NOFLUSH_UNLOCK() do {                               \
  303.28 -    lastF = "";                                                 \
  303.29 -    lastL = -1;                                                 \
  303.30 -    if (awt_locked < 1) {                                       \
  303.31 -        jio_fprintf(stderr, "AWT unlock error (%s,%d,%d)\n",    \
  303.32 -                    __FILE__, __LINE__, awt_locked);            \
  303.33 -    }                                                           \
  303.34 -    --awt_locked;                                               \
  303.35 -    AWT_NOFLUSH_UNLOCK_IMPL();                                  \
  303.36 -} while (0)
  303.37 -
  303.38 -#define AWT_WAIT(tm) do {                                       \
  303.39 -    int old_lockcount = awt_locked;                             \
  303.40 -    if (awt_locked < 1) {                                       \
  303.41 -        jio_fprintf(stderr, "AWT wait error (%s,%d,%d)\n",      \
  303.42 -                    __FILE__, __LINE__, awt_locked);            \
  303.43 -    }                                                           \
  303.44 -    awt_locked = 0;                                             \
  303.45 -    AWT_WAIT_IMPL(tm);                                          \
  303.46 -    awt_locked = old_lockcount;                                 \
  303.47 -} while (0)
  303.48 -
  303.49 -#define AWT_NOTIFY() do {                                       \
  303.50 -    if (awt_locked < 1) {                                       \
  303.51 -        jio_fprintf(stderr, "AWT notify error (%s,%d,%d)\n",    \
  303.52 -                    __FILE__, __LINE__, awt_locked);            \
  303.53 -    }                                                           \
  303.54 -    AWT_NOTIFY_IMPL();                                          \
  303.55 -} while(0)
  303.56 -
  303.57 -#define AWT_NOTIFY_ALL() do {                                           \
  303.58 -    if (awt_locked < 1) {                                               \
  303.59 -        jio_fprintf(stderr, "AWT notify all error (%s,%d,%d)\n",        \
  303.60 -                    __FILE__, __LINE__, awt_locked);                    \
  303.61 -    }                                                                   \
  303.62 -    AWT_NOTIFY_ALL_IMPL();                                              \
  303.63 -} while (0)
  303.64 -
  303.65 -#else
  303.66 -
  303.67  #define AWT_LOCK()           AWT_LOCK_IMPL()
  303.68  #define AWT_NOFLUSH_UNLOCK() AWT_NOFLUSH_UNLOCK_IMPL()
  303.69  #define AWT_WAIT(tm)         AWT_WAIT_IMPL(tm)
  303.70  #define AWT_NOTIFY()         AWT_NOTIFY_IMPL()
  303.71  #define AWT_NOTIFY_ALL()     AWT_NOTIFY_ALL_IMPL()
  303.72  
  303.73 -#endif /* DEBUG_AWT_LOCK && !XAWT */
  303.74 -
  303.75  #ifndef HEADLESS
  303.76  extern Display         *awt_display; /* awt_GraphicsEnv.c */
  303.77  extern Boolean          awt_ModLockIsShiftLock; /* XToolkit.c */
   304.1 --- a/src/solaris/native/sun/awt/awt_AWTEvent.c	Tue Dec 06 16:31:58 2011 -0800
   304.2 +++ b/src/solaris/native/sun/awt/awt_AWTEvent.c	Mon Dec 19 10:06:23 2011 -0800
   304.3 @@ -40,14 +40,11 @@
   304.4  #include "java_awt_event_KeyEvent.h"
   304.5  #include "jni_util.h"
   304.6  
   304.7 -#include "canvas.h"
   304.8  #include "awt_AWTEvent.h"
   304.9 -#include "awt_Component.h"
  304.10  
  304.11  struct AWTEventIDs awtEventIDs;
  304.12  struct InputEventIDs inputEventIDs;
  304.13  struct KeyEventIDs keyEventIDs;
  304.14 -struct MComponentPeerIDs mComponentPeerIDs;
  304.15  
  304.16  JNIEXPORT void JNICALL
  304.17  Java_java_awt_AWTEvent_initIDs(JNIEnv *env, jclass cls)
  304.18 @@ -69,61 +66,10 @@
  304.19      keyEventIDs.keyCode = (*env)->GetFieldID(env, cls, "keyCode", "I");
  304.20      keyEventIDs.keyChar = (*env)->GetFieldID(env, cls, "keyChar", "C");
  304.21  }
  304.22 -#ifndef XAWT
  304.23 -JNIEXPORT void JNICALL
  304.24 -Java_java_awt_AWTEvent_nativeSetSource(JNIEnv *env, jobject self,
  304.25 -                                       jobject newSource)
  304.26 -{
  304.27 -    jbyteArray bdata;
  304.28  
  304.29 -    AWT_LOCK();
  304.30 -
  304.31 -    bdata = (jbyteArray)(*env)->GetObjectField(env, self, awtEventIDs.bdata);
  304.32 -
  304.33 -    if (bdata != NULL) {
  304.34 -        XEvent *xev;
  304.35 -        Window w;
  304.36 -        jboolean dummy;
  304.37 -
  304.38 -        /* get the widget out of the peer newSource */
  304.39 -        struct ComponentData *cdata = (struct ComponentData *)
  304.40 -            JNU_GetLongFieldAsPtr(env, newSource, mComponentPeerIDs.pData);
  304.41 -        if (JNU_IsNull(env, cdata) || (cdata == NULL) ||
  304.42 -            ((cdata->widget != NULL) && (XtIsObject(cdata->widget)) &&
  304.43 -             (cdata->widget->core.being_destroyed))) {
  304.44 -            JNU_ThrowNullPointerException(env, "null widget");
  304.45 -            AWT_UNLOCK();
  304.46 -            return;
  304.47 -        }
  304.48 -
  304.49 -        /* get the Window out of the widget */
  304.50 -        w = XtWindow(cdata->widget);
  304.51 -
  304.52 -        if (w == None) {
  304.53 -            JNU_ThrowNullPointerException(env, "null window");
  304.54 -            AWT_UNLOCK();
  304.55 -            return;
  304.56 -        }
  304.57 -
  304.58 -        /* reset the filed in the event */
  304.59 -        xev = (XEvent *)(*env)->GetPrimitiveArrayCritical(env, bdata, &dummy);
  304.60 -        if (xev == NULL) {
  304.61 -            JNU_ThrowNullPointerException(env, "null data");
  304.62 -            AWT_UNLOCK();
  304.63 -            return;
  304.64 -        }
  304.65 -        xev->xany.window = w;
  304.66 -        (*env)->ReleasePrimitiveArrayCritical(env, bdata, (void *)xev, 0);
  304.67 -    }
  304.68 -
  304.69 -    AWT_UNLOCK();
  304.70 -}
  304.71 -#else
  304.72  JNIEXPORT void JNICALL
  304.73  Java_java_awt_AWTEvent_nativeSetSource(JNIEnv *env, jobject self,
  304.74                                         jobject newSource)
  304.75  {
  304.76  
  304.77  }
  304.78 -
  304.79 -#endif
   305.1 --- a/src/solaris/native/sun/awt/awt_Component.h	Tue Dec 06 16:31:58 2011 -0800
   305.2 +++ b/src/solaris/native/sun/awt/awt_Component.h	Mon Dec 19 10:06:23 2011 -0800
   305.3 @@ -42,25 +42,3 @@
   305.4      jmethodID getParent;
   305.5      jmethodID getLocationOnScreen;
   305.6  };
   305.7 -
   305.8 -/* field and method IDs for Container */
   305.9 -struct ContainerIDs {
  305.10 -    jfieldID layoutMgr;
  305.11 -    jmethodID getComponents;
  305.12 -    jmethodID findComponentAt;
  305.13 -};
  305.14 -
  305.15 -/* fieldIDs for MComponentPeer fields that may be accessed from C */
  305.16 -struct MComponentPeerIDs {
  305.17 -    jfieldID pData;
  305.18 -    jfieldID target;
  305.19 -    jfieldID jniGlobalRef;
  305.20 -    jfieldID graphicsConfig;
  305.21 -    jfieldID drawState;
  305.22 -    jmethodID isFocusableMID;
  305.23 -};
  305.24 -
  305.25 -#ifndef HEADLESS
  305.26 -extern void processTree(Widget from, Widget to, Boolean action);
  305.27 -#endif // HEADLESS
  305.28 -
   306.1 --- a/src/solaris/native/sun/awt/awt_Cursor.h	Tue Dec 06 16:31:58 2011 -0800
   306.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   306.3 @@ -1,43 +0,0 @@
   306.4 -/*
   306.5 - * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
   306.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   306.7 - *
   306.8 - * This code is free software; you can redistribute it and/or modify it
   306.9 - * under the terms of the GNU General Public License version 2 only, as
  306.10 - * published by the Free Software Foundation.  Oracle designates this
  306.11 - * particular file as subject to the "Classpath" exception as provided
  306.12 - * by Oracle in the LICENSE file that accompanied this code.
  306.13 - *
  306.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
  306.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  306.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  306.17 - * version 2 for more details (a copy is included in the LICENSE file that
  306.18 - * accompanied this code).
  306.19 - *
  306.20 - * You should have received a copy of the GNU General Public License version
  306.21 - * 2 along with this work; if not, write to the Free Software Foundation,
  306.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  306.23 - *
  306.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  306.25 - * or visit www.oracle.com if you need additional information or have any
  306.26 - * questions.
  306.27 - */
  306.28 -
  306.29 -#include "jni_util.h"
  306.30 -#include "awt_p.h"
  306.31 -
  306.32 -#define CACHE_UPDATE 0          /* cache the component and update cursor */
  306.33 -#define UPDATE_ONLY  1          /* update cursor, but not cache component */
  306.34 -#define CACHE_ONLY   2          /* cache the component, no cursor update */
  306.35 -
  306.36 -/* fieldIDs for Cursor fields that may be accessed from C */
  306.37 -struct CursorIDs {
  306.38 -  jfieldID type;
  306.39 -  jmethodID mSetPData;
  306.40 -  jfieldID pData;
  306.41 -};
  306.42 -
  306.43 -#ifndef HEADLESS
  306.44 -Cursor getCursor(JNIEnv *env, jobject jCur);
  306.45 -void updateCursor(XPointer client_data, int32_t replace);
  306.46 -#endif /* !HEADLESS */
   307.1 --- a/src/solaris/native/sun/awt/awt_DrawingSurface.c	Tue Dec 06 16:31:58 2011 -0800
   307.2 +++ b/src/solaris/native/sun/awt/awt_DrawingSurface.c	Mon Dec 19 10:06:23 2011 -0800
   307.3 @@ -29,30 +29,21 @@
   307.4  
   307.5  #include "awt_p.h"
   307.6  #include "java_awt_Component.h"
   307.7 -//#include "sun_awt_motif_MComponentPeer.h"
   307.8  
   307.9  #include "awt_Component.h"
  307.10  
  307.11 -
  307.12  #include <jni.h>
  307.13  #include <jni_util.h>
  307.14  #include <jawt_md.h>
  307.15  
  307.16 -extern struct MComponentPeerIDs mComponentPeerIDs;
  307.17  extern struct ComponentIDs componentIDs;
  307.18 -#ifndef XAWT
  307.19 -extern AwtGraphicsConfigDataPtr
  307.20 -getGraphicsConfigFromComponentPeer(JNIEnv *env, jobject this);
  307.21 -#endif
  307.22  
  307.23 -#ifdef XAWT
  307.24  #include "awt_GraphicsEnv.h"
  307.25  extern jfieldID windowID;
  307.26  extern jfieldID targetID;
  307.27  extern jfieldID graphicsConfigID;
  307.28  extern jfieldID drawStateID;
  307.29  extern struct X11GraphicsConfigIDs x11GraphicsConfigIDs;
  307.30 -#endif
  307.31  
  307.32  /*
  307.33   * Lock the surface of the target component for native rendering.
  307.34 @@ -109,13 +100,8 @@
  307.35          return (jint)JAWT_LOCK_ERROR;
  307.36      }
  307.37  
  307.38 -#ifndef XAWT
  307.39 -    drawState = (*env)->GetIntField(env, peer, mComponentPeerIDs.drawState);
  307.40 -    (*env)->SetIntField(env, peer, mComponentPeerIDs.drawState, 0);
  307.41 -#else
  307.42     drawState = (*env)->GetIntField(env, peer, drawStateID);
  307.43      (*env)->SetIntField(env, peer, drawStateID, 0);
  307.44 -#endif
  307.45      return drawState;
  307.46  }
  307.47  
  307.48 @@ -127,9 +113,7 @@
  307.49      jclass componentClass;
  307.50      AwtGraphicsConfigDataPtr adata;
  307.51      int32_t result;
  307.52 -#ifdef XAWT
  307.53       jobject gc_object;
  307.54 -#endif
  307.55      if (ds == NULL) {
  307.56  #ifdef DEBUG
  307.57          fprintf(stderr, "Drawing Surface is NULL\n");
  307.58 @@ -164,9 +148,6 @@
  307.59          AWT_UNLOCK();
  307.60          return (int32_t) 0;
  307.61      }
  307.62 -#ifndef XAWT
  307.63 -    adata = getGraphicsConfigFromComponentPeer(env, peer);
  307.64 -#else
  307.65       /* GraphicsConfiguration object of MComponentPeer */
  307.66      gc_object = (*env)->GetObjectField(env, peer, graphicsConfigID);
  307.67  
  307.68 @@ -177,7 +158,6 @@
  307.69      } else {
  307.70          adata = getDefaultConfig(DefaultScreen(awt_display));
  307.71      }
  307.72 -#endif
  307.73  
  307.74      result = adata->AwtColorMatch(r, g, b, adata);
  307.75          AWT_UNLOCK();
  307.76 @@ -201,9 +181,6 @@
  307.77      jclass componentClass;
  307.78      JAWT_X11DrawingSurfaceInfo* px;
  307.79      JAWT_DrawingSurfaceInfo* p;
  307.80 -#ifndef XAWT
  307.81 -    struct ComponentData *cdata;
  307.82 -#endif
  307.83      XWindowAttributes attrs;
  307.84  
  307.85      if (ds == NULL) {
  307.86 @@ -241,31 +218,14 @@
  307.87          return NULL;
  307.88      }
  307.89  
  307.90 -#ifndef XAWT
  307.91 -    /* Get the component data from the peer */
  307.92 -    cdata = (struct ComponentData *)
  307.93 -        JNU_GetLongFieldAsPtr(env, peer, mComponentPeerIDs.pData);
  307.94 -    if (cdata == NULL) {
  307.95 -#ifdef DEBUG
  307.96 -        fprintf(stderr, "Component data is NULL\n");
  307.97 -#endif
  307.98 -                AWT_UNLOCK();
  307.99 -        return NULL;
 307.100 -    }
 307.101 -#endif
 307.102 -
 307.103 -        AWT_UNLOCK();
 307.104 +    AWT_UNLOCK();
 307.105  
 307.106      /* Allocate platform-specific data */
 307.107      px = (JAWT_X11DrawingSurfaceInfo*)
 307.108          malloc(sizeof(JAWT_X11DrawingSurfaceInfo));
 307.109  
 307.110      /* Set drawable and display */
 307.111 -#ifndef XAWT
 307.112 -    px->drawable = XtWindow(cdata->widget);
 307.113 -#else
 307.114      px->drawable = (*env)->GetLongField(env, peer, windowID);
 307.115 -#endif
 307.116      px->display = awt_display;
 307.117  
 307.118      /* Get window attributes to set other values */
 307.119 @@ -392,21 +352,7 @@
 307.120  
 307.121      AWT_LOCK();
 307.122  
 307.123 -#ifndef XAWT
 307.124 -    if (window != None) {
 307.125 -        widget = XtWindowToWidget(awt_display, window);
 307.126 -    }
 307.127 -
 307.128 -    if (widget != NULL) {
 307.129 -        XtVaGetValues (widget, XmNuserData, &peer, NULL);
 307.130 -    }
 307.131 -
 307.132 -    if (peer != NULL) {
 307.133 -        target = (*env)->GetObjectField(env, peer, mComponentPeerIDs.target);
 307.134 -    }
 307.135 -#else
 307.136      target =  (*env)->GetObjectField(env, peer, targetID);
 307.137 -#endif
 307.138  
 307.139      if (target == NULL) {
 307.140          JNU_ThrowNullPointerException(env, "NullPointerException");
   308.1 --- a/src/solaris/native/sun/awt/awt_Font.c	Tue Dec 06 16:31:58 2011 -0800
   308.2 +++ b/src/solaris/native/sun/awt/awt_Font.c	Mon Dec 19 10:06:23 2011 -0800
   308.3 @@ -30,8 +30,6 @@
   308.4  #include "java_awt_Component.h"
   308.5  #include "java_awt_Font.h"
   308.6  #include "java_awt_FontMetrics.h"
   308.7 -#include "sun_awt_motif_MToolkit.h"
   308.8 -#include "sun_awt_motif_X11FontMetrics.h"
   308.9  #include "sun_awt_X11GraphicsEnvironment.h"
  308.10  
  308.11  #include "awt_Font.h"
  308.12 @@ -100,57 +98,6 @@
  308.13  }
  308.14  
  308.15  #ifndef HEADLESS
  308.16 -
  308.17 -/* fieldIDs for X11FontMetrics fields that may be accessed from C */
  308.18 -static struct X11FontMetricsIDs {
  308.19 -    jfieldID widths;
  308.20 -    jfieldID font;
  308.21 -    jfieldID ascent;
  308.22 -    jfieldID descent;
  308.23 -    jfieldID leading;
  308.24 -    jfieldID height;
  308.25 -    jfieldID maxAscent;
  308.26 -    jfieldID maxDescent;
  308.27 -    jfieldID maxHeight;
  308.28 -    jfieldID maxAdvance;
  308.29 -} x11FontMetricsIDs;
  308.30 -
  308.31 -/*
  308.32 - * Class:     sun_awt_motif_X11FontMetrics
  308.33 - * Method:    initIDs
  308.34 - * Signature: ()V
  308.35 - */
  308.36 -
  308.37 -/* This function gets called from the static initializer for
  308.38 -   X11FontMetrics.java to initialize the fieldIDs for fields
  308.39 -   that may be accessed from C */
  308.40 -
  308.41 -JNIEXPORT void JNICALL
  308.42 -Java_sun_awt_motif_X11FontMetrics_initIDs
  308.43 -  (JNIEnv *env, jclass cls)
  308.44 -{
  308.45 -    x11FontMetricsIDs.widths = (*env)->GetFieldID(env, cls, "widths", "[I");
  308.46 -    x11FontMetricsIDs.font =
  308.47 -      (*env)->GetFieldID(env, cls, "font", "Ljava/awt/Font;");
  308.48 -    x11FontMetricsIDs.ascent =
  308.49 -      (*env)->GetFieldID(env, cls, "ascent", "I");
  308.50 -    x11FontMetricsIDs.descent =
  308.51 -      (*env)->GetFieldID(env, cls, "descent", "I");
  308.52 -    x11FontMetricsIDs.leading =
  308.53 -      (*env)->GetFieldID(env, cls, "leading", "I");
  308.54 -    x11FontMetricsIDs.height =
  308.55 -      (*env)->GetFieldID(env, cls, "height", "I");
  308.56 -    x11FontMetricsIDs.maxAscent =
  308.57 -      (*env)->GetFieldID(env, cls, "maxAscent", "I");
  308.58 -    x11FontMetricsIDs.maxDescent =
  308.59 -      (*env)->GetFieldID(env, cls, "maxDescent", "I");
  308.60 -    x11FontMetricsIDs.maxHeight =
  308.61 -      (*env)->GetFieldID(env, cls, "maxHeight", "I");
  308.62 -    x11FontMetricsIDs.maxAdvance =
  308.63 -      (*env)->GetFieldID(env, cls, "maxAdvance", "I");
  308.64 -}
  308.65 -
  308.66 -
  308.67  /* fieldIDs for FontDescriptor fields that may be accessed from C */
  308.68  static struct FontDescriptorIDs {
  308.69      jfieldID nativeName;
  308.70 @@ -182,27 +129,6 @@
  308.71  #endif /* !HEADLESS */
  308.72  }
  308.73  
  308.74 -#ifndef HEADLESS
  308.75 -struct MFontPeerIDs mFontPeerIDs;
  308.76 -/*
  308.77 - * Class:     sun_awt_motif_MFontPeer
  308.78 - * Method:    initIDs
  308.79 - * Signature: ()V
  308.80 - */
  308.81 -
  308.82 -/* This function gets called from the static initializer for
  308.83 -   MFontPeer.java to initialize the fieldIDs for fields
  308.84 -   that may be accessed from C */
  308.85 -
  308.86 -JNIEXPORT void JNICALL
  308.87 -Java_sun_awt_motif_MFontPeer_initIDs
  308.88 -  (JNIEnv *env, jclass cls)
  308.89 -{
  308.90 -    mFontPeerIDs.xfsname =
  308.91 -      (*env)->GetFieldID(env, cls, "xfsname", "Ljava/lang/String;");
  308.92 -}
  308.93 -#endif /* !HEADLESS */
  308.94 -
  308.95  /*
  308.96   * Class:     sun_awt_PlatformFont
  308.97   * Method:    initIDs
  308.98 @@ -747,193 +673,6 @@
  308.99  }
 308.100  
 308.101  /*
 308.102 - * Class:     sun_awt_motif_X11FontMetrics
 308.103 - * Method:    getMFCharsWidth
 308.104 - * Signature: ([CIILjava/awt/Font;)I
 308.105 - */
 308.106 -JNIEXPORT jint JNICALL Java_sun_awt_motif_X11FontMetrics_getMFCharsWidth
 308.107 -  (JNIEnv *env, jobject this, jcharArray data, jint offset, jint length, jobject font)
 308.108 -{
 308.109 -    jint retVal = 0;
 308.110 -
 308.111 -    AWT_LOCK();
 308.112 -
 308.113 -    retVal = awtJNI_GetMFStringWidth(env, data, offset, length, font);
 308.114 -
 308.115 -    AWT_UNLOCK();
 308.116 -    return retVal;
 308.117 -}
 308.118 -
 308.119 -/*
 308.120 - * Class:     sun_awt_motif_X11FontMetrics
 308.121 - * Method:    bytesWidth
 308.122 - * Signature: ([BII)I
 308.123 - */
 308.124 -JNIEXPORT jint JNICALL Java_sun_awt_motif_X11FontMetrics_bytesWidth
 308.125 -  (JNIEnv *env, jobject this, jbyteArray str, jint off, jint len)
 308.126 -{
 308.127 -    jint w = 0;
 308.128 -    unsigned char *s = NULL, *tmpPointer = NULL;
 308.129 -    int32_t ch = 0;
 308.130 -    int32_t cnt = 0;
 308.131 -    jobject widths = NULL;
 308.132 -    jint tempWidths[256];
 308.133 -    jint maxAdvance = 0;
 308.134 -    int32_t widlen = 0;
 308.135 -
 308.136 -    if (JNU_IsNull(env, str)) {
 308.137 -        JNU_ThrowNullPointerException(env, "NullPointerException");
 308.138 -        return 0;
 308.139 -    }
 308.140 -
 308.141 -    cnt = (*env)->GetArrayLength(env, str);
 308.142 -    if (cnt == 0) {
 308.143 -        return 0;
 308.144 -    }
 308.145 -
 308.146 -    widths = (*env)->GetObjectField(env, this, x11FontMetricsIDs.widths);
 308.147 -    maxAdvance = (*env)->GetIntField(env, this, x11FontMetricsIDs.maxAdvance);
 308.148 -    if (!JNU_IsNull(env, widths)) {
 308.149 -        w = 0;
 308.150 -        widlen = (*env)->GetArrayLength(env, widths);
 308.151 -        (*env)->GetIntArrayRegion(env, widths, 0, widlen, (jint *) tempWidths);
 308.152 -
 308.153 -        s = tmpPointer = (unsigned char *) (*env)->GetPrimitiveArrayCritical(env, str, NULL);
 308.154 -        if (s == NULL) {
 308.155 -            return 0;
 308.156 -        }
 308.157 -
 308.158 -        while (--cnt >= 0) {
 308.159 -            ch = *tmpPointer++;
 308.160 -            if (ch < widlen) {
 308.161 -                w += tempWidths[ch];
 308.162 -            } else {
 308.163 -                w += maxAdvance;
 308.164 -            }
 308.165 -        }
 308.166 -
 308.167 -        (*env)->ReleasePrimitiveArrayCritical(env, str, (jchar *) s, JNI_ABORT);
 308.168 -    } else {
 308.169 -        w = maxAdvance * cnt;
 308.170 -    }
 308.171 -    return w;
 308.172 -}
 308.173 -
 308.174 -/*
 308.175 - * Class:     sun_awt_motif_X11FontMetrics
 308.176 - * Method:    init
 308.177 - * Signature: ()V
 308.178 - */
 308.179 -JNIEXPORT void JNICALL Java_sun_awt_motif_X11FontMetrics_init
 308.180 -  (JNIEnv *env, jobject this)
 308.181 -{
 308.182 -    jobject font = NULL;
 308.183 -    struct FontData *fdata = NULL;
 308.184 -    jint tempWidths[256];
 308.185 -    jintArray widths = NULL;
 308.186 -    int32_t ccount = 0;
 308.187 -    int32_t i = 0;
 308.188 -    int32_t tempWidthsIndex = 0;
 308.189 -    char *err = NULL;
 308.190 -
 308.191 -    if (JNU_IsNull(env, this)) {
 308.192 -        JNU_ThrowNullPointerException(env, "NullPointerException");
 308.193 -        return;
 308.194 -    }
 308.195 -    AWT_LOCK();
 308.196 -
 308.197 -    font = (*env)->GetObjectField(env, this, x11FontMetricsIDs.font);
 308.198 -    if (JNU_IsNull(env, this)) {
 308.199 -        JNU_ThrowNullPointerException(env, "NullPointerException");
 308.200 -        AWT_UNLOCK();
 308.201 -        return;
 308.202 -    }
 308.203 -    fdata = awtJNI_GetFontData(env, font, &err);
 308.204 -    if (fdata == NULL) {
 308.205 -        JNU_ThrowInternalError(env, err);
 308.206 -        AWT_UNLOCK();
 308.207 -        return;
 308.208 -    }
 308.209 -
 308.210 -    /*
 308.211 -     * Bug 4103248, 4120310. We must take all of the fonts into
 308.212 -     * consideration in providing the metrics, not just the 8859-1 font,
 308.213 -     * because the underlying Motif widgets are.
 308.214 -     */
 308.215 -    if (awtJNI_IsMultiFont(env, font) && fdata->xfs == NULL) {
 308.216 -        fdata->xfs = awtJNI_MakeFontSet(env, font);
 308.217 -    }
 308.218 -    if (fdata->xfs != NULL) {
 308.219 -        XFontSetExtents *fs_extents = NULL;
 308.220 -        fs_extents = XExtentsOfFontSet(fdata->xfs);
 308.221 -
 308.222 -        (*env)->SetIntField(env, this, x11FontMetricsIDs.maxAscent,
 308.223 -                        (jint)(-fs_extents->max_logical_extent.y));
 308.224 -        (*env)->SetIntField(env, this, x11FontMetricsIDs.maxDescent,
 308.225 -                        (jint)(fs_extents->max_logical_extent.height +
 308.226 -                               fs_extents->max_logical_extent.y));
 308.227 -        (*env)->SetIntField(env, this, x11FontMetricsIDs.maxAdvance,
 308.228 -                        (jint)(fs_extents->max_logical_extent.width));
 308.229 -        (*env)->SetIntField(env, this, x11FontMetricsIDs.ascent,
 308.230 -                        (jint)(-fs_extents->max_ink_extent.y));
 308.231 -        (*env)->SetIntField(env, this, x11FontMetricsIDs.descent,
 308.232 -                        (jint)(fs_extents->max_ink_extent.height +
 308.233 -                         fs_extents->max_ink_extent.y));
 308.234 -    } else {
 308.235 -        (*env)->SetIntField(env, this, x11FontMetricsIDs.maxAscent,
 308.236 -                        (jint) fdata->xfont->max_bounds.ascent);
 308.237 -        (*env)->SetIntField(env, this, x11FontMetricsIDs.maxDescent,
 308.238 -                        (jint) fdata->xfont->max_bounds.descent);
 308.239 -        (*env)->SetIntField(env, this, x11FontMetricsIDs.maxAdvance,
 308.240 -                        (jint) fdata->xfont->max_bounds.width);
 308.241 -        (*env)->SetIntField(env, this, x11FontMetricsIDs.ascent,
 308.242 -                        (jint) fdata->xfont->ascent);
 308.243 -        (*env)->SetIntField(env, this, x11FontMetricsIDs.descent,
 308.244 -                        (jint) fdata->xfont->descent);
 308.245 -    }
 308.246 -
 308.247 -    (*env)->SetIntField(env, this, x11FontMetricsIDs.leading, (jint) 1);
 308.248 -    (*env)->SetIntField(env, this, x11FontMetricsIDs.height,
 308.249 -                        (jint) fdata->xfont->ascent + fdata->xfont->descent + 1);
 308.250 -    (*env)->SetIntField(env, this, x11FontMetricsIDs.maxHeight,
 308.251 -                        (jint) fdata->xfont->max_bounds.ascent
 308.252 -                        + fdata->xfont->max_bounds.descent + 1);
 308.253 -
 308.254 -
 308.255 -    widths = (*env)->NewIntArray(env, 256);
 308.256 -    (*env)->SetObjectField(env, this, x11FontMetricsIDs.widths, widths);
 308.257 -    if (JNU_IsNull(env, widths)) {
 308.258 -        JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
 308.259 -        AWT_UNLOCK();
 308.260 -        return;
 308.261 -    }
 308.262 -    /*
 308.263 -     * We could pin the array and then release it, but I believe this method
 308.264 -     * is faster and perturbs the VM less
 308.265 -     *
 308.266 -     */
 308.267 -    memset(tempWidths, 0, 256 * sizeof(jint));
 308.268 -
 308.269 -    tempWidthsIndex = fdata->xfont->min_char_or_byte2;
 308.270 -
 308.271 -    ccount = fdata->xfont->max_char_or_byte2 - fdata->xfont->min_char_or_byte2;
 308.272 -
 308.273 -    if (fdata->xfont->per_char) {
 308.274 -        for (i = 0; i <= ccount; i++) {
 308.275 -            tempWidths[tempWidthsIndex++] = (jint) fdata->xfont->per_char[i].width;
 308.276 -        }
 308.277 -    } else {
 308.278 -        for (i = 0; i <= ccount; i++) {
 308.279 -            tempWidths[tempWidthsIndex++] = (jint) fdata->xfont->max_bounds.width;
 308.280 -        }
 308.281 -    }
 308.282 -
 308.283 -    (*env)->SetIntArrayRegion(env, widths, 0, 256, (jint *) tempWidths);
 308.284 -
 308.285 -    AWT_UNLOCK();
 308.286 -}
 308.287 -
 308.288 -/*
 308.289   * Registered with the 2D disposer to be called after the Font is GC'd.
 308.290   */
 308.291  static void pDataDisposeMethod(JNIEnv *env, jlong pData)
   309.1 --- a/src/solaris/native/sun/awt/awt_Font.h	Tue Dec 06 16:31:58 2011 -0800
   309.2 +++ b/src/solaris/native/sun/awt/awt_Font.h	Mon Dec 19 10:06:23 2011 -0800
   309.3 @@ -34,8 +34,8 @@
   309.4      jmethodID getFamily;
   309.5  };
   309.6  
   309.7 -/* fieldIDs for MFontPeer fields that may be accessed from C */
   309.8 -struct MFontPeerIDs {
   309.9 +/* fieldIDs for XFontPeer fields that may be accessed from C */
  309.10 +struct XFontPeerIDs {
  309.11      jfieldID xfsname;
  309.12  };
  309.13  
   310.1 --- a/src/solaris/native/sun/awt/awt_GraphicsEnv.c	Tue Dec 06 16:31:58 2011 -0800
   310.2 +++ b/src/solaris/native/sun/awt/awt_GraphicsEnv.c	Mon Dec 19 10:06:23 2011 -0800
   310.3 @@ -45,7 +45,6 @@
   310.4  #include <stdlib.h>
   310.5  
   310.6  #include "awt_GraphicsEnv.h"
   310.7 -#include "awt_Window.h"
   310.8  #include "awt_util.h"
   310.9  #include "gdefs.h"
  310.10  #include <dlfcn.h>
  310.11 @@ -94,8 +93,6 @@
  310.12  
  310.13  struct X11GraphicsConfigIDs x11GraphicsConfigIDs;
  310.14  struct X11GraphicsDeviceIDs x11GraphicsDeviceIDs;
  310.15 -extern struct WindowIDs mWindowIDs;
  310.16 -extern struct MWindowPeerIDs mWindowPeerIDs;
  310.17  
  310.18  #ifndef HEADLESS
  310.19  int awtCreateX11Colormap(AwtGraphicsConfigDataPtr adata);
  310.20 @@ -570,75 +567,6 @@
  310.21      AWT_UNLOCK ();
  310.22  }
  310.23  
  310.24 -/*
  310.25 - * Determing if this top-level has been moved onto another Xinerama screen.
  310.26 - * Called from awt_TopLevel.c
  310.27 - *
  310.28 - * ASSUME: wdata != null
  310.29 - */
  310.30 -#ifndef HEADLESS
  310.31 -void checkNewXineramaScreen(JNIEnv* env, jobject peer, struct FrameData* wdata,
  310.32 -                            int32_t newX, int32_t newY,
  310.33 -                            int32_t newWidth, int32_t newHeight) {
  310.34 -    int i;
  310.35 -    int amt;
  310.36 -    int totAmt = 0;
  310.37 -    int largestAmt = 0;
  310.38 -    int largestAmtScr = 0;
  310.39 -
  310.40 -    int horiz;
  310.41 -    int vert;
  310.42 -
  310.43 -    if (!usingXinerama) { return; }
  310.44 -
  310.45 -    totAmt = newWidth * newHeight;
  310.46 -
  310.47 -    /* assert that peer implements WindowPeer */
  310.48 -    DASSERT(JNU_IsInstanceOfByName(env, peer, "java/awt/peer/WindowPeer"));
  310.49 -
  310.50 -    DTRACE_PRINTLN4("checkNewXineramaScreen() x=%i y=%i w=%i h=%i\n",newX, newY, newWidth, newHeight);
  310.51 -
  310.52 -    /* decide which screen we're on
  310.53 -     * if we're spanning, figure out which screen we're most on
  310.54 -     */
  310.55 -    for (i = 0; i < awt_numScreens; i++) {
  310.56 -        if (INTERSECTS(newX, newX + newWidth, newY, newY + newHeight,
  310.57 -                       fbrects[i].x, fbrects[i].x + fbrects[i].width,
  310.58 -                       fbrects[i].y, fbrects[i].y + fbrects[i].height)) {
  310.59 -
  310.60 -            /* calc how much of window is on this screen */
  310.61 -            horiz = MIN(newX + newWidth, fbrects[i].x + fbrects[i].width) -
  310.62 -                    MAX(newX, fbrects[i].x);
  310.63 -            vert =  MIN(newY + newHeight, fbrects[i].y + fbrects[i].height) -
  310.64 -                    MAX(newY, fbrects[i].y);
  310.65 -            DASSERT(horiz > 0);
  310.66 -            DASSERT(vert > 0);
  310.67 -
  310.68 -            amt = horiz * vert;
  310.69 -            if (amt == totAmt) {
  310.70 -                /* completely on this screen - done! */
  310.71 -                largestAmtScr = i;
  310.72 -                break;
  310.73 -            }
  310.74 -            if (amt > largestAmt) {
  310.75 -                largestAmt = amt;
  310.76 -                largestAmtScr = i;
  310.77 -            }
  310.78 -        }
  310.79 -    }
  310.80 -
  310.81 -#ifndef XAWT
  310.82 -    /* check if we're on a new screen */
  310.83 -    if (largestAmtScr != wdata->screenNum) {
  310.84 -        wdata->screenNum = largestAmtScr;
  310.85 -        /* update peer, target Comp */
  310.86 -        (*env)->CallVoidMethod(env, peer,
  310.87 -                               mWindowPeerIDs.draggedToScreenMID, largestAmtScr);
  310.88 -    }
  310.89 -#endif /* XAWT */
  310.90 -}
  310.91 -#endif /* HEADLESS */
  310.92 -
  310.93  #ifndef HEADLESS
  310.94  #ifdef __linux__
  310.95  static void xinerama_init_linux()
  310.96 @@ -1434,11 +1362,17 @@
  310.97                                                          fbrects[screen].height);
  310.98          }
  310.99          else {
 310.100 +            XWindowAttributes xwa;
 310.101 +            memset(&xwa, 0, sizeof(xwa));
 310.102 +
 310.103 +            AWT_LOCK ();
 310.104 +            XGetWindowAttributes(awt_display,
 310.105 +                    RootWindow(awt_display, adata->awt_visInfo.screen),
 310.106 +                    &xwa);
 310.107 +            AWT_UNLOCK ();
 310.108 +
 310.109              bounds = (*env)->NewObject(env, clazz, mid, 0, 0,
 310.110 -                                   DisplayWidth(awt_display,
 310.111 -                                                adata->awt_visInfo.screen),
 310.112 -                                   DisplayHeight(awt_display,
 310.113 -                                                 adata->awt_visInfo.screen));
 310.114 +                    xwa.width, xwa.height);
 310.115          }
 310.116  
 310.117          if ((*env)->ExceptionOccurred(env)) {
   311.1 --- a/src/solaris/native/sun/awt/awt_InputMethod.c	Tue Dec 06 16:31:58 2011 -0800
   311.2 +++ b/src/solaris/native/sun/awt/awt_InputMethod.c	Mon Dec 19 10:06:23 2011 -0800
   311.3 @@ -30,28 +30,14 @@
   311.4  #include <stdio.h>
   311.5  #include <stdlib.h>
   311.6  #include <X11/Xlib.h>
   311.7 -#ifdef XAWT
   311.8  #include <sys/time.h>
   311.9 -#else /* !XAWT */
  311.10 -#include <Xm/Xm.h>
  311.11 -#include <Xm/RowColumn.h>
  311.12 -#include <Xm/MwmUtil.h>
  311.13 -#include <Xm/MenuShell.h>
  311.14 -#endif /* XAWT */
  311.15  
  311.16  #include "awt.h"
  311.17  #include "awt_p.h"
  311.18  
  311.19  #include <sun_awt_X11InputMethod.h>
  311.20 -#ifdef XAWT
  311.21  #include <sun_awt_X11_XComponentPeer.h>
  311.22  #include <sun_awt_X11_XInputMethod.h>
  311.23 -#else /* !XAWT */
  311.24 -#include <sun_awt_motif_MComponentPeer.h>
  311.25 -#include <sun_awt_motif_MInputMethod.h>
  311.26 -
  311.27 -#define MCOMPONENTPEER_CLASS_NAME       "sun/awt/motif/MComponentPeer"
  311.28 -#endif /* XAWT */
  311.29  
  311.30  #define THROW_OUT_OF_MEMORY_ERROR() \
  311.31          JNU_ThrowOutOfMemoryError((JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2), NULL)
  311.32 @@ -111,11 +97,7 @@
  311.33  typedef struct {
  311.34      Window   w;                /*status window id        */
  311.35      Window   root;             /*the root window id      */
  311.36 -#ifdef XAWT
  311.37      Window   parent;           /*parent shell window     */
  311.38 -#else
  311.39 -    Widget   parent;           /*parent shell window     */
  311.40 -#endif
  311.41      int      x, y;             /*parent's upperleft position */
  311.42      int      width, height;    /*parent's width, height  */
  311.43      GC       lightGC;          /*gc for light border     */
  311.44 @@ -141,17 +123,10 @@
  311.45      XIC         ic_active;      /* X Input Context for active clients */
  311.46      XIC         ic_passive;     /* X Input Context for passive clients */
  311.47      XIMCallback *callbacks;     /* callback parameters */
  311.48 -#ifndef XAWT
  311.49 -    jobject     peer;           /* MComponentPeer of client Window */
  311.50 -#endif /* XAWT */
  311.51      jobject     x11inputmethod; /* global ref to X11InputMethod instance */
  311.52                                  /* associated with the XIC */
  311.53  #ifdef __linux__
  311.54      StatusWindow *statusWindow; /* our own status window  */
  311.55 -#else
  311.56 -#ifndef XAWT
  311.57 -    Widget      statusWidget;   /* IM status window widget */
  311.58 -#endif /* XAWT */
  311.59  #endif
  311.60      char        *lookup_buf;    /* buffer used for XmbLookupString */
  311.61      int         lookup_buf_len; /* lookup buffer size in bytes */
  311.62 @@ -191,12 +166,6 @@
  311.63  
  311.64  #define GetJNIEnv() (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2)
  311.65  
  311.66 -#ifndef XAWT
  311.67 -static jobject  mcompClass = NULL;
  311.68 -static jobject  awteventClass = NULL;
  311.69 -static jfieldID mcompPDataID = NULL;
  311.70 -#endif /* XAWT */
  311.71 -
  311.72  static void DestroyXIMCallback(XIM, XPointer, XPointer);
  311.73  static void OpenXIMCallback(Display *, XPointer, XPointer);
  311.74  /* Solaris XIM Extention */
  311.75 @@ -261,28 +230,6 @@
  311.76      return mbs;
  311.77  }
  311.78  
  311.79 -#ifndef XAWT
  311.80 -/*
  311.81 - * Find a class for the given class name and return a global reference to the
  311.82 - * class.
  311.83 - */
  311.84 -static jobject
  311.85 -findClass(const char *className)
  311.86 -{
  311.87 -    JNIEnv *env = GetJNIEnv();
  311.88 -    jclass classClass;
  311.89 -    jobject objectClass;
  311.90 -
  311.91 -    classClass = (*env)->FindClass(env, className);
  311.92 -    objectClass = (*env)->NewGlobalRef(env,classClass);
  311.93 -
  311.94 -    if (JNU_IsNull(env, objectClass)) {
  311.95 -        JNU_ThrowClassNotFoundException(env, className);
  311.96 -    }
  311.97 -    return objectClass;
  311.98 -}
  311.99 -#endif /* XAWT */
 311.100 -
 311.101  /*
 311.102   * Returns True if the global reference is still in the list,
 311.103   * otherwise False.
 311.104 @@ -444,9 +391,6 @@
 311.105          free((void *)pX11IMData->callbacks);
 311.106  
 311.107      if (env) {
 311.108 -#ifndef XAWT
 311.109 -        (*env)->DeleteGlobalRef(env, pX11IMData->peer);
 311.110 -#endif /* XAWT */
 311.111          /* Remove the global reference from the list, so that
 311.112             the callback function or whoever refers to it could know.
 311.113          */
 311.114 @@ -580,23 +524,10 @@
 311.115      /* Get keysym without taking modifiers into account first to map
 311.116       * to AWT keyCode table.
 311.117       */
 311.118 -#ifndef XAWT
 311.119 -    if (((event->state & ShiftMask) ||
 311.120 -        (event->state & LockMask)) &&
 311.121 -         keysym >= 'A' && keysym <= 'Z')
 311.122 -    {
 311.123 -        keysym = XLookupKeysym(event, 0);
 311.124 -    }
 311.125 -#endif
 311.126 -
 311.127      switch (status) {
 311.128      case XLookupBoth:
 311.129          if (!composing) {
 311.130 -#ifdef XAWT
 311.131              if (event->keycode != 0) {
 311.132 -#else
 311.133 -            if (keysym < 128 || ((keysym & 0xff00) == 0xff00)) {
 311.134 -#endif
 311.135                  *keysymp = keysym;
 311.136                  result = False;
 311.137                  break;
 311.138 @@ -650,11 +581,7 @@
 311.139  
 311.140  #ifdef __linux__
 311.141  static StatusWindow *createStatusWindow(
 311.142 -#ifdef XAWT
 311.143                                  Window parent) {
 311.144 -#else
 311.145 -                                Widget parent) {
 311.146 -#endif
 311.147      StatusWindow *statusWindow;
 311.148      XSetWindowAttributes attrib;
 311.149      unsigned long attribmask;
 311.150 @@ -682,22 +609,12 @@
 311.151      Window *ignoreWindowPtr;
 311.152      unsigned int ignoreUnit;
 311.153  
 311.154 -#ifdef XAWT
 311.155      XGetGeometry(dpy, parent, &rootWindow, &x, &y, &w, &h, &bw, &depth);
 311.156 -#else
 311.157 -    while (!XtIsShell(parent)){
 311.158 -        parent = XtParent(parent);
 311.159 -    }
 311.160 -#endif
 311.161  
 311.162      attrib.override_redirect = True;
 311.163      attribmask = CWOverrideRedirect;
 311.164      for (i = 0; i < awt_numScreens; i++) {
 311.165 -#ifdef XAWT
 311.166          if (RootWindow(dpy, i) == rootWindow) {
 311.167 -#else
 311.168 -        if (ScreenOfDisplay(dpy, i) == XtScreen(parent)) {
 311.169 -#endif
 311.170              screen = i;
 311.171              break;
 311.172          }
 311.173 @@ -798,11 +715,7 @@
 311.174  
 311.175  /* This method is to turn off or turn on the status window. */
 311.176  static void onoffStatusWindow(X11InputMethodData* pX11IMData,
 311.177 -#ifdef XAWT
 311.178                                  Window parent,
 311.179 -#else
 311.180 -                                Widget parent,
 311.181 -#endif
 311.182                                  Bool ON){
 311.183      XWindowAttributes xwa;
 311.184      Window child;
 311.185 @@ -820,15 +733,9 @@
 311.186          statusWindow->on = False;
 311.187          return;
 311.188      }
 311.189 -#ifdef XAWT
 311.190      parent = JNU_CallMethodByName(GetJNIEnv(), NULL, pX11IMData->x11inputmethod,
 311.191                                    "getCurrentParentWindow",
 311.192                                    "()J").j;
 311.193 -#else
 311.194 -    while (!XtIsShell(parent)){
 311.195 -        parent = XtParent(parent);
 311.196 -    }
 311.197 -#endif
 311.198      if (statusWindow->parent != parent){
 311.199          statusWindow->parent = parent;
 311.200      }
 311.201 @@ -941,11 +848,7 @@
 311.202    }
 311.203  }
 311.204  
 311.205 -#ifdef XAWT
 311.206  static void adjustStatusWindow(Window shell){
 311.207 -#else
 311.208 -void adjustStatusWindow(Widget shell){
 311.209 -#endif
 311.210      JNIEnv *env = GetJNIEnv();
 311.211      X11InputMethodData *pX11IMData = NULL;
 311.212      StatusWindow *statusWindow;
 311.213 @@ -957,11 +860,7 @@
 311.214          || !statusWindow->on) {
 311.215          return;
 311.216      }
 311.217 -#ifdef XAWT
 311.218      {
 311.219 -#else
 311.220 -    if (statusWindow->parent == shell) {
 311.221 -#endif
 311.222          XWindowAttributes xwa;
 311.223          int x, y;
 311.224          Window child;
 311.225 @@ -1009,12 +908,7 @@
 311.226   * fallback to None styles.
 311.227   */
 311.228  static Bool
 311.229 -#ifdef XAWT
 311.230  createXIC(JNIEnv * env, X11InputMethodData *pX11IMData, Window w)
 311.231 -#else /* !XAWT */
 311.232 -createXIC(Widget w, X11InputMethodData *pX11IMData,
 311.233 -          jobject tc, jobject peer)
 311.234 -#endif /* XAWT */
 311.235  {
 311.236      XIC active_ic, passive_ic;
 311.237      XVaNestedList preedit = NULL;
 311.238 @@ -1031,17 +925,9 @@
 311.239      if (X11im == NULL) {
 311.240          return False;
 311.241      }
 311.242 -#ifdef XAWT
 311.243      if (!w) {
 311.244          return False;
 311.245      }
 311.246 -#else /* !XAWT */
 311.247 -    /*
 311.248 -     * If the parent window has one or more TextComponents, the status
 311.249 -     * area of Motif will be shared with the created XIC. Otherwise,
 311.250 -     * root-window style status is used.
 311.251 -     */
 311.252 -#endif /* XAWT */
 311.253  
 311.254      ret = XGetIMValues(X11im, XNQueryInputStyle, &im_styles, NULL);
 311.255  
 311.256 @@ -1064,28 +950,7 @@
 311.257          }
 311.258      }
 311.259  #else /*! __linux__ */
 311.260 -#ifdef XAWT
 311.261      on_the_spot_styles |= XIMStatusNothing;
 311.262 -#else /* !XAWT */
 311.263 -    /*
 311.264 -     * If the parent window has one or more TextComponents, the status
 311.265 -     * area of Motif will be shared with the created XIC. Otherwise,
 311.266 -     * root-window style status is used.
 311.267 -     */
 311.268 -    if (tc != NULL){
 311.269 -        XVaNestedList status = NULL;
 311.270 -        status = awt_motif_getXICStatusAreaList(w, tc);
 311.271 -        if (status != NULL){
 311.272 -            on_the_spot_styles |=  XIMStatusArea;
 311.273 -            XFree(status);
 311.274 -        }
 311.275 -        else
 311.276 -            on_the_spot_styles |= XIMStatusNothing;
 311.277 -    }
 311.278 -    else
 311.279 -        on_the_spot_styles |= XIMStatusNothing;
 311.280 -
 311.281 -#endif /* XAWT */
 311.282  #endif /* __linux__ */
 311.283  
 311.284      for (i = 0; i < im_styles->count_styles; i++) {
 311.285 @@ -1157,32 +1022,12 @@
 311.286              XFree((void *)preedit);
 311.287          }
 311.288  #else /* !__linux__ */
 311.289 -#ifndef XAWT
 311.290 -        if (on_the_spot_styles & XIMStatusArea) {
 311.291 -            Widget parent;
 311.292 -            status = awt_motif_getXICStatusAreaList(w, tc);
 311.293 -            if (status == NULL)
 311.294 -                goto err;
 311.295 -            pX11IMData->statusWidget = awt_util_getXICStatusAreaWindow(w);
 311.296 -            pX11IMData->ic_active = XCreateIC(X11im,
 311.297 -                                              XNClientWindow, pX11IMData->statusWidget,
 311.298 -                                              XNFocusWindow, w,
 311.299 -                                              XNInputStyle, active_styles,
 311.300 -                                              XNPreeditAttributes, preedit,
 311.301 -                                              XNStatusAttributes, status,
 311.302 -                                              NULL);
 311.303 -            XFree((void *)status);
 311.304 -        } else {
 311.305 -#endif /* XAWT */
 311.306              pX11IMData->ic_active = XCreateIC(X11im,
 311.307                                                XNClientWindow, w,
 311.308                                                XNFocusWindow, w,
 311.309                                                XNInputStyle, active_styles,
 311.310                                                XNPreeditAttributes, preedit,
 311.311                                                NULL);
 311.312 -#ifndef XAWT
 311.313 -        }
 311.314 -#endif /* XAWT */
 311.315          XFree((void *)preedit);
 311.316  #endif /* __linux__ */
 311.317          pX11IMData->ic_passive = XCreateIC(X11im,
 311.318 @@ -1479,7 +1324,7 @@
 311.319  }
 311.320  
 311.321  /*
 311.322 - * Class:     java_sun_awt_motif_X11InputMethod
 311.323 + * Class:     sun_awt_X11InputMethod
 311.324   * Method:    initIDs
 311.325   * Signature: ()V
 311.326   */
 311.327 @@ -1495,24 +1340,15 @@
 311.328  
 311.329  
 311.330  JNIEXPORT jboolean JNICALL
 311.331 -#ifdef XAWT
 311.332  Java_sun_awt_X11_XInputMethod_openXIMNative(JNIEnv *env,
 311.333                                            jobject this,
 311.334                                            jlong display)
 311.335 -#else
 311.336 -Java_sun_awt_motif_MInputMethod_openXIMNative(JNIEnv *env,
 311.337 -                                          jobject this)
 311.338 -#endif
 311.339  {
 311.340      Bool registered;
 311.341  
 311.342      AWT_LOCK();
 311.343  
 311.344 -#ifdef XAWT
 311.345      dpy = (Display *)jlong_to_ptr(display);
 311.346 -#else
 311.347 -    dpy = awt_display;
 311.348 -#endif
 311.349  
 311.350  /* Use IMInstantiate call back only on Linux, as there is a bug in Solaris
 311.351     (4768335)
 311.352 @@ -1534,30 +1370,17 @@
 311.353  }
 311.354  
 311.355  JNIEXPORT jboolean JNICALL
 311.356 -#ifdef XAWT
 311.357  Java_sun_awt_X11_XInputMethod_createXICNative(JNIEnv *env,
 311.358                                                    jobject this,
 311.359                                                    jlong window)
 311.360  {
 311.361 -#else /* !XAWT */
 311.362 -Java_sun_awt_motif_MInputMethod_createXICNative(JNIEnv *env,
 311.363 -                                                  jobject this,
 311.364 -                                                  jobject comp,
 311.365 -                                                  jobject tc)
 311.366 -{
 311.367 -    struct ComponentData *cdata;
 311.368 -#endif /* XAWT */
 311.369      X11InputMethodData *pX11IMData;
 311.370      jobject globalRef;
 311.371      XIC ic;
 311.372  
 311.373      AWT_LOCK();
 311.374  
 311.375 -#ifdef XAWT
 311.376      if (!window) {
 311.377 -#else /* !XAWT */
 311.378 -    if (JNU_IsNull(env, comp)) {
 311.379 -#endif /* XAWT */
 311.380          JNU_ThrowNullPointerException(env, "NullPointerException");
 311.381          AWT_UNLOCK();
 311.382          return JNI_FALSE;
 311.383 @@ -1570,40 +1393,16 @@
 311.384          return JNI_FALSE;
 311.385      }
 311.386  
 311.387 -#ifndef XAWT
 311.388 -    if (mcompClass == NULL) {
 311.389 -        mcompClass = findClass(MCOMPONENTPEER_CLASS_NAME);
 311.390 -        mcompPDataID = (*env)->GetFieldID(env, mcompClass, "pData", "J");
 311.391 -    }
 311.392 -    cdata = (struct ComponentData *) JNU_GetLongFieldAsPtr(env,comp,mcompPDataID);
 311.393 -
 311.394 -    if (cdata == 0) {
 311.395 -        free((void *)pX11IMData);
 311.396 -        JNU_ThrowNullPointerException(env, "createXIC");
 311.397 -        AWT_UNLOCK();
 311.398 -        return JNI_FALSE;
 311.399 -    }
 311.400 -
 311.401 -    pX11IMData->peer = (*env)->NewGlobalRef(env, comp);
 311.402 -#endif /* XAWT */
 311.403      globalRef = (*env)->NewGlobalRef(env, this);
 311.404      pX11IMData->x11inputmethod = globalRef;
 311.405  #ifdef __linux__
 311.406      pX11IMData->statusWindow = NULL;
 311.407 -#else /* __linux__ */
 311.408 -#ifndef XAWT
 311.409 -    pX11IMData->statusWidget = (Widget) NULL;
 311.410 -#endif /* XAWT */
 311.411  #endif /* __linux__ */
 311.412  
 311.413      pX11IMData->lookup_buf = 0;
 311.414      pX11IMData->lookup_buf_len = 0;
 311.415  
 311.416 -#ifdef XAWT
 311.417      if (createXIC(env, pX11IMData, (Window)window)
 311.418 -#else /* !XAWT */
 311.419 -    if (createXIC(cdata->widget, pX11IMData, tc, comp)
 311.420 -#endif /* XAWT */
 311.421          == False) {
 311.422          destroyX11InputMethodData((JNIEnv *) NULL, pX11IMData);
 311.423          pX11IMData = (X11InputMethodData *) NULL;
 311.424 @@ -1615,77 +1414,6 @@
 311.425      return (pX11IMData != NULL);
 311.426  }
 311.427  
 311.428 -#ifndef XAWT
 311.429 -JNIEXPORT void JNICALL
 311.430 -Java_sun_awt_motif_MInputMethod_reconfigureXICNative(JNIEnv *env,
 311.431 -                                                       jobject this,
 311.432 -                                                       jobject comp,
 311.433 -                                                       jobject tc)
 311.434 -{
 311.435 -    X11InputMethodData *pX11IMData;
 311.436 -
 311.437 -    AWT_LOCK();
 311.438 -
 311.439 -    pX11IMData = getX11InputMethodData(env, this);
 311.440 -    if (pX11IMData == NULL) {
 311.441 -        AWT_UNLOCK();
 311.442 -        return;
 311.443 -    }
 311.444 -
 311.445 -    if (pX11IMData->current_ic == (XIC)0) {
 311.446 -        destroyX11InputMethodData(env, pX11IMData);
 311.447 -        pX11IMData = (X11InputMethodData *)NULL;
 311.448 -    } else {
 311.449 -        Bool active;
 311.450 -        struct ComponentData *cdata;
 311.451 -
 311.452 -        active = pX11IMData->current_ic == pX11IMData->ic_active;
 311.453 -        if (mcompClass == NULL) {
 311.454 -            mcompClass = findClass(MCOMPONENTPEER_CLASS_NAME);
 311.455 -            mcompPDataID = (*env)->GetFieldID(env, mcompClass, "pData", "J");
 311.456 -        }
 311.457 -        cdata = (struct ComponentData *) JNU_GetLongFieldAsPtr(env,comp,mcompPDataID);
 311.458 -        if (cdata == 0) {
 311.459 -            JNU_ThrowNullPointerException(env, "reconfigureXICNative");
 311.460 -            destroyX11InputMethodData(env, pX11IMData);
 311.461 -            pX11IMData = (X11InputMethodData *)NULL;
 311.462 -        }
 311.463 -        XDestroyIC(pX11IMData->ic_active);
 311.464 -        if (pX11IMData->ic_active != pX11IMData->ic_passive)
 311.465 -            XDestroyIC(pX11IMData->ic_passive);
 311.466 -        pX11IMData->current_ic = (XIC)0;
 311.467 -        pX11IMData->ic_active = (XIC)0;
 311.468 -        pX11IMData->ic_passive = (XIC)0;
 311.469 -        if (createXIC(cdata->widget, pX11IMData, tc, comp)) {
 311.470 -            pX11IMData->current_ic = active ?
 311.471 -                        pX11IMData->ic_active : pX11IMData->ic_passive;
 311.472 -            /*
 311.473 -             * On Solaris2.6, setXICWindowFocus() has to be invoked
 311.474 -             * before setting focus.
 311.475 -             */
 311.476 -            setXICWindowFocus(pX11IMData->current_ic, cdata->widget);
 311.477 -            setXICFocus(pX11IMData->current_ic, True);
 311.478 -        } else {
 311.479 -            destroyX11InputMethodData((JNIEnv *) NULL, pX11IMData);
 311.480 -            pX11IMData = (X11InputMethodData *)NULL;
 311.481 -        }
 311.482 -    }
 311.483 -
 311.484 -    setX11InputMethodData(env, this, pX11IMData);
 311.485 -
 311.486 -    AWT_UNLOCK();
 311.487 -}
 311.488 -
 311.489 -JNIEXPORT void JNICALL
 311.490 -Java_sun_awt_motif_MInputMethod_setXICFocusNative(JNIEnv *env,
 311.491 -                                              jobject this,
 311.492 -                                              jobject comp,
 311.493 -                                              jboolean req,
 311.494 -                                              jboolean active)
 311.495 -{
 311.496 -    struct ComponentData *cdata;
 311.497 -    Widget w;
 311.498 -#else /* !XAWT */
 311.499  JNIEXPORT void JNICALL
 311.500  Java_sun_awt_X11_XInputMethod_setXICFocusNative(JNIEnv *env,
 311.501                                                jobject this,
 311.502 @@ -1693,7 +1421,6 @@
 311.503                                                jboolean req,
 311.504                                                jboolean active)
 311.505  {
 311.506 -#endif /* XAWT */
 311.507      X11InputMethodData *pX11IMData;
 311.508      AWT_LOCK();
 311.509      pX11IMData = getX11InputMethodData(env, this);
 311.510 @@ -1703,40 +1430,16 @@
 311.511      }
 311.512  
 311.513      if (req) {
 311.514 -#ifdef XAWT
 311.515          if (!w) {
 311.516              AWT_UNLOCK();
 311.517              return;
 311.518          }
 311.519 -#else /* !XAWT */
 311.520 -        struct ComponentData *cdata;
 311.521 -
 311.522 -        if (JNU_IsNull(env, comp)) {
 311.523 -            AWT_UNLOCK();
 311.524 -            return;
 311.525 -        }
 311.526 -        if (mcompClass == NULL) {
 311.527 -            mcompClass = findClass(MCOMPONENTPEER_CLASS_NAME);
 311.528 -            mcompPDataID = (*env)->GetFieldID(env, mcompClass, "pData", "J");
 311.529 -        }
 311.530 -        cdata = (struct ComponentData *)JNU_GetLongFieldAsPtr(env, comp,
 311.531 -                                                              mcompPDataID);
 311.532 -        if (cdata == 0) {
 311.533 -            JNU_ThrowNullPointerException(env, "setXICFocus pData");
 311.534 -            AWT_UNLOCK();
 311.535 -            return;
 311.536 -        }
 311.537 -#endif /* XAWT */
 311.538 -
 311.539          pX11IMData->current_ic = active ?
 311.540                          pX11IMData->ic_active : pX11IMData->ic_passive;
 311.541          /*
 311.542           * On Solaris2.6, setXICWindowFocus() has to be invoked
 311.543           * before setting focus.
 311.544           */
 311.545 -#ifndef XAWT
 311.546 -        w = cdata->widget;
 311.547 -#endif /* XAWT */
 311.548          setXICWindowFocus(pX11IMData->current_ic, w);
 311.549          setXICFocus(pX11IMData->current_ic, req);
 311.550          currentX11InputMethodInstance = pX11IMData->x11inputmethod;
 311.551 @@ -1853,40 +1556,6 @@
 311.552      return jText;
 311.553  }
 311.554  
 311.555 -#ifndef XAWT
 311.556 -JNIEXPORT void JNICALL
 311.557 -Java_sun_awt_motif_MInputMethod_configureStatusAreaNative(JNIEnv *env,
 311.558 -                                                            jobject this,
 311.559 -                                                            jobject tc)
 311.560 -{
 311.561 -    X11InputMethodData *pX11IMData;
 311.562 -    XVaNestedList status;
 311.563 -
 311.564 -#ifdef __linux__
 311.565 -      /*do nothing for linux? */
 311.566 -#else
 311.567 -    AWT_LOCK();
 311.568 -    pX11IMData = getX11InputMethodData(env, this);
 311.569 -
 311.570 -    if ((pX11IMData == NULL) || (pX11IMData->ic_active == (XIC)0)) {
 311.571 -        AWT_UNLOCK();
 311.572 -        return;
 311.573 -    }
 311.574 -
 311.575 -    if (pX11IMData->statusWidget) {
 311.576 -        status = awt_motif_getXICStatusAreaList(pX11IMData->statusWidget, tc);
 311.577 -        if (status != (XVaNestedList)NULL) {
 311.578 -            XSetICValues(pX11IMData->ic_active,
 311.579 -                         XNStatusAttributes, status,
 311.580 -                         NULL);
 311.581 -            XFree((void *)status);
 311.582 -        }
 311.583 -    }
 311.584 -    AWT_UNLOCK();
 311.585 -#endif
 311.586 -}
 311.587 -#endif /* XAWT */
 311.588 -
 311.589  /*
 311.590   * Class:     sun_awt_X11InputMethod
 311.591   * Method:    setCompositionEnabledNative
 311.592 @@ -1964,7 +1633,6 @@
 311.593      return (jboolean)(state == XIMPreeditEnable);
 311.594  }
 311.595  
 311.596 -#ifdef XAWT
 311.597  JNIEXPORT void JNICALL Java_sun_awt_X11_XInputMethod_adjustStatusWindow
 311.598    (JNIEnv *env, jobject this, jlong window)
 311.599  {
 311.600 @@ -1974,4 +1642,3 @@
 311.601      AWT_UNLOCK();
 311.602  #endif
 311.603  }
 311.604 -#endif
   312.1 --- a/src/solaris/native/sun/awt/awt_KeyboardFocusManager.h	Tue Dec 06 16:31:58 2011 -0800
   312.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   312.3 @@ -1,36 +0,0 @@
   312.4 -/*
   312.5 - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
   312.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   312.7 - *
   312.8 - * This code is free software; you can redistribute it and/or modify it
   312.9 - * under the terms of the GNU General Public License version 2 only, as
  312.10 - * published by the Free Software Foundation.  Oracle designates this
  312.11 - * particular file as subject to the "Classpath" exception as provided
  312.12 - * by Oracle in the LICENSE file that accompanied this code.
  312.13 - *
  312.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
  312.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  312.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  312.17 - * version 2 for more details (a copy is included in the LICENSE file that
  312.18 - * accompanied this code).
  312.19 - *
  312.20 - * You should have received a copy of the GNU General Public License version
  312.21 - * 2 along with this work; if not, write to the Free Software Foundation,
  312.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  312.23 - *
  312.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  312.25 - * or visit www.oracle.com if you need additional information or have any
  312.26 - * questions.
  312.27 - */
  312.28 -
  312.29 -#include "jni.h"
  312.30 -
  312.31 -struct KeyboardFocusManagerIDs {
  312.32 -    jclass keyboardFocusManagerCls;
  312.33 -    jmethodID shouldNativelyFocusHeavyweightMID;
  312.34 -    jmethodID heavyweightButtonDownMID;
  312.35 -    jmethodID heavyweightButtonDownZMID;
  312.36 -    jmethodID markClearGlobalFocusOwnerMID;
  312.37 -    jmethodID processSynchronousTransferMID;
  312.38 -    jfieldID isProxyActive;
  312.39 -};
   313.1 --- a/src/solaris/native/sun/awt/awt_MToolkit.c	Tue Dec 06 16:31:58 2011 -0800
   313.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   313.3 @@ -1,3430 +0,0 @@
   313.4 -/*
   313.5 - * Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved.
   313.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   313.7 - *
   313.8 - * This code is free software; you can redistribute it and/or modify it
   313.9 - * under the terms of the GNU General Public License version 2 only, as
  313.10 - * published by the Free Software Foundation.  Oracle designates this
  313.11 - * particular file as subject to the "Classpath" exception as provided
  313.12 - * by Oracle in the LICENSE file that accompanied this code.
  313.13 - *
  313.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
  313.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  313.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  313.17 - * version 2 for more details (a copy is included in the LICENSE file that
  313.18 - * accompanied this code).
  313.19 - *
  313.20 - * You should have received a copy of the GNU General Public License version
  313.21 - * 2 along with this work; if not, write to the Free Software Foundation,
  313.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  313.23 - *
  313.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  313.25 - * or visit www.oracle.com if you need additional information or have any
  313.26 - * questions.
  313.27 - */
  313.28 -
  313.29 -#include "awt_p.h"
  313.30 -
  313.31 -#include <sys/time.h>
  313.32 -#include <limits.h>
  313.33 -#include <locale.h>
  313.34 -
  313.35 -#ifndef HEADLESS
  313.36 -#include <X11/cursorfont.h>
  313.37 -#include <Xm/MenuShell.h>
  313.38 -#include <Xm/RowColumn.h>
  313.39 -#endif /* !HEADLESS */
  313.40 -
  313.41 -#include <jvm.h>
  313.42 -#include <jni.h>
  313.43 -#include <jlong.h>
  313.44 -#include <jni_util.h>
  313.45 -
  313.46 -/* JNI headers */
  313.47 -#include "java_awt_AWTEvent.h"
  313.48 -#include "java_awt_Frame.h"
  313.49 -#include "java_awt_SystemColor.h"
  313.50 -#include "sun_awt_motif_MToolkit.h"
  313.51 -
  313.52 -/* JNI field and method ids */
  313.53 -#include "awt_Component.h"
  313.54 -//#include "awt_Cursor.h"
  313.55 -#include "awt_MenuComponent.h"
  313.56 -#include "awt_TopLevel.h"
  313.57 -#include "canvas.h"
  313.58 -#include "color.h"
  313.59 -#include "awt_mgrsel.h"
  313.60 -#include "awt_wm.h"
  313.61 -#include "awt_DrawingSurface.h"
  313.62 -#include "awt_Window.h"
  313.63 -#include "awt_xembed.h"
  313.64 -#include "awt_xembed_server.h"
  313.65 -
  313.66 -extern JavaVM *jvm;
  313.67 -
  313.68 -#ifndef HEADLESS
  313.69 -#ifdef __linux__
  313.70 -extern void statusWindowEventHandler(XEvent event);
  313.71 -#endif
  313.72 -#endif /* !HEADLESS */
  313.73 -
  313.74 -JNIEXPORT jint JNICALL
  313.75 -JNI_OnLoad(JavaVM *vm, void *reserved)
  313.76 -{
  313.77 -#ifndef HEADLESS
  313.78 -    awt_util_debug_init();
  313.79 -#endif /* !HEADLESS */
  313.80 -    jvm = vm;
  313.81 -    return JNI_VERSION_1_2;
  313.82 -}
  313.83 -
  313.84 -JNIEXPORT jboolean JNICALL AWTIsHeadless() {
  313.85 -#ifdef HEADLESS
  313.86 -    return JNI_TRUE;
  313.87 -#else
  313.88 -    return JNI_FALSE;
  313.89 -#endif
  313.90 -}
  313.91 -
  313.92 -#ifndef HEADLESS
  313.93 -static jlong awtJNI_TimeMillis(void);
  313.94 -extern void awt_initialize_Xm_DnD(Display*);
  313.95 -extern void awt_initialize_DataTransferer();
  313.96 -
  313.97 -extern Display *awt_init_Display(JNIEnv *env);
  313.98 -
  313.99 -extern void X11SD_LibDispose(JNIEnv *env);
 313.100 -
 313.101 -extern Widget drag_source = NULL;
 313.102 -
 313.103 -extern struct ComponentIDs componentIDs;
 313.104 -extern struct MenuComponentIDs menuComponentIDs;
 313.105 -extern struct MComponentPeerIDs mComponentPeerIDs;
 313.106 -extern struct WindowIDs windowIDs;
 313.107 -
 313.108 -static Atom _XA_XSETTINGS_SETTINGS = None;
 313.109 -struct xsettings_callback_cookie {
 313.110 -    jobject mtoolkit;
 313.111 -    jmethodID upcallMID;
 313.112 -};
 313.113 -
 313.114 -static struct xsettings_callback_cookie xsettings_callback_cookie;
 313.115 -
 313.116 -
 313.117 -static XEvent focusOutEvent;
 313.118 -
 313.119 -static void awt_pipe_init(void);
 313.120 -static void processOneEvent(XtInputMask iMask);
 313.121 -extern void waitForEvents(JNIEnv *env, int32_t fdXPipe, int32_t fdAWTPipe);
 313.122 -#ifdef USE_SELECT
 313.123 -static void performSelect(JNIEnv *env, int32_t fdXPipe, int32_t fdAWTPipe);
 313.124 -#else
 313.125 -static void performPoll(JNIEnv *env,int32_t fdXPipe, int32_t fdAWTPipe);
 313.126 -#endif
 313.127 -
 313.128 -
 313.129 -#include <X11/Intrinsic.h>
 313.130 -#include <dlfcn.h>
 313.131 -#include <fcntl.h>
 313.132 -
 313.133 -#ifdef USE_SELECT
 313.134 -#if defined(AIX)
 313.135 -#include <sys/select.h>
 313.136 -#endif
 313.137 -#else
 313.138 -#include <poll.h>
 313.139 -#ifndef POLLRDNORM
 313.140 -#define POLLRDNORM POLLIN
 313.141 -#endif
 313.142 -#endif
 313.143 -
 313.144 -#ifdef NDEBUG
 313.145 -#undef DEBUG            /* NDEBUG overrides DEBUG */
 313.146 -#endif
 313.147 -
 313.148 -static struct WidgetInfo *awt_winfo = (struct WidgetInfo *) NULL;
 313.149 -static struct MenuList* menu_list = (struct MenuList*) NULL;
 313.150 -
 313.151 -#ifndef bzero
 313.152 -#define bzero(a,b) memset(a, 0, b)
 313.153 -#endif
 313.154 -
 313.155 -static jboolean syncUpdated = JNI_FALSE;
 313.156 -static jboolean syncFailed = JNI_FALSE;
 313.157 -static jint eventNumber = 0;
 313.158 -static void syncWait_eventHandler(XEvent *);
 313.159 -static Atom oops_atom = None;
 313.160 -static Atom wm_selection = None;
 313.161 -static Atom version_atom = None;
 313.162 -
 313.163 -static Boolean inSyncWait = False;
 313.164 -
 313.165 -Widget grabbed_widget = NULL;
 313.166 -
 313.167 -XtAppContext awt_appContext;
 313.168 -Widget awt_root_shell;
 313.169 -Pixel awt_defaultBg;
 313.170 -Pixel awt_defaultFg;
 313.171 -int32_t awt_multiclick_time;        /* milliseconds */
 313.172 -uint32_t awt_MetaMask = 0;
 313.173 -uint32_t awt_AltMask = 0;
 313.174 -uint32_t awt_NumLockMask = 0;
 313.175 -uint32_t awt_ModeSwitchMask = 0;
 313.176 -Cursor awt_scrollCursor;
 313.177 -Boolean  awt_ModLockIsShiftLock = False;
 313.178 -extern Boolean awt_UseType4Patch;
 313.179 -extern Boolean awt_UseXKB;
 313.180 -
 313.181 -#define SPECIAL_KEY_EVENT 2
 313.182 -
 313.183 -/* implement a "putback queue" -- see comments on awt_put_back_event() */
 313.184 -#define PUTBACK_QUEUE_MIN_INCREMENT 5   /* min size increase */
 313.185 -static XEvent *putbackQueue = NULL;     /* the queue -- next event is 0 */
 313.186 -static int32_t putbackQueueCount = 0;   /* # of events available on queue */
 313.187 -static int32_t putbackQueueCapacity = 0;        /* total capacity of queue */
 313.188 -static XtInputMask awt_events_pending(XtAppContext appContext);
 313.189 -static int32_t awt_get_next_put_back_event(XEvent *xev_out);
 313.190 -
 313.191 -#define AWT_FLUSH_TIMEOUT    ((uint32_t)100) /* milliseconds */
 313.192 -#define AWT_MIN_POLL_TIMEOUT ((uint32_t)0) /* milliseconds */
 313.193 -#define AWT_MAX_POLL_TIMEOUT ((uint32_t)250) /* milliseconds */
 313.194 -
 313.195 -#define AWT_POLL_BUFSIZE        100
 313.196 -#define AWT_READPIPE            (awt_pipe_fds[0])
 313.197 -#define AWT_WRITEPIPE           (awt_pipe_fds[1])
 313.198 -#define AWT_FLUSHOUTPUT_NOW()  \
 313.199 -{                              \
 313.200 -    XFlush(awt_display);       \
 313.201 -    awt_next_flush_time = 0LL; \
 313.202 -}
 313.203 -
 313.204 -typedef XtIntervalId (*XTFUNC)();
 313.205 -
 313.206 -static jobject  awt_MainThread = NULL;
 313.207 -static char     read_buf[AWT_POLL_BUFSIZE + 1];    /* dummy buf to empty pipe */
 313.208 -static int32_t      awt_pipe_fds[2];                   /* fds for wkaeup pipe */
 313.209 -static Boolean  awt_pipe_inited = False;           /* make sure pipe is initialized before write */
 313.210 -static int32_t      def_poll_timeout = AWT_MAX_POLL_TIMEOUT;   /* default value for timeout */
 313.211 -static jlong awt_next_flush_time = 0LL; /* 0 == no scheduled flush */
 313.212 -static void     *xt_lib = NULL;
 313.213 -static XTFUNC   xt_timeout = NULL;
 313.214 -
 313.215 -#ifdef DEBUG_AWT_LOCK
 313.216 -
 313.217 -int32_t awt_locked = 0;
 313.218 -char *lastF = "";
 313.219 -int32_t lastL = -1;
 313.220 -
 313.221 -#endif
 313.222 -
 313.223 -#ifndef NOMODALFIX
 313.224 -extern Boolean awt_isModal();
 313.225 -extern Boolean awt_isWidgetModal(Widget w);
 313.226 -#endif
 313.227 -
 313.228 -Boolean keyboardGrabbed = False;
 313.229 -
 313.230 -static uint32_t curPollTimeout = AWT_MAX_POLL_TIMEOUT;
 313.231 -
 313.232 -/* Font information to feed Motif widgets. */
 313.233 -static const char      *motifFontList;
 313.234 -static XFontSet        defaultMotifFontSet;
 313.235 -static XFontStruct     *defaultMotifFontStruct;
 313.236 -static const char *defaultMotifFont =  /* a.k.a "fixed", known everywhere */
 313.237 -        "-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1";
 313.238 -
 313.239 -XFontSet getMotifFontSet() {
 313.240 -    char    **missingList;
 313.241 -    int32_t     missingCount;
 313.242 -    char    *defChar;
 313.243 -
 313.244 -    return XCreateFontSet(awt_display, motifFontList,
 313.245 -                          &missingList, &missingCount, &defChar);
 313.246 -}
 313.247 -
 313.248 -XFontStruct *getMotifFontStruct() {
 313.249 -    return XLoadQueryFont(awt_display, defaultMotifFont);
 313.250 -}
 313.251 -
 313.252 -XmFontList getMotifFontList() {
 313.253 -    XmFontListEntry motifFontListEntry;
 313.254 -    XmFontList fontlist;
 313.255 -
 313.256 -    if (strchr(motifFontList, ',') == NULL) {
 313.257 -        /* If the default font is a single font. */
 313.258 -        if (defaultMotifFontStruct == NULL)
 313.259 -            defaultMotifFontStruct = getMotifFontStruct();
 313.260 -        motifFontListEntry = XmFontListEntryCreate(XmFONTLIST_DEFAULT_TAG,
 313.261 -                                                   XmFONT_IS_FONT,
 313.262 -                                           (XtPointer)defaultMotifFontStruct);
 313.263 -    }
 313.264 -    else {
 313.265 -        /* If the default font is multiple fonts. */
 313.266 -        if (defaultMotifFontSet == NULL)
 313.267 -            defaultMotifFontSet = getMotifFontSet();
 313.268 -            motifFontListEntry = XmFontListEntryCreate(XmFONTLIST_DEFAULT_TAG,
 313.269 -                                               XmFONT_IS_FONTSET,
 313.270 -                                               (XtPointer)defaultMotifFontSet);
 313.271 -    }
 313.272 -    fontlist = XmFontListAppendEntry(NULL, motifFontListEntry);
 313.273 -    XmFontListEntryFree(&motifFontListEntry);
 313.274 -    return fontlist;
 313.275 -}
 313.276 -
 313.277 -static void
 313.278 -awt_set_poll_timeout (uint32_t newTimeout)
 313.279 -{
 313.280 -    DTRACE_PRINTLN1("awt_set_poll_timeout(%lu)", newTimeout);
 313.281 -
 313.282 -    newTimeout = max(AWT_MIN_POLL_TIMEOUT, newTimeout);
 313.283 -    newTimeout = min(AWT_MAX_POLL_TIMEOUT, newTimeout);
 313.284 -    newTimeout = min(newTimeout, curPollTimeout);
 313.285 -    curPollTimeout = newTimeout;
 313.286 -
 313.287 -} /* awt_set_poll_timeout */
 313.288 -
 313.289 -/*
 313.290 - * Gets the best timeout for the next call to poll() or select().
 313.291 - * If timedOut is True, we assume that our previous timeout elapsed
 313.292 - * with no events/timers arriving. Therefore, we can increase the
 313.293 - * next timeout slightly.
 313.294 - */
 313.295 -static uint32_t
 313.296 -awt_get_poll_timeout( Boolean timedOut )
 313.297 -{
 313.298 -    uint32_t timeout = AWT_MAX_POLL_TIMEOUT;
 313.299 -
 313.300 -    DTRACE_PRINTLN2("awt_get_poll_timeout(%s), awt_next_flush_time:%ld",
 313.301 -        (remove?"true":"false"),
 313.302 -        awt_next_flush_time);
 313.303 -
 313.304 -    if (timedOut) {
 313.305 -        /* add 1/16 (plus 1, in case the division truncates to 0) */
 313.306 -        curPollTimeout += ((curPollTimeout>>4) + 1);
 313.307 -        curPollTimeout = min(AWT_MAX_POLL_TIMEOUT, curPollTimeout);
 313.308 -    }
 313.309 -    if (awt_next_flush_time > 0) {
 313.310 -        int32_t flushDiff = (int32_t)(awt_next_flush_time - awtJNI_TimeMillis());
 313.311 -        timeout = min(curPollTimeout, flushDiff);
 313.312 -    } else {
 313.313 -        timeout = curPollTimeout;
 313.314 -    }
 313.315 -
 313.316 -    return timeout;
 313.317 -} /* awt_get_poll_timeout() */
 313.318 -
 313.319 -static jlong
 313.320 -awtJNI_TimeMillis(void)
 313.321 -{
 313.322 -    struct timeval t;
 313.323 -
 313.324 -    gettimeofday(&t, 0);
 313.325 -
 313.326 -    return jlong_add(jlong_mul(jint_to_jlong(t.tv_sec), jint_to_jlong(1000)),
 313.327 -                     jint_to_jlong(t.tv_usec / 1000));
 313.328 -}
 313.329 -
 313.330 -static int32_t
 313.331 -xtError()
 313.332 -{
 313.333 -#ifdef DEBUG
 313.334 -    JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 313.335 -
 313.336 -    jio_fprintf(stderr, "Xt error\n");
 313.337 -    JNU_ThrowNullPointerException(env, "NullPointerException");
 313.338 -#endif
 313.339 -    return 0;
 313.340 -}
 313.341 -
 313.342 -static int32_t
 313.343 -xIOError(Display *dpy)
 313.344 -{
 313.345 -    JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 313.346 -    jclass cl = (*env)->FindClass(env, "java/lang/Thread");
 313.347 -
 313.348 -    if (errno == EPIPE) {
 313.349 -        jio_fprintf(stderr, "X connection to %s host broken (explicit kill or server shutdown)\n", XDisplayName(NULL));
 313.350 -    }
 313.351 -    AWT_NOFLUSH_UNLOCK();
 313.352 -    JVM_RaiseSignal(JVM_SIGTERM); /* Shut down cleanly */
 313.353 -    if (cl != NULL) {
 313.354 -        JVM_Sleep(env, cl, 20000);
 313.355 -    }
 313.356 -
 313.357 -    return 0; /* to keep compiler happy */
 313.358 -}
 313.359 -
 313.360 -/* Like XKeysymToKeycode, but ensures that keysym is the primary
 313.361 - * symbol on the keycode returned.  Returns zero otherwise.
 313.362 - */
 313.363 -static int32_t
 313.364 -keysym_to_keycode_if_primary(Display *dpy, KeySym sym)
 313.365 -{
 313.366 -    KeyCode code;
 313.367 -    KeySym primary;
 313.368 -
 313.369 -    code = XKeysymToKeycode(dpy, sym);
 313.370 -    if (code == 0) {
 313.371 -        return 0;
 313.372 -    }
 313.373 -
 313.374 -    primary = XKeycodeToKeysym(dpy, code, 0);
 313.375 -    if (sym == primary) {
 313.376 -        return code;
 313.377 -    } else {
 313.378 -        return 0;
 313.379 -    }
 313.380 -}
 313.381 -/*
 313.382 - * +kb or -kb ?
 313.383 - */
 313.384 -static Boolean
 313.385 -isXKBenabled(Display *display) {
 313.386 -    int mop, beve, berr;
 313.387 -    /*
 313.388 -     * NB: TODO: hope it will return False if XkbIgnoreExtension was called!
 313.389 -     */
 313.390 -    return XQueryExtension(display, "XKEYBOARD", &mop, &beve, &berr);
 313.391 -}
 313.392 -
 313.393 -
 313.394 -/* Assign meaning - alt, meta, etc. - to X modifiers mod1 ... mod5.
 313.395 - * Only consider primary symbols on keycodes attached to modifiers.
 313.396 - */
 313.397 -static void
 313.398 -setup_modifier_map(Display *disp)
 313.399 -{
 313.400 -    KeyCode metaL      = keysym_to_keycode_if_primary(disp, XK_Meta_L);
 313.401 -    KeyCode metaR      = keysym_to_keycode_if_primary(disp, XK_Meta_R);
 313.402 -    KeyCode altL       = keysym_to_keycode_if_primary(disp, XK_Alt_L);
 313.403 -    KeyCode altR       = keysym_to_keycode_if_primary(disp, XK_Alt_R);
 313.404 -    KeyCode numLock    = keysym_to_keycode_if_primary(disp, XK_Num_Lock);
 313.405 -    KeyCode modeSwitch = keysym_to_keycode_if_primary(disp, XK_Mode_switch);
 313.406 -    KeyCode shiftLock  = keysym_to_keycode_if_primary(disp, XK_Shift_Lock);
 313.407 -    KeyCode capsLock   = keysym_to_keycode_if_primary(disp, XK_Caps_Lock);
 313.408 -
 313.409 -    XModifierKeymap *modmap = NULL;
 313.410 -    int32_t nkeys, modn, i;
 313.411 -    char *ptr = NULL;
 313.412 -
 313.413 -    DTRACE_PRINTLN("In setup_modifier_map");
 313.414 -
 313.415 -    modmap = XGetModifierMapping(disp);
 313.416 -    nkeys = modmap->max_keypermod;
 313.417 -
 313.418 -    for (modn = Mod1MapIndex;
 313.419 -         (modn <= Mod5MapIndex) &&
 313.420 -             (awt_MetaMask == 0 || awt_AltMask == 0 ||
 313.421 -              awt_NumLockMask == 0 || awt_ModeSwitchMask == 0);
 313.422 -         ++modn)
 313.423 -    {
 313.424 -        static const uint32_t modmask[8] = {
 313.425 -            ShiftMask, LockMask, ControlMask,
 313.426 -            Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask
 313.427 -        };
 313.428 -
 313.429 -
 313.430 -        for (i = 0; i < nkeys; ++i) {
 313.431 -            /* for each keycode attached to this modifier */
 313.432 -            KeyCode keycode = modmap->modifiermap[modn * nkeys + i];
 313.433 -            if (keycode == 0) {
 313.434 -                continue;
 313.435 -            }
 313.436 -
 313.437 -            if (awt_MetaMask == 0 && (keycode == metaL || keycode == metaR)) {
 313.438 -                awt_MetaMask = modmask[modn];
 313.439 -                DTRACE_PRINTLN2("    awt_MetaMask       = %d, modn = %d", awt_MetaMask, modn);
 313.440 -                break;
 313.441 -            } else if (awt_AltMask == 0 && (keycode == altL || keycode == altR)) {
 313.442 -                awt_AltMask = modmask[modn];
 313.443 -                DTRACE_PRINTLN2("    awt_AltMask        = %d, modn = %d", awt_AltMask, modn);
 313.444 -                break;
 313.445 -            } else if (awt_NumLockMask == 0 && keycode == numLock) {
 313.446 -                awt_NumLockMask = modmask[modn];
 313.447 -                DTRACE_PRINTLN2("    awt_NumLockMask    = %d, modn = %d", awt_NumLockMask, modn);
 313.448 -                break;
 313.449 -            } else if (awt_ModeSwitchMask == 0 && keycode == modeSwitch) {
 313.450 -                awt_ModeSwitchMask = modmask[modn];
 313.451 -                DTRACE_PRINTLN2("    awt_ModeSwitchMask = %d, modn = %d", awt_ModeSwitchMask, modn);
 313.452 -                break;
 313.453 -            }
 313.454 -        }
 313.455 -    }
 313.456 -    for(i = 0; i < nkeys; i++) {
 313.457 -        KeyCode keycode = modmap->modifiermap[LockMapIndex * nkeys + i];
 313.458 -        if (keycode == 0) {
 313.459 -            break;
 313.460 -        }
 313.461 -        if (keycode == shiftLock) {
 313.462 -            awt_ModLockIsShiftLock = True;
 313.463 -            break;
 313.464 -        }
 313.465 -        if (keycode == capsLock) {
 313.466 -            break;
 313.467 -        }
 313.468 -    }
 313.469 -
 313.470 -    DTRACE_PRINTLN1("    ShiftMask          = %d", ShiftMask);
 313.471 -    DTRACE_PRINTLN1("    ControlMask        = %d", ControlMask);
 313.472 -
 313.473 -    XFreeModifiermap(modmap);
 313.474 -    ptr = getenv("_AWT_USE_TYPE4_PATCH");
 313.475 -    if( ptr != NULL && ptr[0] != 0 ) {
 313.476 -        if( strncmp("true", ptr, 4) == 0 ) {
 313.477 -           awt_UseType4Patch = True;
 313.478 -        }else if( strncmp("false", ptr, 5) == 0 ) {
 313.479 -           awt_UseType4Patch = False;
 313.480 -        }
 313.481 -    }
 313.482 -    awt_UseXKB = isXKBenabled(disp);
 313.483 -
 313.484 -}
 313.485 -
 313.486 -
 313.487 -Boolean scrollBugWorkAround;
 313.488 -
 313.489 -
 313.490 -void
 313.491 -awt_output_flush()
 313.492 -{
 313.493 -    char c = 'p';
 313.494 -
 313.495 -    if (awt_next_flush_time == 0)
 313.496 -    {
 313.497 -        Boolean needsWakeup = False;
 313.498 -        JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 313.499 -        if (awt_pipe_inited && (awt_get_poll_timeout(False) > (2*AWT_FLUSH_TIMEOUT))){
 313.500 -            needsWakeup = True;
 313.501 -        }
 313.502 -        /* awt_next_flush_time affects awt_get_poll_timeout(), so set
 313.503 -         * the variable *after* calling the function.
 313.504 -         */
 313.505 -        awt_next_flush_time = awtJNI_TimeMillis() + AWT_FLUSH_TIMEOUT;
 313.506 -        if (needsWakeup)
 313.507 -        {
 313.508 -            /* write to the utility pipe to wake up the event
 313.509 -             * loop, if it's sleeping
 313.510 -             */
 313.511 -            write ( AWT_WRITEPIPE, &c, 1 );
 313.512 -        }
 313.513 -    }
 313.514 -#ifdef FLUSHDEBUG
 313.515 -else
 313.516 -jio_fprintf(stderr, "!");
 313.517 -#endif
 313.518 -} /* awt_output_flush() */
 313.519 -
 313.520 -void
 313.521 -null_event_handler(Widget w, XtPointer client_data,
 313.522 -                   XEvent * event, Boolean * cont)
 313.523 -{
 313.524 -    /* do nothing */
 313.525 -}
 313.526 -
 313.527 -struct WidgetInfo *
 313.528 -findWidgetInfo(Widget widget)
 313.529 -{
 313.530 -    struct WidgetInfo *cw;
 313.531 -
 313.532 -    for (cw = awt_winfo; cw != NULL; cw = cw->next) {
 313.533 -        if (cw->widget == widget || cw->origin == widget) {
 313.534 -            return cw;
 313.535 -        }
 313.536 -    }
 313.537 -    return NULL;
 313.538 -}
 313.539 -
 313.540 -void
 313.541 -awt_addWidget(Widget w, Widget origin, void *peer, jlong event_flags)
 313.542 -{
 313.543 -    if (findWidgetInfo(w) != NULL) return;
 313.544 -
 313.545 -    if (!XtIsSubclass(w, xmFileSelectionBoxWidgetClass)) {
 313.546 -        struct WidgetInfo *nw = (struct WidgetInfo *) malloc(sizeof(struct WidgetInfo));
 313.547 -
 313.548 -        if (nw) {
 313.549 -            nw->widget     = w;
 313.550 -            nw->origin     = origin;
 313.551 -            nw->peer       = peer;
 313.552 -            nw->event_mask = event_flags;
 313.553 -            nw->next       = awt_winfo;
 313.554 -            awt_winfo      = nw;
 313.555 -
 313.556 -            if (event_flags & java_awt_AWTEvent_MOUSE_EVENT_MASK) {
 313.557 -                XtAddEventHandler(w,
 313.558 -                                  ButtonPressMask | ButtonReleaseMask |
 313.559 -                                  EnterWindowMask | LeaveWindowMask,
 313.560 -                                  False, null_event_handler, NULL);
 313.561 -                if (w != origin) {
 313.562 -                    XtAddEventHandler(origin,
 313.563 -                                      ButtonPressMask | ButtonReleaseMask |
 313.564 -                                      EnterWindowMask | LeaveWindowMask,
 313.565 -                                      False, null_event_handler, NULL);
 313.566 -                }
 313.567 -            }
 313.568 -            if (event_flags & java_awt_AWTEvent_MOUSE_MOTION_EVENT_MASK) {
 313.569 -                XtAddEventHandler(w,
 313.570 -                                  PointerMotionMask,
 313.571 -                                  False, null_event_handler, NULL);
 313.572 -                if (w != origin) {
 313.573 -                    XtAddEventHandler(origin,
 313.574 -                                      PointerMotionMask,
 313.575 -                                      False, null_event_handler, NULL);
 313.576 -                }
 313.577 -            }
 313.578 -            if (event_flags & java_awt_AWTEvent_KEY_EVENT_MASK) {
 313.579 -                XtAddEventHandler(w,
 313.580 -                                  KeyPressMask | KeyReleaseMask,
 313.581 -                                  False, null_event_handler, NULL);
 313.582 -                if (w != origin) {
 313.583 -                    XtAddEventHandler(origin,
 313.584 -                                      KeyPressMask | KeyReleaseMask,
 313.585 -                                      False, null_event_handler, NULL);
 313.586 -                }
 313.587 -            }
 313.588 -        } else {
 313.589 -            JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 313.590 -            JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
 313.591 -        }
 313.592 -
 313.593 -    }
 313.594 -}
 313.595 -
 313.596 -void
 313.597 -awt_delWidget(Widget w)
 313.598 -{
 313.599 -    struct WidgetInfo *cw;
 313.600 -
 313.601 -    if (awt_winfo != NULL) {
 313.602 -        if ((awt_winfo->widget == w) ||
 313.603 -            (awt_winfo->origin == w)) {
 313.604 -            cw = awt_winfo;
 313.605 -            awt_winfo = awt_winfo->next;
 313.606 -            free((void *) cw);
 313.607 -        } else {
 313.608 -            struct WidgetInfo *pw;
 313.609 -
 313.610 -            for (pw = awt_winfo, cw = awt_winfo->next;
 313.611 -                 cw != NULL;
 313.612 -                 pw = cw, cw = cw->next) {
 313.613 -                if ((cw->widget == w) ||
 313.614 -                    (cw->origin == w)) {
 313.615 -                    pw->next = cw->next;
 313.616 -                    free((void *) cw);
 313.617 -                    break;
 313.618 -                }
 313.619 -            }
 313.620 -        }
 313.621 -    }
 313.622 -}
 313.623 -
 313.624 -
 313.625 -void *
 313.626 -findPeer(Widget * pwidget)
 313.627 -{
 313.628 -    struct WidgetInfo   *cw;
 313.629 -    Widget widgetParent;
 313.630 -    void * peer;
 313.631 -
 313.632 -    if ((cw = findWidgetInfo(*pwidget)) != NULL) {
 313.633 -        return cw->peer;
 313.634 -    }
 313.635 -    /* fix for 4053856, robi.khan@eng
 313.636 -       couldn't find peer corresponding to widget
 313.637 -       but the widget may be child of one with
 313.638 -       a peer, so recurse up the hierarchy */
 313.639 -    widgetParent = XtParent(*pwidget);
 313.640 -    if (widgetParent != NULL ) {
 313.641 -        peer = findPeer(&widgetParent);
 313.642 -        if( peer != NULL ) {
 313.643 -        /* found peer attached to ancestor of given
 313.644 -           widget, so set widget return value as well */
 313.645 -            *pwidget = widgetParent;
 313.646 -            return peer;
 313.647 -        }
 313.648 -    }
 313.649 -
 313.650 -    return NULL;
 313.651 -}
 313.652 -
 313.653 -Boolean
 313.654 -awt_isAwtWidget(Widget widget)
 313.655 -{
 313.656 -    return (findWidgetInfo(widget) != NULL);
 313.657 -}
 313.658 -
 313.659 -
 313.660 -static Boolean
 313.661 -awt_isAwtMenuWidget(Widget wdgt) {
 313.662 -    struct MenuList* cur;
 313.663 -
 313.664 -    if (!XtIsSubclass(wdgt, xmRowColumnWidgetClass)) {
 313.665 -        return False;
 313.666 -    }
 313.667 -    for (cur = menu_list; cur != NULL; cur = cur->next) {
 313.668 -        if (cur->menu == wdgt) {
 313.669 -            return True;
 313.670 -        }
 313.671 -    }
 313.672 -    return False;
 313.673 -}
 313.674 -
 313.675 -void
 313.676 -awt_addMenuWidget(Widget wdgt) {
 313.677 -    DASSERT(XtIsSubclass(wdgt, xmRowColumnWidgetClass));
 313.678 -
 313.679 -    if (!awt_isAwtMenuWidget(wdgt)) {
 313.680 -        struct MenuList* ml = (struct MenuList*) malloc(sizeof(struct MenuList));
 313.681 -        if (ml != NULL) {
 313.682 -            ml->menu = wdgt;
 313.683 -            ml->next = menu_list;
 313.684 -            menu_list = ml;
 313.685 -        } else {
 313.686 -            JNIEnv* env = (JNIEnv*)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 313.687 -            JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
 313.688 -        }
 313.689 -    }
 313.690 -}
 313.691 -
 313.692 -void
 313.693 -awt_delMenuWidget(Widget wdgt) {
 313.694 -    struct MenuList** pp;
 313.695 -    struct MenuList* p;
 313.696 -
 313.697 -    DASSERT(XtIsSubclass(wdgt, xmRowColumnWidgetClass));
 313.698 -
 313.699 -    for (pp = &menu_list; *pp != NULL; pp = &((*pp)->next)) {
 313.700 -        if ((*pp)->menu == wdgt) {
 313.701 -            p = *pp;
 313.702 -            *pp = (*pp)->next;
 313.703 -            free((void*)p);
 313.704 -            break;
 313.705 -        }
 313.706 -    }
 313.707 -}
 313.708 -
 313.709 -
 313.710 -static Widget
 313.711 -getShellWidgetByPart(Widget part) {
 313.712 -    int i;
 313.713 -    for (i = 0; i < 3; i++) {
 313.714 -        if (part == NULL) return NULL;
 313.715 -        if (XtIsShell(part)) return part;
 313.716 -        part = XtParent(part);
 313.717 -    }
 313.718 -    return NULL;
 313.719 -}
 313.720 -
 313.721 -static Boolean
 313.722 -isTheSameShellWidget(Widget shell, Widget w) {
 313.723 -    Widget s1, s2;
 313.724 -    if (shell == NULL || w == NULL) return False;
 313.725 -    s1 = getShellWidgetByPart(shell);
 313.726 -    s2 = getShellWidgetByPart(w);
 313.727 -    if (s1 == s2 && s1 != NULL) {
 313.728 -        return True;
 313.729 -    } else {
 313.730 -        return False;
 313.731 -    }
 313.732 -}
 313.733 -
 313.734 -static Boolean
 313.735 -shouldDispatchToWidget(XEvent * xev)
 313.736 -{
 313.737 -  /* If this function returns False, that means that it has not pre-posted
 313.738 -     this event to Java. The caller will then dispatch the event to Motif,
 313.739 -     and our handlers will be called to post it to Java.
 313.740 -     If this function returns true, then this function has posted this event
 313.741 -     to java before returning. The caller will not dispatch it to Motif;
 313.742 -     it will be dispatched to Motif via the putbackQueue after it has been
 313.743 -     processed by Java */
 313.744 -
 313.745 -    Window win;
 313.746 -    Widget widget = NULL;
 313.747 -    struct WidgetInfo *winfo;
 313.748 -    void *peer = NULL;
 313.749 -    Boolean cont = FALSE;
 313.750 -
 313.751 -    switch (xev->type) {
 313.752 -        case KeyPress:
 313.753 -        case KeyRelease:
 313.754 -            win = xev->xkey.window;
 313.755 -            break;
 313.756 -        case FocusIn:
 313.757 -        case FocusOut:
 313.758 -            win = xev->xfocus.window;
 313.759 -            break;
 313.760 -        case ButtonPress:
 313.761 -        case ButtonRelease:
 313.762 -            win = xev->xbutton.window;
 313.763 -            break;
 313.764 -        case MotionNotify:
 313.765 -            win = xev->xmotion.window;
 313.766 -            break;
 313.767 -        case EnterNotify:
 313.768 -        case LeaveNotify:
 313.769 -            win = xev->xcrossing.window;
 313.770 -            break;
 313.771 -        default:
 313.772 -            return False;
 313.773 -    }
 313.774 -
 313.775 -    if ((widget = XtWindowToWidget(awt_display, win)) == NULL) {
 313.776 -        return False;
 313.777 -    }
 313.778 -
 313.779 -    if (xev->type == KeyPress || xev->type == KeyRelease) {
 313.780 -        Widget focusWidget = XmGetFocusWidget(widget);
 313.781 -
 313.782 -        /* Fix for 4328561 by ibd@sparc.spb.su
 313.783 -           If the widget is a Choice, the widget with focus is probably lying
 313.784 -           outside the current widget's sub-hierarchy, so we have to go up the
 313.785 -           hierarchy to reach it */
 313.786 -
 313.787 -        if ((focusWidget == NULL) && XmIsMenuShell(widget)) {
 313.788 -            if ((widget = XtParent(widget)) != NULL) {
 313.789 -                focusWidget = XmGetFocusWidget(widget);
 313.790 -            } else {
 313.791 -                return False;
 313.792 -            }
 313.793 -
 313.794 -            /* In this case, focus widget should be CascadeButtonGadget type,
 313.795 -               but we should send the events to its parent */
 313.796 -            if (focusWidget != NULL && XmIsCascadeButtonGadget(focusWidget)) {
 313.797 -                widget = XtParent(focusWidget);
 313.798 -            } else {
 313.799 -                /* If something went wrong, restore the original status */
 313.800 -                widget = XtWindowToWidget(awt_display, win);
 313.801 -            }
 313.802 -        }
 313.803 -
 313.804 -        /* if focus owner is null, redirect key events to focused window */
 313.805 -        if (focusWidget == NULL && findWidgetInfo(widget) == NULL) {
 313.806 -            focusWidget = findTopLevelByShell(widget);
 313.807 -        }
 313.808 -
 313.809 -        /* If we are on a non-choice widget, process events in a normal way */
 313.810 -        if ((focusWidget != NULL) && (focusWidget != widget)) {
 313.811 -            if (isTheSameShellWidget(focusWidget, widget)) {
 313.812 -                focusWidget = findTopLevelByShell(widget);
 313.813 -            }
 313.814 -            if (focusWidget != NULL) {
 313.815 -                peer = findPeer(&focusWidget);
 313.816 -            }
 313.817 -            if (peer != NULL) {
 313.818 -                widget = focusWidget;
 313.819 -                win = xev->xkey.window = XtWindow(focusWidget);
 313.820 -            }
 313.821 -        }
 313.822 -    }
 313.823 -
 313.824 -    if ((winfo = findWidgetInfo(widget)) == NULL) {
 313.825 -        return False;
 313.826 -    }
 313.827 -
 313.828 -    /*
 313.829 -     * Fix for bug 4145193
 313.830 -     *
 313.831 -     * If a menu is up (not just a popup menu), prevent awt components from
 313.832 -     * getting any events until the menu is popped down.
 313.833 -     * Before this fix, the fact that mouse/button events were
 313.834 -     * preposted to the Java event queue was causing the ButtonRelease
 313.835 -     * (needed to pop menu down) to be seen by the menu's parent and
 313.836 -     * not the menu.
 313.837 -     */
 313.838 -    if (awtMenuIsActive()) {
 313.839 -        Widget focusWidget = XmGetFocusWidget(widget);
 313.840 -
 313.841 -        if (focusWidget == NULL) {
 313.842 -            return False;
 313.843 -        }
 313.844 -
 313.845 -        /* If we are on a choice, dispatch the events to widget, but do not
 313.846 -         * dispatch the events if we are on popped up menu.
 313.847 -         */
 313.848 -        if (!XmIsRowColumn(widget) || !XmIsCascadeButtonGadget(focusWidget)) {
 313.849 -            /* Fix for 4328557 by ibd@sparc.spb.su
 313.850 -             * If we are dragging mouse from choice and are currently outside
 313.851 -             * of it, dispatch events to the choice - the source of dragging.
 313.852 -             */
 313.853 -
 313.854 -            if ((drag_source != NULL) && (widget != drag_source) &&
 313.855 -                (peer = findPeer(&drag_source))) {
 313.856 -                awt_canvas_handleEvent(drag_source, peer, xev, winfo, &cont, TRUE);
 313.857 -            }
 313.858 -            return False;
 313.859 -        }
 313.860 -    }
 313.861 -
 313.862 -    /* If the keyboard is grabbed by a popup (such as a choice) during
 313.863 -       a time when a focus proxy is in effect, the abovefocusIsOnMenu
 313.864 -       test will not detect the sitation because the focus will be on
 313.865 -       the proxy. But we need events to go to Motif first, so that the
 313.866 -       grab can be undone when appropriate. */
 313.867 -    if (keyboardGrabbed) {
 313.868 -        return False;
 313.869 -    }
 313.870 -
 313.871 -    /* If it's a keyboard event, we need to find the peer associated */
 313.872 -    /* with the widget that has the focus rather than the widget */
 313.873 -    /* associated with the window in the X event. */
 313.874 -
 313.875 -    switch (xev->type) {
 313.876 -      case KeyPress:
 313.877 -      case KeyRelease:
 313.878 -          if (!(winfo->event_mask & java_awt_AWTEvent_KEY_EVENT_MASK))
 313.879 -              return False;
 313.880 -          break;
 313.881 -        case FocusIn:
 313.882 -        case FocusOut:
 313.883 -            if (!(winfo->event_mask & java_awt_AWTEvent_FOCUS_EVENT_MASK))
 313.884 -                return False;
 313.885 -            break;
 313.886 -        case ButtonPress:
 313.887 -        case ButtonRelease:
 313.888 -            if (!(winfo->event_mask & java_awt_AWTEvent_MOUSE_EVENT_MASK)) {
 313.889 -                return False;
 313.890 -            }
 313.891 -            break;
 313.892 -        case EnterNotify:
 313.893 -        case LeaveNotify:
 313.894 -            /*
 313.895 -             * Do not post the enter/leave event if it's on a subwidget
 313.896 -             * within the component.
 313.897 -             */
 313.898 -            if (!(winfo->event_mask & java_awt_AWTEvent_MOUSE_EVENT_MASK) ||
 313.899 -                widget != winfo->origin)
 313.900 -                return False;
 313.901 -            break;
 313.902 -        case MotionNotify:
 313.903 -            if (!(winfo->event_mask & java_awt_AWTEvent_MOUSE_MOTION_EVENT_MASK))
 313.904 -                return False;
 313.905 -            break;
 313.906 -        default:
 313.907 -            return False;
 313.908 -    }
 313.909 -
 313.910 -    peer = winfo->peer;
 313.911 -
 313.912 -    /* If we found a widget and a suitable peer (either the focus
 313.913 -       peer above or the one associated with the widget then we
 313.914 -       dispatch to it. */
 313.915 -    if (peer == NULL) {
 313.916 -        return False;
 313.917 -    }
 313.918 -
 313.919 -    /*
 313.920 -     * Fix for bug 4173714 - java.awt.button behaves differently under
 313.921 -     * Win32/Solaris.
 313.922 -     * Component should not get any events when it's disabled.
 313.923 -     */
 313.924 -    if (!XtIsSensitive(widget)) {
 313.925 -        if (xev->type == EnterNotify) {
 313.926 -            updateCursor(peer, CACHE_UPDATE);
 313.927 -        }
 313.928 -        return False;
 313.929 -    }
 313.930 -
 313.931 -    awt_canvas_handleEvent(widget, peer, xev, winfo, &cont, TRUE);
 313.932 -    return (!cont);
 313.933 -} /* shouldDispatchToWidget() */
 313.934 -
 313.935 -
 313.936 -void set_toolkit_busy(Boolean busy) {
 313.937 -
 313.938 -    JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 313.939 -
 313.940 -    static jclass awtAutoShutdownClass = NULL;
 313.941 -    static jmethodID notifyBusyMethodID = NULL;
 313.942 -    static jmethodID notifyFreeMethodID = NULL;
 313.943 -
 313.944 -    if (awtAutoShutdownClass == NULL) {
 313.945 -        jclass awtAutoShutdownClassLocal = (*env)->FindClass(env, "sun/awt/AWTAutoShutdown");
 313.946 -        if ((*env)->ExceptionOccurred(env)) {
 313.947 -            (*env)->ExceptionDescribe(env);
 313.948 -            (*env)->ExceptionClear(env);
 313.949 -        }
 313.950 -        DASSERT(awtAutoShutdownClassLocal != NULL);
 313.951 -        if (awtAutoShutdownClassLocal == NULL) {
 313.952 -            return;
 313.953 -        }
 313.954 -
 313.955 -        awtAutoShutdownClass = (jclass)(*env)->NewGlobalRef(env, awtAutoShutdownClassLocal);
 313.956 -        (*env)->DeleteLocalRef(env, awtAutoShutdownClassLocal);
 313.957 -
 313.958 -        notifyBusyMethodID = (*env)->GetStaticMethodID(env, awtAutoShutdownClass,
 313.959 -                                                    "notifyToolkitThreadBusy", "()V");
 313.960 -        if ((*env)->ExceptionOccurred(env)) {
 313.961 -            (*env)->ExceptionDescribe(env);
 313.962 -            (*env)->ExceptionClear(env);
 313.963 -        }
 313.964 -        notifyFreeMethodID = (*env)->GetStaticMethodID(env, awtAutoShutdownClass,
 313.965 -                                                    "notifyToolkitThreadFree", "()V");
 313.966 -        if ((*env)->ExceptionOccurred(env)) {
 313.967 -            (*env)->ExceptionDescribe(env);
 313.968 -            (*env)->ExceptionClear(env);
 313.969 -        }
 313.970 -        DASSERT(notifyBusyMethodID != NULL);
 313.971 -        DASSERT(notifyFreeMethodID != NULL);
 313.972 -        if (notifyBusyMethodID == NULL || notifyFreeMethodID == NULL) {
 313.973 -            return;
 313.974 -        }
 313.975 -    } /* awtAutoShutdownClass == NULL*/
 313.976 -
 313.977 -    if (busy) {
 313.978 -        (*env)->CallStaticVoidMethod(env, awtAutoShutdownClass,
 313.979 -                                     notifyBusyMethodID);
 313.980 -    } else {
 313.981 -        (*env)->CallStaticVoidMethod(env, awtAutoShutdownClass,
 313.982 -                                     notifyFreeMethodID);
 313.983 -    }
 313.984 -
 313.985 -    if ((*env)->ExceptionOccurred(env)) {
 313.986 -        (*env)->ExceptionDescribe(env);
 313.987 -        (*env)->ExceptionClear(env);
 313.988 -    }
 313.989 -}
 313.990 -
 313.991 -#ifdef DEBUG
 313.992 -static int32_t debugPrintLineCount = 0;   /* limit debug output per line */
 313.993 -#endif
 313.994 -
 313.995 -/*
 313.996 - * This is the main Xt event loop for the AWT.
 313.997 - *
 313.998 - * Because java applications are multithreaded, but X and Xt
 313.999 - * are thread-dumb, we must make special considerations to
313.1000 - * make ensure that the X/Xt libraries are not entered by
313.1001 - * multiple threads simultaneously.
313.1002 - *
313.1003 - * The biggest difference between the standard Xt loop
313.1004 - * and this loop is that we go to great lengths never to block
313.1005 - * in the X libraries. We poll() on the X event pipe, waiting
313.1006 - * for events, rather than simply calling XtAppNextEvent() and
313.1007 - * blocking. If this thread were to block in XtAppNextEvent(),
313.1008 - * no other thread could enter (e.g., to perform a paint or
313.1009 - * retrieve data).
313.1010 - */
313.1011 -/* #ifdef DEBUG */
313.1012 -    int32_t  numEventsHandled = 0;
313.1013 -/* #endif */
313.1014 -static void
313.1015 -awt_MToolkit_loop(JNIEnv *env)
313.1016 -{
313.1017 -    XtInputMask iMask;
313.1018 -    int32_t  fdXPipe = -1;              /* pipe where X events arrive */
313.1019 -
313.1020 -    /* only privileged thread should be running here */
313.1021 -    DASSERT(awt_currentThreadIsPrivileged(env));
313.1022 -
313.1023 -    /* The pipe where X events arrive */
313.1024 -    fdXPipe = ConnectionNumber(awt_display) ;
313.1025 -
313.1026 -    /* We execute events while locked, unlocking only when waiting
313.1027 -     * for an event
313.1028 -     */
313.1029 -    AWT_LOCK();
313.1030 -
313.1031 -    /* Create the AWT utility pipe. See the comments on awt_pipe_init() */
313.1032 -    awt_pipe_init();
313.1033 -
313.1034 -    /*
313.1035 -     * Need to flush here in case data on the connection was read
313.1036 -     * before we acquired the monitor.
313.1037 -     *
313.1038 -     * I don't get this, but I'm too chicken to remove it. -jethro 2Sep98
313.1039 -     */
313.1040 -    AWT_FLUSHOUTPUT_NOW();
313.1041 -
313.1042 -    /*
313.1043 -     * ACTUALLY PROCESS EVENTS
313.1044 -     */
313.1045 -    while(True) {
313.1046 -
313.1047 -        /* process all events in the queue */
313.1048 -/*      #ifdef DEBUG */
313.1049 -/*          numEventsHandled = 0; */
313.1050 -/*      #endif */
313.1051 -        while (((iMask = awt_events_pending(awt_appContext)) & XtIMAll) > 0) {
313.1052 -
313.1053 -/*          #ifdef DEBUG */
313.1054 -                ++numEventsHandled;
313.1055 -/*          #endif */
313.1056 -            processOneEvent(iMask);
313.1057 -
313.1058 -        }  /* end while awt_events_pending() */
313.1059 -        /* At this point, we have exhausted the event queue */
313.1060 -
313.1061 -        /* print the number of events handled in parens */
313.1062 -        DTRACE_PRINT1("(%d events)",(int32_t)numEventsHandled);
313.1063 -#ifdef DEBUG
313.1064 -        if (++debugPrintLineCount > 8) {
313.1065 -            DTRACE_PRINTLN("");
313.1066 -            debugPrintLineCount = 0;
313.1067 -        }
313.1068 -#endif
313.1069 -
313.1070 -        AWT_NOTIFY_ALL();               /* wake up modalWait() */
313.1071 -
313.1072 -        set_toolkit_busy(False);
313.1073 -
313.1074 -        /* Here, we wait for X events, outside of the X libs. When
313.1075 -         * it's likely that an event is waiting, we process the queue
313.1076 -         */
313.1077 -        waitForEvents(env, fdXPipe, AWT_READPIPE);
313.1078 -
313.1079 -        set_toolkit_busy(True);
313.1080 -
313.1081 -    } /* while(True) */
313.1082 -
313.1083 -    /* If we ever exit the loop, must unlock the toolkit */
313.1084 -
313.1085 -} /* awt_MToolkit_loop() */
313.1086 -
313.1087 -/*
313.1088 - * Creates the AWT utility pipe. This pipe exists solely so that
313.1089 - * we can cause the main event thread to wake up from a poll() or
313.1090 - * select() by writing to this pipe.
313.1091 - */
313.1092 -static void
313.1093 -awt_pipe_init(void) {
313.1094 -
313.1095 -    if (awt_pipe_inited) {
313.1096 -        return;
313.1097 -    }
313.1098 -
313.1099 -    if ( pipe ( awt_pipe_fds ) == 0 )
313.1100 -    {
313.1101 -        /*
313.1102 -        ** the write wakes us up from the infinite sleep, which
313.1103 -        ** then we cause a delay of AWT_FLUSHTIME and then we
313.1104 -        ** flush.
313.1105 -        */
313.1106 -        int32_t flags = 0;
313.1107 -        awt_set_poll_timeout (def_poll_timeout);
313.1108 -        /* set the pipe to be non-blocking */
313.1109 -        flags = fcntl ( AWT_READPIPE, F_GETFL, 0 );
313.1110 -        fcntl( AWT_READPIPE, F_SETFL, flags | O_NDELAY | O_NONBLOCK );
313.1111 -        flags = fcntl ( AWT_WRITEPIPE, F_GETFL, 0 );
313.1112 -        fcntl( AWT_WRITEPIPE, F_SETFL, flags | O_NDELAY | O_NONBLOCK );
313.1113 -        awt_pipe_inited = True;
313.1114 -    }
313.1115 -    else
313.1116 -    {
313.1117 -        AWT_READPIPE = -1;
313.1118 -        AWT_WRITEPIPE = -1;
313.1119 -        awt_pipe_inited = False;
313.1120 -    }
313.1121 -} /* awt_pipe_init() */
313.1122 -
313.1123 -static Window
313.1124 -proxyTopLevel(Window proxyWindow) {
313.1125 -    Window parent = None, root = None, *children = NULL, retvalue = None;
313.1126 -    uint32_t nchildren = 0;
313.1127 -    Status res = XQueryTree(awt_display, proxyWindow, &root, &parent,
313.1128 -             &children, &nchildren);
313.1129 -    if (res != 0) {
313.1130 -        if (nchildren > 0) {
313.1131 -            retvalue = children[0];
313.1132 -        }
313.1133 -        else retvalue = None;
313.1134 -        if (children != NULL) {
313.1135 -            XFree(children);
313.1136 -        }
313.1137 -        return retvalue;
313.1138 -    } else {
313.1139 -        return None;
313.1140 -    }
313.1141 -}
313.1142 -
313.1143 -static jclass clazzF, clazzD = NULL;
313.1144 -
313.1145 -static Boolean
313.1146 -initClazzD(JNIEnv *env) {
313.1147 -    jclass t_clazzD = (*env)->FindClass(env, "java/awt/Dialog");
313.1148 -    if ((*env)->ExceptionOccurred(env)) {
313.1149 -        (*env)->ExceptionDescribe(env);
313.1150 -        (*env)->ExceptionClear(env);
313.1151 -    }
313.1152 -    DASSERT(t_clazzD != NULL);
313.1153 -    if (t_clazzD == NULL) {
313.1154 -        return False;
313.1155 -    }
313.1156 -    clazzD = (*env)->NewGlobalRef(env, t_clazzD);
313.1157 -    DASSERT(clazzD != NULL);
313.1158 -    (*env)->DeleteLocalRef(env, t_clazzD);
313.1159 -    return True;
313.1160 -}
313.1161 -
313.1162 -Boolean
313.1163 -isFrameOrDialog(jobject target, JNIEnv *env) {
313.1164 -    if ((*env)->EnsureLocalCapacity(env, 1) < 0) {
313.1165 -        return False;
313.1166 -    }
313.1167 -
313.1168 -    if (clazzF == NULL) {
313.1169 -        jclass t_clazzF = (*env)->FindClass(env, "java/awt/Frame");
313.1170 -        if ((*env)->ExceptionOccurred(env)) {
313.1171 -            (*env)->ExceptionDescribe(env);
313.1172 -            (*env)->ExceptionClear(env);
313.1173 -        }
313.1174 -        DASSERT(t_clazzF != NULL);
313.1175 -        if (t_clazzF == NULL) {
313.1176 -            return False;
313.1177 -        }
313.1178 -        clazzF = (*env)->NewGlobalRef(env, t_clazzF);
313.1179 -        DASSERT(clazzF != NULL);
313.1180 -        (*env)->DeleteLocalRef(env, t_clazzF);
313.1181 -    }
313.1182 -
313.1183 -    if (clazzD == NULL && !initClazzD(env)) {
313.1184 -        return False;
313.1185 -    }
313.1186 -
313.1187 -    return (*env)->IsInstanceOf(env, target, clazzF) ||
313.1188 -        (*env)->IsInstanceOf(env, target, clazzD);
313.1189 -}
313.1190 -
313.1191 -Boolean
313.1192 -isDialog(jobject target, JNIEnv *env) {
313.1193 -    if (clazzD == NULL && !initClazzD(env)) {
313.1194 -        return False;
313.1195 -    }
313.1196 -    return (*env)->IsInstanceOf(env, target, clazzD);
313.1197 -}
313.1198 -
313.1199 -// Returns a local ref to a decorated owner of the target,
313.1200 -// or NULL if the target is Frame or Dialog itself.
313.1201 -// The local ref returned should be deleted by the caller.
313.1202 -jobject
313.1203 -getOwningFrameOrDialog(jobject target, JNIEnv *env) {
313.1204 -    jobject _target = (*env)->NewLocalRef(env, target);
313.1205 -    jobject parent = _target;
313.1206 -    Boolean isSelfFrameOrDialog = True;
313.1207 -
313.1208 -    while (!isFrameOrDialog(parent, env)) {
313.1209 -        isSelfFrameOrDialog = False;
313.1210 -        parent = (*env)->CallObjectMethod(env, _target, componentIDs.getParent);
313.1211 -        (*env)->DeleteLocalRef(env, _target);
313.1212 -        _target = parent;
313.1213 -    }
313.1214 -
313.1215 -    if (isSelfFrameOrDialog) {
313.1216 -        (*env)->DeleteLocalRef(env, parent);
313.1217 -        return NULL;
313.1218 -    }
313.1219 -    return parent;
313.1220 -}
313.1221 -
313.1222 -Widget
313.1223 -findWindowsProxy(jobject window, JNIEnv *env) {
313.1224 -    struct ComponentData *cdata;
313.1225 -    jobject tlPeer;
313.1226 -    jobject owner_prev = NULL, owner_new = NULL;
313.1227 -    /* the owner of a Window is in its parent field */
313.1228 -    /* we may have a chain of Windows; go up the chain till we find the
313.1229 -       owning Frame or Dialog */
313.1230 -    if ((*env)->EnsureLocalCapacity(env, 4) < 0) {
313.1231 -        return NULL;
313.1232 -    }
313.1233 -
313.1234 -    if (window == NULL) return NULL;
313.1235 -
313.1236 -    owner_prev = (*env)->NewLocalRef(env, window);
313.1237 -    while (!JNU_IsNull(env, owner_prev) && !(isFrameOrDialog(owner_prev, env))) {
313.1238 -        owner_new = (*env)->CallObjectMethod(env, owner_prev, componentIDs.getParent);
313.1239 -        (*env)->DeleteLocalRef(env, owner_prev);
313.1240 -        owner_prev = owner_new;
313.1241 -    }
313.1242 -
313.1243 -    if (owner_prev == NULL) return NULL;
313.1244 -
313.1245 -    tlPeer = (*env)->GetObjectField(env, owner_prev, componentIDs.peer);
313.1246 -    (*env)->DeleteLocalRef(env, owner_prev);
313.1247 -    if (tlPeer == NULL) return NULL;
313.1248 -
313.1249 -    cdata = (struct ComponentData *)
313.1250 -        JNU_GetLongFieldAsPtr(env, tlPeer, mComponentPeerIDs.pData);
313.1251 -    (*env)->DeleteLocalRef(env, tlPeer);
313.1252 -
313.1253 -    if (cdata == NULL) return NULL;
313.1254 -    return(findFocusProxy(cdata->widget));
313.1255 -}
313.1256 -
313.1257 -jobject
313.1258 -findTopLevel(jobject peer, JNIEnv *env) {
313.1259 -    jobject target_prev = NULL;
313.1260 -    static jclass clazzW = NULL;
313.1261 -
313.1262 -    if ((*env)->EnsureLocalCapacity(env, 3) < 0) {
313.1263 -        return NULL;
313.1264 -    }
313.1265 -
313.1266 -    if (clazzW == NULL) {
313.1267 -        jclass t_clazzW = (*env)->FindClass(env, "java/awt/Window");
313.1268 -        if ((*env)->ExceptionOccurred(env)) {
313.1269 -            (*env)->ExceptionDescribe(env);
313.1270 -            (*env)->ExceptionClear(env);
313.1271 -        }
313.1272 -        DASSERT(t_clazzW != NULL);
313.1273 -        if (t_clazzW == NULL) {
313.1274 -            return NULL;
313.1275 -        }
313.1276 -        clazzW = (*env)->NewGlobalRef(env, t_clazzW);
313.1277 -        DASSERT(clazzW != NULL);
313.1278 -        (*env)->DeleteLocalRef(env, t_clazzW);
313.1279 -    }
313.1280 -    target_prev = (*env)->GetObjectField(env, peer, mComponentPeerIDs.target);
313.1281 -    if (target_prev == NULL) {
313.1282 -        return NULL;
313.1283 -    }
313.1284 -
313.1285 -    while ((target_prev != NULL)
313.1286 -           && !(*env)->IsInstanceOf(env, target_prev, clazzW) )
313.1287 -    {
313.1288 -        /* go up the hierarchy until we find a window */
313.1289 -        jobject target_new = (*env)->CallObjectMethod(env, target_prev, componentIDs.getParent);
313.1290 -        (*env)->DeleteLocalRef(env, target_prev);
313.1291 -        target_prev = target_new;
313.1292 -    }
313.1293 -    return target_prev;
313.1294 -}
313.1295 -
313.1296 -static Window
313.1297 -rootWindow(Window w) {
313.1298 -    Window root = None;
313.1299 -    Window parent = None;
313.1300 -    Window *children = NULL;
313.1301 -    uint32_t nchildren = 0;
313.1302 -
313.1303 -    if (w != None) {
313.1304 -        Status res = XQueryTree(awt_display, w, &root, &parent, &children, &nchildren);
313.1305 -        if (res == 0) {
313.1306 -            return None;
313.1307 -        }
313.1308 -        if (children != NULL) {
313.1309 -            XFree(children);
313.1310 -        }
313.1311 -  return root;
313.1312 -    } else {
313.1313 -        return None;
313.1314 -    }
313.1315 -}
313.1316 -
313.1317 -Boolean IsRootOf(Window root, Window child) {
313.1318 -    Window w_root = None, w_parent = None, * children = NULL;
313.1319 -    uint32_t c_count = 0;
313.1320 -    if (root == None || child == None) {
313.1321 -        return False;
313.1322 -    }
313.1323 -    do {
313.1324 -        w_root = None;
313.1325 -        w_parent = None;
313.1326 -        children = NULL;
313.1327 -        c_count = 0;
313.1328 -        if (XQueryTree(awt_display, child, &w_root, &w_parent,
313.1329 -                       &children, &c_count)) {
313.1330 -            if (children != NULL) {
313.1331 -                XFree(children);
313.1332 -            }
313.1333 -            if (w_parent == None) {
313.1334 -                return False;
313.1335 -            }
313.1336 -            if (w_parent == root) {
313.1337 -                return True;
313.1338 -            }
313.1339 -        } else {
313.1340 -            return False;
313.1341 -        }
313.1342 -        child = w_parent;
313.1343 -    } while (True);
313.1344 -}
313.1345 -
313.1346 -Window findShellByProxy(Window proxy) {
313.1347 -    Widget proxy_wid = XtWindowToWidget(awt_display, proxy);
313.1348 -    while (proxy_wid != NULL && !XtIsShell(proxy_wid)) {
313.1349 -        proxy_wid = XtParent(proxy_wid);
313.1350 -    }
313.1351 -    if (proxy_wid == NULL) {
313.1352 -        return None;
313.1353 -    }
313.1354 -    return XtWindow(proxy_wid);
313.1355 -}
313.1356 -
313.1357 -// Window which contains focus owner when focus proxy is enabled
313.1358 -Window trueFocusWindow = None;
313.1359 -// Window which works as proxy for input events for real focus owner.
313.1360 -Window focusProxyWindow = None;
313.1361 -
313.1362 -void clearFocusPathOnWindow(Window win) {
313.1363 -    if (focusProxyWindow != None && IsRootOf(win, trueFocusWindow)) {
313.1364 -        XEvent ev;
313.1365 -        memset(&ev, 0, sizeof(ev));
313.1366 -        ev.type = FocusOut;
313.1367 -        ev.xany.send_event = True;
313.1368 -        ev.xany.display = awt_display;
313.1369 -        ev.xfocus.mode = NotifyNormal;
313.1370 -        ev.xfocus.detail = NotifyNonlinear;
313.1371 -        {
313.1372 -            Window root = rootWindow(trueFocusWindow);
313.1373 -            JNIEnv *env = (JNIEnv *) JNU_GetEnv(jvm, JNI_VERSION_1_2);
313.1374 -            ev.xfocus.window = trueFocusWindow;
313.1375 -            while (ev.xfocus.window != root &&
313.1376 -                   ev.xfocus.window != None) {
313.1377 -                Widget w = XtWindowToWidget(awt_display,
313.1378 -                                            ev.xfocus.window);
313.1379 -                awt_put_back_event(env, &ev);
313.1380 -                if (w == NULL) {
313.1381 -                    break;
313.1382 -                }
313.1383 -                if (XtParent(w) != NULL) {
313.1384 -                    ev.xfocus.window = XtWindow(XtParent(w));
313.1385 -                } else {
313.1386 -                    ev.xfocus.window = None;
313.1387 -                }
313.1388 -            }
313.1389 -        }
313.1390 -        XSetInputFocus(awt_display, findShellByProxy(focusProxyWindow), RevertToPointerRoot, CurrentTime);
313.1391 -        trueFocusWindow = None;
313.1392 -        focusProxyWindow = None;
313.1393 -    }
313.1394 -}
313.1395 -void clearFocusPath(Widget shell) {
313.1396 -    Window w = None;
313.1397 -    if (shell == NULL) {
313.1398 -        return;
313.1399 -    }
313.1400 -    w = XtWindow(shell);
313.1401 -    clearFocusPathOnWindow(w);
313.1402 -}
313.1403 -
313.1404 -void globalClearFocusPath(Widget focusOwnerShell ) {
313.1405 -    if (focusProxyWindow != None) {
313.1406 -        Window shellWindow = findShellByProxy(trueFocusWindow);
313.1407 -        if (shellWindow != None) {
313.1408 -            Widget shell = XtWindowToWidget(awt_display, shellWindow);
313.1409 -            if (shell != NULL && shell != focusOwnerShell) {
313.1410 -                clearFocusPath(shell);
313.1411 -            }
313.1412 -        }
313.1413 -    }
313.1414 -}
313.1415 -
313.1416 -static void
313.1417 -focusEventForProxy(XEvent xev,
313.1418 -                   JNIEnv *env,
313.1419 -                   Window *trueFocusWindow,
313.1420 -                   Window *focusProxyWindow) {
313.1421 -
313.1422 -    DASSERT (trueFocusWindow != NULL && focusProxyWindow != NULL);
313.1423 -  if (xev.type == FocusOut) {
313.1424 -    if (xev.xfocus.window == *focusProxyWindow) {
313.1425 -            if (*trueFocusWindow != None) {
313.1426 -                Window root = rootWindow(*trueFocusWindow);
313.1427 -      focusOutEvent.xfocus.window = *trueFocusWindow;
313.1428 -#ifdef DEBUG_FOCUS
313.1429 -      printf(" nulling out proxy; putting back event"
313.1430 -             "\n");
313.1431 -#endif
313.1432 -
313.1433 -      while (focusOutEvent.xfocus.window != root &&
313.1434 -             focusOutEvent.xfocus.window != None) {
313.1435 -        Widget w = XtWindowToWidget(awt_display,
313.1436 -                                    focusOutEvent.xfocus.window);
313.1437 -        awt_put_back_event(env, &focusOutEvent);
313.1438 -        if (w != NULL && XtParent(w) != NULL) {
313.1439 -          focusOutEvent.xfocus.window = XtWindow(XtParent(w));
313.1440 -        } else {
313.1441 -          focusOutEvent.xfocus.window = None;
313.1442 -        }
313.1443 -      }
313.1444 -      *trueFocusWindow = None;
313.1445 -      *focusProxyWindow = None;
313.1446 -      return;
313.1447 -    } else {
313.1448 -#ifdef DEBUG_FOCUS
313.1449 -      printf("\n");
313.1450 -#endif
313.1451 -      return;
313.1452 -    }
313.1453 -  } else {
313.1454 -#ifdef DEBUG_FOCUS
313.1455 -    printf("\n");
313.1456 -#endif
313.1457 -    return;
313.1458 -  }
313.1459 -    }
313.1460 -}
313.1461 -
313.1462 -static void
313.1463 -focusEventForFrame(XEvent xev, Window focusProxyWindow) {
313.1464 -  if (xev.type == FocusIn) {
313.1465 -    if (focusProxyWindow != None) {
313.1466 -      /* eat it */
313.1467 -      return;
313.1468 -    } else /* FocusIn on Frame or Dialog */ {
313.1469 -      XtDispatchEvent(&xev);
313.1470 -    }
313.1471 -  } else /* FocusOut on Frame or Dialog */{
313.1472 -    XtDispatchEvent(&xev);
313.1473 -  }
313.1474 -}
313.1475 -
313.1476 -static void
313.1477 -focusEventForWindow(XEvent xev, JNIEnv *env, Window *trueFocusWindow,
313.1478 -                    Window *focusProxyWindow, jobject target) {
313.1479 -  XEvent pev;
313.1480 -  if (xev.type == FocusIn && xev.xfocus.mode == NotifyNormal) {
313.1481 -    /* If it's a FocusIn, allow it to process, then set
313.1482 -       focus to focus proxy */
313.1483 -    Widget focusProxy;
313.1484 -    focusProxy = findWindowsProxy(target, env);
313.1485 -    if (focusProxy != NULL) {
313.1486 -      XtDispatchEvent(&xev);
313.1487 -      *focusProxyWindow = XtWindow(focusProxy);
313.1488 -
313.1489 -      XSetInputFocus(awt_display, *focusProxyWindow,
313.1490 -                     RevertToParent,
313.1491 -                     CurrentTime);
313.1492 -
313.1493 -      XPeekEvent(awt_display, &pev);
313.1494 -      while (pev.type == FocusIn) {
313.1495 -        XNextEvent(awt_display, &xev);
313.1496 -        XPeekEvent(awt_display, &pev);
313.1497 -      }
313.1498 -      *trueFocusWindow = xev.xany.window;
313.1499 -
313.1500 -    } /* otherwise error */
313.1501 -  } else /* FocusOut */ {
313.1502 -    /* If it's a FocusOut on a Window, discard it unless
313.1503 -       it's an event generated by us. */
313.1504 -    if (xev.xany.send_event) {
313.1505 -      XtDispatchEvent(&xev);
313.1506 -    }
313.1507 -  }
313.1508 -}
313.1509 -
313.1510 -Boolean
313.1511 -isAncestor(Window ancestor, Window child) {
313.1512 -  Window *children;
313.1513 -  uint32_t nchildren;
313.1514 -  Boolean retvalue = False;
313.1515 -
313.1516 -  while (child != ancestor) {
313.1517 -    Window parent, root;
313.1518 -    Status status;
313.1519 -
313.1520 -    status = XQueryTree(awt_display, child, &root, &parent,
313.1521 -                        &children, &nchildren);
313.1522 -    if (status == 0) return False; /* should be an error of some sort? */
313.1523 -
313.1524 -    if (parent == root) {
313.1525 -      if (child != ancestor) {
313.1526 -        retvalue = False;
313.1527 -        break;
313.1528 -      } else {
313.1529 -        retvalue = True;
313.1530 -        break;
313.1531 -      }
313.1532 -    }
313.1533 -    if (parent == ancestor) { retvalue = True; break; }
313.1534 -    if (nchildren > 0) XFree(children);
313.1535 -    child = parent;
313.1536 -  }
313.1537 -  if (nchildren > 0) XFree(children);
313.1538 -  return retvalue;
313.1539 -}
313.1540 -
313.1541 -/**
313.1542 - * Returns focusability of the corresponding Java Window object
313.1543 - */
313.1544 -Boolean
313.1545 -isFocusableWindow(Window w) {
313.1546 -    Widget wid = NULL;
313.1547 -    JNIEnv *env = (JNIEnv *) JNU_GetEnv(jvm, JNI_VERSION_1_2);
313.1548 -
313.1549 -    wid = XtWindowToWidget(awt_display, w);
313.1550 -    while (wid != NULL && !XtIsShell(wid)) {
313.1551 -        wid = XtParent(wid);
313.1552 -    }
313.1553 -
313.1554 -    // If the window doesn't have shell consider it focusable as all windows
313.1555 -    // are focusable by default
313.1556 -    if (wid == NULL) return True;
313.1557 -
313.1558 -    return isFocusableWindowByShell(env, wid);
313.1559 -}
313.1560 -
313.1561 -void postUngrabEvent(Widget shell) {
313.1562 -    JNIEnv *env = (JNIEnv *) JNU_GetEnv(jvm, JNI_VERSION_1_2);
313.1563 -    Widget canvas = findTopLevelByShell(shell);
313.1564 -    if (canvas != NULL) {
313.1565 -        jobject peer = findPeer(&canvas);
313.1566 -        if (peer != NULL) {
313.1567 -            JNU_CallMethodByName(env, NULL, peer, "postUngrabEvent", "()V", NULL);
313.1568 -        }
313.1569 -    }
313.1570 -}
313.1571 -
313.1572 -Boolean eventInsideGrabbed(XEvent * ev) {
313.1573 -    if (grabbed_widget == NULL) {
313.1574 -        return False;
313.1575 -    }
313.1576 -
313.1577 -    switch (ev->xany.type) {
313.1578 -      case LeaveNotify:
313.1579 -      case ButtonPress:
313.1580 -      case ButtonRelease:
313.1581 -      case MotionNotify:
313.1582 -      case EnterNotify:
313.1583 -      {
313.1584 -          JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
313.1585 -          Widget grab = findTopLevelByShell(grabbed_widget);
313.1586 -          if (grab != NULL) {
313.1587 -              jobject peer = findPeer(&grab);
313.1588 -              Widget target = XtWindowToWidget(awt_display, ev->xbutton.window);
313.1589 -              jobject targetPeer = findPeer(&target);
313.1590 -              if (peer != NULL) {
313.1591 -                  return JNU_CallMethodByName(env, NULL, peer, "processUngrabMouseEvent", "(Lsun/awt/motif/MComponentPeer;III)Z",
313.1592 -                                              targetPeer, ev->xbutton.x_root, ev->xbutton.y_root,
313.1593 -                                              ev->xany.type, NULL).z;
313.1594 -              }
313.1595 -          }
313.1596 -          return False;
313.1597 -      }
313.1598 -      case FocusOut:
313.1599 -          if (ev->xfocus.window == XtWindow(grabbed_widget) ||
313.1600 -              isAncestor(XtWindow(grabbed_widget), ev->xfocus.window))
313.1601 -          {
313.1602 -              postUngrabEvent(grabbed_widget);
313.1603 -              return True;
313.1604 -          }
313.1605 -      default:
313.1606 -          return True;
313.1607 -    }
313.1608 -}
313.1609 -
313.1610 -/**
313.1611 - * Processes and removes one X/Xt event from the Xt event queue.
313.1612 - * Handles events pushed back via awt_put_back_event() FIRST,
313.1613 - * then new events on the X queue
313.1614 - */
313.1615 -static void
313.1616 -processOneEvent(XtInputMask iMask) {
313.1617 -            XEvent xev;
313.1618 -            Boolean haveEvent = False;
313.1619 -            if (putbackQueueCount > 0) {
313.1620 -                // There is a pushed-back event - handle it first
313.1621 -                if (awt_get_next_put_back_event(&xev) == 0) {
313.1622 -                    if (xev.xany.send_event != SPECIAL_KEY_EVENT) {
313.1623 -#ifdef DEBUG_FOCUS
313.1624 -                        if (xev.type == FocusOut) {
313.1625 -                            printf("putback FocusOut on window %d, mode %d, "
313.1626 -                                   "detail %d, send_event  %d\n",
313.1627 -                                   xev.xfocus.window, xev.xfocus.mode,
313.1628 -                                   xev.xfocus.detail, xev.xfocus.send_event);
313.1629 -                        }
313.1630 -#endif
313.1631 -                        eventNumber++;
313.1632 -                        XtDispatchEvent(&xev);
313.1633 -                        return;
313.1634 -                    } else {
313.1635 -                        haveEvent = True;
313.1636 -                    }
313.1637 -                }
313.1638 -            }
313.1639 -
313.1640 -            if (haveEvent || XtAppPeekEvent(awt_appContext, &xev)) {
313.1641 -             /*
313.1642 -              * Fix for BugTraq ID 4041235, 4100167:
313.1643 -              * First check that the event still has a widget, because
313.1644 -              * the widget may have been destroyed by another thread.
313.1645 -              */
313.1646 -              Widget widget=XtWindowToWidget(awt_display, xev.xany.window);
313.1647 -              eventNumber++;
313.1648 -#ifdef __linux__
313.1649 -              statusWindowEventHandler(xev);
313.1650 -#endif
313.1651 -              xembed_eventHandler(&xev);
313.1652 -              xembed_serverEventHandler(&xev);
313.1653 -              syncWait_eventHandler(&xev);
313.1654 -
313.1655 -              if (!haveEvent && awt_dnd_process_event(&xev)) {
313.1656 -                  return;
313.1657 -              }
313.1658 -
313.1659 -              if ((widget == NULL) || (!XtIsObject(widget)) ||
313.1660 -                  (widget->core.being_destroyed)) {
313.1661 -                /*
313.1662 -                 * if we get here, the event could be one of
313.1663 -                 * the following:
313.1664 -                 * - notification that a "container" of
313.1665 -                 *    any of our embedded frame has been moved
313.1666 -                 * - event understandable by XFilterEvent
313.1667 -                 * - for one of our old widget which has gone away
313.1668 -                 */
313.1669 -                XNextEvent(awt_display, &xev);
313.1670 -
313.1671 -                if (widget == NULL) {
313.1672 -                    /* an embedded frame container has been moved? */
313.1673 -                    if (awt_util_processEventForEmbeddedFrame(&xev)) {
313.1674 -                        return;
313.1675 -                    }
313.1676 -
313.1677 -                    /* manager selections related event? */
313.1678 -                    if (awt_mgrsel_processEvent(&xev)) {
313.1679 -                        return;
313.1680 -                    }
313.1681 -                }
313.1682 -
313.1683 -                /*
313.1684 -                 * Fix for BugTraq ID 4196573:
313.1685 -                 * Call XFilterEvent() to give a chance to X Input
313.1686 -                 * Method to process this event before being
313.1687 -                 * discarded.
313.1688 -                 */
313.1689 -                (void) XFilterEvent(&xev, NULL);
313.1690 -                return;
313.1691 -              }
313.1692 -
313.1693 -              /* There is an X event on the queue. */
313.1694 -              switch (xev.type) {
313.1695 -              case KeyPress:
313.1696 -              case KeyRelease:
313.1697 -              case ButtonPress:
313.1698 -              case ButtonRelease:
313.1699 -              case MotionNotify:
313.1700 -              case EnterNotify:
313.1701 -              case LeaveNotify:
313.1702 -                /* Fix for BugTraq ID 4048060. Dispatch scrolling events
313.1703 -                   immediately to the ScrollBar widget to prevent spurious
313.1704 -                   continuous scrolling. Otherwise, if the application is busy,
313.1705 -                   the ButtonRelease event is not dispatched in time to prevent
313.1706 -                   a ScrollBar timeout from expiring, and restarting the
313.1707 -                   continuous scrolling timer.
313.1708 -                   */
313.1709 -                  if ((xev.type == ButtonPress                          ||
313.1710 -                       xev.type == ButtonRelease                                ||
313.1711 -                       (xev.type == MotionNotify                                &&
313.1712 -                        (xev.xmotion.state == Button1Mask                       ||
313.1713 -                         xev.xmotion.state == Button2Mask                       ||
313.1714 -                         xev.xmotion.state == Button3Mask)))            &&
313.1715 -                      (XtIsSubclass(widget, xmScrollBarWidgetClass))) {
313.1716 -                      /* Use XNextEvent instead of XtAppNextEvent, because
313.1717 -                         XtAppNextEvent processes timers before getting the next X
313.1718 -                         event, causing a race condition, since the TimerEvent
313.1719 -                         callback in the ScrollBar widget restarts the continuous
313.1720 -                         scrolling timer.
313.1721 -                      */
313.1722 -                      XNextEvent(awt_display, &xev);
313.1723 -
313.1724 -                      XtDispatchEvent(&xev);
313.1725 -                      XSync(awt_display, False);
313.1726 -
313.1727 -                      // This is the event on scrollbar.  Key, Motion,
313.1728 -                      // Enter/Leave dispatch as usual, Button should
313.1729 -                      // generate Ungrab after Java mouse event
313.1730 -                      if (xev.type == ButtonPress && grabbed_widget != NULL) {
313.1731 -                          eventInsideGrabbed(&xev);
313.1732 -                      }
313.1733 -                  }
313.1734 -                  else {
313.1735 -                      if (!haveEvent) XtAppNextEvent(awt_appContext, &xev);
313.1736 -
313.1737 -                      // This is an event on one of our widgets.  Key,
313.1738 -                      // Motion, Enter/Leave dispatch as usual, Button
313.1739 -                      // should generate Ungrab after Java mouse event
313.1740 -/*                       if (grabbed_widget != NULL && !eventInsideGrabbed(&xev)) { */
313.1741 -/*                           return; */
313.1742 -/*                       } */
313.1743 -
313.1744 -                      if (xev.type == ButtonPress) {
313.1745 -                          Window window = findShellByProxy(xev.xbutton.window);
313.1746 -                          if (window != None) {
313.1747 -                              XWindowAttributes winAttr;
313.1748 -                              memset(&winAttr, 0, sizeof(XWindowAttributes));
313.1749 -                              XGetWindowAttributes(awt_display, window, &winAttr);
313.1750 -                              if (winAttr.override_redirect == TRUE && isFocusableWindow(window)) {
313.1751 -                                  XSetInputFocus(awt_display, window, RevertToPointerRoot, CurrentTime);
313.1752 -                              }
313.1753 -                          }
313.1754 -                      }
313.1755 -                      if(xev.type == KeyPress) {
313.1756 -#ifdef DEBUG_FOCUS
313.1757 -                          printf("KeyPress on window %d\n", xev.xany.window);
313.1758 -#endif
313.1759 -                      }
313.1760 -
313.1761 -                    /* this could be moved to shouldDispatchToWidget */
313.1762 -                    /* if there is a proxy in effect, dispatch key events
313.1763 -                       through the proxy */
313.1764 -                    if ((xev.type == KeyPress || xev.type == KeyRelease) &&
313.1765 -                        !keyboardGrabbed && !haveEvent) {
313.1766 -                        if (focusProxyWindow != None) {
313.1767 -                            Widget widget;
313.1768 -                            struct WidgetInfo *winfo;
313.1769 -                            Boolean cont;
313.1770 -                            /* Key event should be posted to the top-level
313.1771 -                               widget of the proxy */
313.1772 -                            xev.xany.window = proxyTopLevel(focusProxyWindow);
313.1773 -                            widget = XtWindowToWidget(awt_display,
313.1774 -                                                      xev.xany.window);
313.1775 -                            if (widget == NULL) return;
313.1776 -                            if ((winfo = findWidgetInfo(widget)) == NULL) {
313.1777 -                                return;
313.1778 -                            }
313.1779 -                            awt_canvas_handleEvent(widget, winfo->peer, &xev,
313.1780 -                                                   winfo, &cont, TRUE);
313.1781 -                            return;
313.1782 -                        }
313.1783 -                    }
313.1784 -                    if (!shouldDispatchToWidget(&xev)) {
313.1785 -                        XtDispatchEvent(&xev);
313.1786 -                    }
313.1787 -
313.1788 -                    // See comment above - "after time" is here.
313.1789 -                    if (grabbed_widget != NULL && xev.type == ButtonPress) {
313.1790 -                        eventInsideGrabbed(&xev);
313.1791 -                    }
313.1792 -                }
313.1793 -
313.1794 -
313.1795 -              break;
313.1796 -
313.1797 -              case FocusIn:
313.1798 -              case FocusOut: {
313.1799 -                  void *peer;
313.1800 -                  jobject target;
313.1801 -
313.1802 -                  JNIEnv *env = (JNIEnv *) JNU_GetEnv(jvm, JNI_VERSION_1_2);
313.1803 -
313.1804 -#ifdef DEBUG_FOCUS
313.1805 -                  if (xev.type == FocusIn) {
313.1806 -
313.1807 -                      fprintf(stderr, "FocusIn on window %x, mode %d, detail %d, "
313.1808 -                             "send_event %d\n", xev.xfocus.window,
313.1809 -                             xev.xfocus.mode, xev.xfocus.detail,
313.1810 -                             xev.xfocus.send_event);
313.1811 -                  } else {
313.1812 -                      fprintf(stderr, "FocusOut on window %x, mode %d, detail %d, "
313.1813 -                             "send_event %d\n", xev.xfocus.window,
313.1814 -                             xev.xfocus.mode, xev.xfocus.detail,
313.1815 -                             xev.xfocus.send_event);
313.1816 -                  }
313.1817 -#endif
313.1818 -                  XtAppNextEvent(awt_appContext, &xev);
313.1819 -
313.1820 -                  if (xev.xfocus.detail == NotifyVirtual ||
313.1821 -                      xev.xfocus.detail == NotifyNonlinearVirtual) {
313.1822 -#ifdef DEBUG_FOCUS
313.1823 -                      printf("discarding\n");
313.1824 -#endif
313.1825 -                      return;
313.1826 -                  }
313.1827 -
313.1828 -                  // Check for xembed on this window. If it is active and this is not XEmbed focus
313.1829 -                  // event(send_event = 0) then we should skip it
313.1830 -                  if (isXEmbedActiveByWindow(xev.xfocus.window) && !xev.xfocus.send_event) {
313.1831 -                      return;
313.1832 -                  }
313.1833 -
313.1834 -                  /* In general, we need to to block out focus events
313.1835 -                     that are caused by keybaord grabs initiated by
313.1836 -                     dragging the title bar or the scrollbar. But we
313.1837 -                     need to let through the ones that are aimed at
313.1838 -                     choice boxes or menus. So we keep track of when
313.1839 -                     the keyboard is grabbed by a popup. */
313.1840 -
313.1841 -                  if (awt_isAwtMenuWidget(widget)) {
313.1842 -                    if (xev.type == FocusIn &&
313.1843 -                        xev.xfocus.mode == NotifyGrab) {
313.1844 -                          extern Boolean poppingDown;
313.1845 -                          if (!poppingDown) {
313.1846 -                      keyboardGrabbed = True;
313.1847 -                           }
313.1848 -                      } else /* FocusOut */ {
313.1849 -                          if (xev.type == FocusOut &&
313.1850 -                              xev.xfocus.mode == NotifyUngrab) {
313.1851 -                        keyboardGrabbed = False;
313.1852 -                      }
313.1853 -                    }
313.1854 -                  }
313.1855 -
313.1856 -                  if (focusProxyWindow != None) {
313.1857 -#ifdef DEBUG_FOCUS
313.1858 -                      printf("non-null proxy; proxy = %d ", focusProxyWindow);
313.1859 -#endif
313.1860 -                      if (trueFocusWindow != None) {
313.1861 -                        /* trueFocusWindow should never be None here, but if
313.1862 -                           things ever get skewed, we want to be able to
313.1863 -                           recover rather than crash */
313.1864 -                        focusEventForProxy(xev, env, &trueFocusWindow,
313.1865 -                                           &focusProxyWindow);
313.1866 -                      return;
313.1867 -                      } else {
313.1868 -                        /* beartrap -- remove before shipping */
313.1869 -                        /* printf("trueFocusWindow None in processOneEvent;\n"); */
313.1870 -                        /* printf("Please file a bug\n"); */
313.1871 -                      }
313.1872 -                  }
313.1873 -
313.1874 -                  peer = findPeer(&widget);
313.1875 -                  if (peer == NULL) {
313.1876 -#ifdef DEBUG_FOCUS
313.1877 -                      printf("null peer -- shouldn't see in java handler\n");
313.1878 -#endif
313.1879 -                      XtDispatchEvent(&xev);
313.1880 -                      return;
313.1881 -                  }
313.1882 -
313.1883 -                  /* Find the top-level component */
313.1884 -
313.1885 -                  if ((*env)->EnsureLocalCapacity(env, 1) < 0) {
313.1886 -                    return;
313.1887 -                  }
313.1888 -                  target = findTopLevel(peer, env);
313.1889 -                  if (target == NULL) {
313.1890 -                      JNU_ThrowNullPointerException(env, "component without a "
313.1891 -                                                    "window");
313.1892 -                      return;
313.1893 -                  }
313.1894 -
313.1895 -                  if (isFrameOrDialog(target, env)) {
313.1896 -#ifdef DEBUG_FOCUS
313.1897 -                      printf("Focus event directed at a frame; frame = %d\n",
313.1898 -                             xev.xany.window);
313.1899 -#endif
313.1900 -                      focusEventForFrame(xev, focusProxyWindow);
313.1901 -                      (*env)->DeleteLocalRef(env, target);
313.1902 -                      return;
313.1903 -                  } else {
313.1904 -#ifdef DEBUG_FOCUS
313.1905 -                      printf("Focus event directed at a window; window = %d\n",
313.1906 -                             xev.xany.window);
313.1907 -#endif
313.1908 -                      focusEventForWindow(xev, env, &trueFocusWindow,
313.1909 -                                          &focusProxyWindow, target);
313.1910 -                      (*env)->DeleteLocalRef(env, target);
313.1911 -                      return;
313.1912 -                  }
313.1913 -              }
313.1914 -
313.1915 -              case UnmapNotify:
313.1916 -#ifdef DEBUG_FOCUS
313.1917 -                printf("Unmap on window %d\n", xev.xany.window);
313.1918 -                printf("True focus window is %d\n", trueFocusWindow);
313.1919 -#endif
313.1920 -                clearFocusPathOnWindow(xev.xunmap.window);
313.1921 -
313.1922 -              default:
313.1923 -                XtAppProcessEvent(awt_appContext, iMask);
313.1924 -                break;
313.1925 -              }
313.1926 -            }
313.1927 -            else {
313.1928 -              /* There must be a timer, alternate input, or signal event. */
313.1929 -              XtAppProcessEvent(awt_appContext, iMask & ~XtIMXEvent);
313.1930 -            }
313.1931 -
313.1932 -} /* processOneEvent() */
313.1933 -
313.1934 -/*
313.1935 - * Waits for X/Xt events to appear on the pipe. Returns only when
313.1936 - * it is likely (but not definite) that there are events waiting to
313.1937 - * be processed.
313.1938 - *
313.1939 - * This routine also flushes the outgoing X queue, when the
313.1940 - * awt_next_flush_time has been reached.
313.1941 - *
313.1942 - * If fdAWTPipe is greater or equal than zero the routine also
313.1943 - * checks if there are events pending on the putback queue.
313.1944 - */
313.1945 -void
313.1946 -waitForEvents(JNIEnv *env, int32_t fdXPipe, int32_t fdAWTPipe) {
313.1947 -
313.1948 -        while ((fdAWTPipe >= 0 && awt_events_pending(awt_appContext) == 0) ||
313.1949 -               (fdAWTPipe <  0 && XtAppPending(awt_appContext) == 0)) {
313.1950 -#ifdef USE_SELECT
313.1951 -            performSelect(env,fdXPipe,fdAWTPipe);
313.1952 -#else
313.1953 -            performPoll(env,fdXPipe,fdAWTPipe);
313.1954 -#endif
313.1955 -            if ((awt_next_flush_time > 0) &&
313.1956 -                (awtJNI_TimeMillis() > awt_next_flush_time)) {
313.1957 -                AWT_FLUSHOUTPUT_NOW();
313.1958 -            }
313.1959 -        }  /* end while awt_events_pending() == 0 */
313.1960 -} /* waitForEvents() */
313.1961 -
313.1962 -/*************************************************************************
313.1963 - **                                                                     **
313.1964 - ** WE USE EITHER select() OR poll(), DEPENDING ON THE USE_SELECT       **
313.1965 - ** COMPILE-TIME CONSTANT.                                              **
313.1966 - **                                                                     **
313.1967 - *************************************************************************/
313.1968 -
313.1969 -#ifdef USE_SELECT
313.1970 -
313.1971 -static struct fd_set rdset;
313.1972 -struct timeval sel_time;
313.1973 -
313.1974 -/*
313.1975 - * Performs select() on both the X pipe and our AWT utility pipe.
313.1976 - * Returns when data arrives or the operation times out.
313.1977 - *
313.1978 - * Not all Xt events come across the X pipe (e.g., timers
313.1979 - * and alternate inputs), so we must time out every now and
313.1980 - * then to check the Xt event queue.
313.1981 - *
313.1982 - * The fdAWTPipe will be empty when this returns.
313.1983 - */
313.1984 -static void
313.1985 -performSelect(JNIEnv *env, int32_t fdXPipe, int32_t fdAWTPipe) {
313.1986 -
313.1987 -            int32_t result;
313.1988 -            int32_t count;
313.1989 -            int32_t nfds = 1;
313.1990 -            uint32_t timeout = awt_get_poll_timeout(False);
313.1991 -
313.1992 -            /* Fixed 4250354 7/28/99 ssi@sparc.spb.su
313.1993 -             * Cleaning up Global Refs in case of No Events
313.1994 -             */
313.1995 -            awtJNI_CleanupGlobalRefs();
313.1996 -
313.1997 -            FD_ZERO( &rdset );
313.1998 -            FD_SET(fdXPipe, &rdset);
313.1999 -            if (fdAWTPipe >= 0) {
313.2000 -                nfds++;
313.2001 -                FD_SET(fdAWTPipe, &rdset);
313.2002 -            }
313.2003 -            if (timeout == 0) {
313.2004 -                // be sure other threads get a chance
313.2005 -                awtJNI_ThreadYield(env);
313.2006 -            }
313.2007 -            // set the appropriate time values. The DASSERT() in
313.2008 -            // MToolkit_run() makes sure that this will not overflow
313.2009 -            sel_time.tv_sec = (timeout * 1000) / (1000 * 1000);
313.2010 -            sel_time.tv_usec = (timeout * 1000) % (1000 * 1000);
313.2011 -            AWT_NOFLUSH_UNLOCK();
313.2012 -            result = select(nfds, &rdset, 0, 0, &sel_time);
313.2013 -            AWT_LOCK();
313.2014 -
313.2015 -            /* reset tick if this was not a time out */
313.2016 -            if (result == 0) {
313.2017 -                /* select() timed out -- update timeout value */
313.2018 -                awt_get_poll_timeout(True);
313.2019 -            }
313.2020 -            if (fdAWTPipe >= 0 && FD_ISSET ( fdAWTPipe, &rdset ) )
313.2021 -            {
313.2022 -                /* There is data on the AWT pipe - empty it */
313.2023 -                do {
313.2024 -                    count = read(fdAWTPipe, read_buf, AWT_POLL_BUFSIZE );
313.2025 -                } while (count == AWT_POLL_BUFSIZE );
313.2026 -            }
313.2027 -} /* performSelect() */
313.2028 -
313.2029 -#else /* !USE_SELECT */
313.2030 -
313.2031 -/*
313.2032 - * Polls both the X pipe and our AWT utility pipe. Returns
313.2033 - * when there is data on one of the pipes, or the operation times
313.2034 - * out.
313.2035 - *
313.2036 - * Not all Xt events come across the X pipe (e.g., timers
313.2037 - * and alternate inputs), so we must time out every now and
313.2038 - * then to check the Xt event queue.
313.2039 - *
313.2040 - * The fdAWTPipe will be empty when this returns.
313.2041 - */
313.2042 -static void
313.2043 -performPoll(JNIEnv *env, int32_t fdXPipe, int32_t fdAWTPipe) {
313.2044 -
313.2045 -            static struct pollfd pollFds[2];
313.2046 -            uint32_t timeout = awt_get_poll_timeout(False);
313.2047 -            int32_t result;
313.2048 -            int32_t count;
313.2049 -
313.2050 -            /* Fixed 4250354 7/28/99 ssi@sparc.spb.su
313.2051 -             * Cleaning up Global Refs in case of No Events
313.2052 -             */
313.2053 -            awtJNI_CleanupGlobalRefs();
313.2054 -
313.2055 -            pollFds[0].fd = fdXPipe;
313.2056 -            pollFds[0].events = POLLRDNORM;
313.2057 -            pollFds[0].revents = 0;
313.2058 -
313.2059 -            pollFds[1].fd = fdAWTPipe;
313.2060 -            pollFds[1].events = POLLRDNORM;
313.2061 -            pollFds[1].revents = 0;
313.2062 -
313.2063 -            AWT_NOFLUSH_UNLOCK();
313.2064 -
313.2065 -            /* print the poll timeout time in brackets */
313.2066 -            DTRACE_PRINT1("[%dms]",(int32_t)timeout);
313.2067 -#ifdef DEBUG
313.2068 -            if (++debugPrintLineCount > 8) {
313.2069 -                DTRACE_PRINTLN("");
313.2070 -                debugPrintLineCount = 0;
313.2071 -            }
313.2072 -#endif
313.2073 -            /* ACTUALLY DO THE POLL() */
313.2074 -            if (timeout == 0) {
313.2075 -                // be sure other threads get a chance
313.2076 -                awtJNI_ThreadYield(env);
313.2077 -            }
313.2078 -            result = poll( pollFds, 2, (int32_t) timeout );
313.2079 -
313.2080 -#ifdef DEBUG
313.2081 -            DTRACE_PRINT1("[poll()->%d]", result);
313.2082 -            if (++debugPrintLineCount > 8) {
313.2083 -                DTRACE_PRINTLN("");
313.2084 -                debugPrintLineCount = 0;
313.2085 -            }
313.2086 -#endif
313.2087 -            AWT_LOCK();
313.2088 -            if (result == 0) {
313.2089 -                /* poll() timed out -- update timeout value */
313.2090 -                awt_get_poll_timeout(True);
313.2091 -            }
313.2092 -            if ( pollFds[1].revents )
313.2093 -            {
313.2094 -                /* There is data on the AWT pipe - empty it */
313.2095 -                do {
313.2096 -                    count = read(AWT_READPIPE, read_buf, AWT_POLL_BUFSIZE );
313.2097 -                } while (count == AWT_POLL_BUFSIZE );
313.2098 -                DTRACE_PRINTLN1("wokeup on AWTPIPE, timeout:%d", timeout);
313.2099 -            }
313.2100 -            return;
313.2101 -
313.2102 -} /* performPoll() */
313.2103 -
313.2104 -#endif /* !USE_SELECT */
313.2105 -
313.2106 -/*
313.2107 - * Pushes an X event back on the queue to be handled
313.2108 - * later.
313.2109 - *
313.2110 - * Ignores the request if event is NULL
313.2111 - */
313.2112 -void
313.2113 -awt_put_back_event(JNIEnv *env, XEvent *event) {
313.2114 -
313.2115 -    Boolean addIt = True;
313.2116 -    if (putbackQueueCount >= putbackQueueCapacity) {
313.2117 -        /* not enough room - alloc 50% more space */
313.2118 -        int32_t newCapacity;
313.2119 -        XEvent *newQueue;
313.2120 -        newCapacity = putbackQueueCapacity * 3 / 2;
313.2121 -        if ((newCapacity - putbackQueueCapacity)
313.2122 -                                        < PUTBACK_QUEUE_MIN_INCREMENT) {
313.2123 -            /* always increase by at least min increment */
313.2124 -            newCapacity = putbackQueueCapacity + PUTBACK_QUEUE_MIN_INCREMENT;
313.2125 -        }
313.2126 -        newQueue = (XEvent*)realloc(
313.2127 -                        putbackQueue, newCapacity*(sizeof(XEvent)));
313.2128 -        if (newQueue == NULL) {
313.2129 -            JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
313.2130 -            addIt = False;
313.2131 -        } else {
313.2132 -            putbackQueue = newQueue;
313.2133 -            putbackQueueCapacity = newCapacity;
313.2134 -        }
313.2135 -    }
313.2136 -    if (addIt) {
313.2137 -        char oneChar = 'p';
313.2138 -        memcpy(&(putbackQueue[putbackQueueCount]), event, sizeof(XEvent));
313.2139 -        putbackQueueCount++;
313.2140 -
313.2141 -        // wake up the event loop, if it's sleeping
313.2142 -        write (AWT_WRITEPIPE, &oneChar, 1);
313.2143 -    }
313.2144 -
313.2145 -    return;
313.2146 -} /* awt_put_back_event() */
313.2147 -
313.2148 -/*
313.2149 - * Gets the next event that has been pushed back onto the queue.
313.2150 - * Returns 0 and fills in xev_out if successful
313.2151 - */
313.2152 -static int32_t
313.2153 -awt_get_next_put_back_event(XEvent *xev_out) {
313.2154 -
313.2155 -    Boolean err = False;
313.2156 -    if (putbackQueueCount < 1) {
313.2157 -        err = True;
313.2158 -    } else {
313.2159 -        memcpy(xev_out, &(putbackQueue[0]), sizeof(XEvent));
313.2160 -    }
313.2161 -    if (!err) {
313.2162 -        /* remove it from the queue */
313.2163 -        if (putbackQueueCount == 1) {
313.2164 -
313.2165 -            // queue is now empty
313.2166 -            if (putbackQueueCapacity > PUTBACK_QUEUE_MIN_INCREMENT) {
313.2167 -
313.2168 -                /* Too much space -- delete it and rebuild later */
313.2169 -                free(putbackQueue);
313.2170 -                putbackQueue = NULL;
313.2171 -                putbackQueueCapacity = 0;
313.2172 -            }
313.2173 -        } else {
313.2174 -            /* more than 1 event in queue - shift all events to the left */
313.2175 -            /* We don't free the allocated memory until the queue
313.2176 -               becomes empty, just 'cause it's easier that way. */
313.2177 -            /* NOTE: use memmove(), because the memory blocks overlap */
313.2178 -            memmove(&(putbackQueue[0]), &(putbackQueue[1]),
313.2179 -                (putbackQueueCount-1)*sizeof(XEvent));
313.2180 -        }
313.2181 -        --putbackQueueCount;
313.2182 -    }
313.2183 -    DASSERT(putbackQueueCount >= 0);
313.2184 -
313.2185 -    return (err? -1:0);
313.2186 -
313.2187 -} /* awt_get_next_put_back_event() */
313.2188 -
313.2189 -/**
313.2190 - * Determines whether or not there are X or Xt events pending.
313.2191 - * Looks at the putbackQueue.
313.2192 - */
313.2193 -static XtInputMask
313.2194 -awt_events_pending(XtAppContext appContext) {
313.2195 -    XtInputMask imask = 0L;
313.2196 -    imask = XtAppPending(appContext);
313.2197 -    if (putbackQueueCount > 0) {
313.2198 -        imask |= XtIMXEvent;
313.2199 -    }
313.2200 -    return imask;
313.2201 -}
313.2202 -
313.2203 -
313.2204 -#ifndef NOMODALFIX
313.2205 -#define WIDGET_ARRAY_SIZE 5;
313.2206 -static int32_t arraySize = 0;
313.2207 -static int32_t arrayIndx = 0;
313.2208 -static Widget *dShells = NULL;
313.2209 -
313.2210 -void
313.2211 -awt_shellPoppedUp(Widget shell,
313.2212 -                   XtPointer modal,
313.2213 -                   XtPointer call_data)
313.2214 -{
313.2215 -    if (arrayIndx == arraySize ) {
313.2216 -        /* if we have not allocate an array, do it first */
313.2217 -        if (arraySize == 0) {
313.2218 -            arraySize += WIDGET_ARRAY_SIZE;
313.2219 -            dShells = (Widget *) malloc(sizeof(Widget) * arraySize);
313.2220 -        } else {
313.2221 -            arraySize += WIDGET_ARRAY_SIZE;
313.2222 -            dShells = (Widget *) realloc((void *)dShells, sizeof(Widget) * arraySize);
313.2223 -        }
313.2224 -    }
313.2225 -
313.2226 -    dShells[arrayIndx] = shell;
313.2227 -    arrayIndx++;
313.2228 -}
313.2229 -
313.2230 -void
313.2231 -awt_shellPoppedDown(Widget shell,
313.2232 -                   XtPointer modal,
313.2233 -                   XtPointer call_data)
313.2234 -{
313.2235 -    arrayIndx--;
313.2236 -
313.2237 -    if (dShells[arrayIndx] == shell) {
313.2238 -        dShells[arrayIndx] = NULL;
313.2239 -        return;
313.2240 -    } else {
313.2241 -        int32_t i;
313.2242 -
313.2243 -        /* find the position of the shell in the array */
313.2244 -        for (i = arrayIndx; i >= 0; i--) {
313.2245 -            if (dShells[i] == shell) {
313.2246 -                break;
313.2247 -            }
313.2248 -        }
313.2249 -
313.2250 -        /* remove the found element */
313.2251 -        while (i <= arrayIndx-1) {
313.2252 -            dShells[i] = dShells[i+1];
313.2253 -            i++;
313.2254 -        }
313.2255 -    }
313.2256 -}
313.2257 -
313.2258 -Boolean
313.2259 -awt_isWidgetModal(Widget widget)
313.2260 -{
313.2261 -    Widget w;
313.2262 -
313.2263 -    for (w = widget; !XtIsShell(w); w = XtParent(w)) { }
313.2264 -
313.2265 -    while (w != NULL) {
313.2266 -        if (w == dShells[arrayIndx-1]) {
313.2267 -            return True;
313.2268 -        }
313.2269 -        w = XtParent(w);
313.2270 -    }
313.2271 -    return False;
313.2272 -}
313.2273 -
313.2274 -Boolean
313.2275 -awt_isModal()
313.2276 -{
313.2277 -    return (arrayIndx > 0);
313.2278 -}
313.2279 -#endif // NOMODALFIX
313.2280 -
313.2281 -
313.2282 -/*
313.2283 - * Simply waits for terminateFn() to return True. Waits on the
313.2284 - * awt lock and is notified to check its state by the main event
313.2285 - * loop whenever the Xt event queue is empty.
313.2286 - *
313.2287 - * NOTE: when you use this routine check if it can be called on the event
313.2288 - * dispatch thread during drag-n-drop operation and update
313.2289 - * secondary_loop_event() predicate to prevent deadlock.
313.2290 - */
313.2291 -void
313.2292 -awt_MToolkit_modalWait(int32_t (*terminateFn) (void *data), void *data )
313.2293 -{
313.2294 -    JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
313.2295 -
313.2296 -    AWT_LOCK();
313.2297 -    AWT_FLUSHOUTPUT_NOW();
313.2298 -    while ((*terminateFn) (data) == 0) {
313.2299 -        AWT_WAIT(AWT_MAX_POLL_TIMEOUT);
313.2300 -        if ((*env)->ExceptionCheck(env)) {
313.2301 -            (*env)->ExceptionClear(env);
313.2302 -            break;
313.2303 -        }
313.2304 -    }
313.2305 -    AWT_NOTIFY_ALL();
313.2306 -    AWT_UNLOCK();
313.2307 -}
313.2308 -
313.2309 -static uint32_t
313.2310 -colorToRGB(XColor * color)
313.2311 -{
313.2312 -    int32_t rgb = 0;
313.2313 -
313.2314 -    rgb |= ((color->red >> 8) << 16);
313.2315 -    rgb |= ((color->green >> 8) << 8);
313.2316 -    rgb |= ((color->blue >> 8) << 0);
313.2317 -
313.2318 -    return rgb;
313.2319 -}
313.2320 -
313.2321 -/*
313.2322 - * fix for bug #4088106 - ugly text boxes and grayed out looking text
313.2323 - */
313.2324 -
313.2325 -XmColorProc oldColorProc;
313.2326 -
313.2327 -void
313.2328 -ColorProc(XColor* bg_color,
313.2329 -          XColor* fg_color,
313.2330 -          XColor* sel_color,
313.2331 -          XColor* ts_color,
313.2332 -          XColor* bs_color)
313.2333 -{
313.2334 -    unsigned long plane_masks[1];
313.2335 -    unsigned long colors[5];
313.2336 -
313.2337 -    AwtGraphicsConfigDataPtr defaultConfig =
313.2338 -        getDefaultConfig(DefaultScreen(awt_display));
313.2339 -
313.2340 -    /* use the default procedure to calculate colors */
313.2341 -    oldColorProc(bg_color, fg_color, sel_color, ts_color, bs_color);
313.2342 -
313.2343 -    /* check if there is enought free color cells */
313.2344 -    if (XAllocColorCells(awt_display, defaultConfig->awt_cmap, False,
313.2345 -        plane_masks, 0, colors, 5)) {
313.2346 -        XFreeColors(awt_display, defaultConfig->awt_cmap, colors, 5, 0);
313.2347 -        return;
313.2348 -    }
313.2349 -
313.2350 -    /* find the closest matches currently available */
313.2351 -    fg_color->pixel = defaultConfig->AwtColorMatch(fg_color->red   >> 8,
313.2352 -                                                   fg_color->green >> 8,
313.2353 -                                                   fg_color->blue  >> 8,
313.2354 -                                                   defaultConfig);
313.2355 -    fg_color->flags = DoRed | DoGreen | DoBlue;
313.2356 -    XQueryColor(awt_display, defaultConfig->awt_cmap, fg_color);
313.2357 -    sel_color->pixel = defaultConfig->AwtColorMatch(sel_color->red   >> 8,
313.2358 -                                                    sel_color->green >> 8,
313.2359 -                                                    sel_color->blue  >> 8,
313.2360 -                                                    defaultConfig);
313.2361 -    sel_color->flags = DoRed | DoGreen | DoBlue;
313.2362 -    XQueryColor(awt_display, defaultConfig->awt_cmap, sel_color);
313.2363 -    ts_color->pixel = defaultConfig->AwtColorMatch(ts_color->red   >> 8,
313.2364 -                                                   ts_color->green >> 8,
313.2365 -                                                   ts_color->blue  >> 8,
313.2366 -                                                   defaultConfig);
313.2367 -    ts_color->flags = DoRed | DoGreen | DoBlue;
313.2368 -    XQueryColor(awt_display, defaultConfig->awt_cmap, ts_color);
313.2369 -    bs_color->pixel = defaultConfig->AwtColorMatch(bs_color->red   >> 8,
313.2370 -                                                   bs_color->green >> 8,
313.2371 -                                                   bs_color->blue  >> 8,
313.2372 -                                                   defaultConfig);
313.2373 -    bs_color->flags = DoRed | DoGreen | DoBlue;
313.2374 -    XQueryColor(awt_display, defaultConfig->awt_cmap, bs_color);
313.2375 -}
313.2376 -
313.2377 -
313.2378 -/*
313.2379 - * Read _XSETTINGS_SETTINGS property from _XSETTINGS selection owner
313.2380 - * and pass its value to the java world for processing.
313.2381 - */
313.2382 -/*static*/ void
313.2383 -awt_xsettings_update(int scr, Window owner, void *cookie)
313.2384 -{
313.2385 -    Display *dpy = awt_display;
313.2386 -    int status;
313.2387 -
313.2388 -    JNIEnv *env;
313.2389 -    jobject mtoolkit;
313.2390 -    jmethodID upcall;
313.2391 -    jbyteArray array;
313.2392 -
313.2393 -    struct xsettings_callback_cookie *upcall_cookie = cookie;
313.2394 -
313.2395 -    /* Returns of XGetWindowProperty */
313.2396 -    Atom actual_type;
313.2397 -    int actual_format;
313.2398 -    unsigned long nitems;
313.2399 -    unsigned long bytes_after;
313.2400 -    unsigned char *xsettings;
313.2401 -
313.2402 -    DTRACE_PRINTLN2("XS: update screen %d, owner 0x%08lx",
313.2403 -                    scr, owner);
313.2404 -
313.2405 -#if 1 /* XXX: kludge */
313.2406 -    /*
313.2407 -     * As toolkit cannot yet cope with per-screen desktop properties,
313.2408 -     * only report XSETTINGS changes on the default screen.  This
313.2409 -     * should be "good enough" for most cases.
313.2410 -     */
313.2411 -    if (scr != DefaultScreen(dpy)) {
313.2412 -        DTRACE_PRINTLN2("XS: XXX: default screen is %d, update is for %d, ignoring", DefaultScreen(dpy), scr);
313.2413 -        return;
313.2414 -    }
313.2415 -#endif /* kludge */
313.2416 -
313.2417 -    env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
313.2418 -    DASSERT(env != NULL);
313.2419 -
313.2420 -    DASSERT(upcall_cookie != NULL);
313.2421 -    mtoolkit = upcall_cookie->mtoolkit;
313.2422 -    upcall = upcall_cookie->upcallMID;
313.2423 -
313.2424 -    DASSERT(!JNU_IsNull(env, mtoolkit));
313.2425 -    DASSERT(upcall != NULL);
313.2426 -
313.2427 -    /*
313.2428 -     * XXX: move awt_getPropertyFOO from awt_wm.c to awt_util.c and
313.2429 -     * use the appropriate one.
313.2430 -     */
313.2431 -    status = XGetWindowProperty(dpy, owner,
313.2432 -                 _XA_XSETTINGS_SETTINGS, 0, 0xFFFF, False,
313.2433 -                 _XA_XSETTINGS_SETTINGS,
313.2434 -                 &actual_type, &actual_format, &nitems, &bytes_after,
313.2435 -                 &xsettings);
313.2436 -
313.2437 -    if (status != Success) {
313.2438 -        DTRACE_PRINTLN("XS:   unable to read _XSETTINGS");
313.2439 -        return;
313.2440 -    }
313.2441 -
313.2442 -    if (xsettings == NULL) {
313.2443 -        DTRACE_PRINTLN("XS:   reading _XSETTINGS, got NULL");
313.2444 -        return;
313.2445 -    }
313.2446 -
313.2447 -    if (actual_type != _XA_XSETTINGS_SETTINGS) {
313.2448 -        XFree(xsettings);       /* NULL data already catched above */
313.2449 -        DTRACE_PRINTLN("XS:   _XSETTINGS_SETTINGS is not of type _XSETTINGS_SETTINGS");
313.2450 -        return;
313.2451 -    }
313.2452 -
313.2453 -    DTRACE_PRINTLN1("XS:   read %lu bytes of _XSETTINGS_SETTINGS",
313.2454 -                    nitems);
313.2455 -
313.2456 -    /* ok, propagate xsettings to the toolkit for processing */
313.2457 -    if ((*env)->EnsureLocalCapacity(env, 1) < 0) {
313.2458 -        DTRACE_PRINTLN("XS:   EnsureLocalCapacity failed");
313.2459 -        XFree(xsettings);
313.2460 -        return;
313.2461 -    }
313.2462 -
313.2463 -    array = (*env)->NewByteArray(env, (jint)nitems);
313.2464 -    if (JNU_IsNull(env, array)) {
313.2465 -        DTRACE_PRINTLN("awt_xsettings_update: NewByteArray failed");
313.2466 -        XFree(xsettings);
313.2467 -        return;
313.2468 -    }
313.2469 -
313.2470 -    (*env)->SetByteArrayRegion(env, array, 0, (jint)nitems,
313.2471 -                               (jbyte *)xsettings);
313.2472 -    XFree(xsettings);
313.2473 -
313.2474 -    (*env)->CallVoidMethod(env, mtoolkit, upcall, (jint)scr, array);
313.2475 -    (*env)->DeleteLocalRef(env, array);
313.2476 -}
313.2477 -
313.2478 -
313.2479 -/*
313.2480 - * Event handler for events on XSETTINGS selection owner.
313.2481 - * We are interested in PropertyNotify only.
313.2482 - */
313.2483 -static void
313.2484 -awt_xsettings_callback(int scr, XEvent *xev, void *cookie)
313.2485 -{
313.2486 -    Display *dpy = awt_display; /* xev->xany.display */
313.2487 -    XPropertyEvent *ev;
313.2488 -
313.2489 -    if (xev->type != PropertyNotify) {
313.2490 -        DTRACE_PRINTLN2("XS: awt_xsettings_callback(%d) event %d ignored",
313.2491 -                        scr, xev->type);
313.2492 -        return;
313.2493 -    }
313.2494 -
313.2495 -    ev = &xev->xproperty;
313.2496 -
313.2497 -    if (ev->atom == None) {
313.2498 -        DTRACE_PRINTLN("XS: awt_xsettings_callback(%d) atom == None");
313.2499 -        return;
313.2500 -    }
313.2501 -
313.2502 -#ifdef DEBUG
313.2503 -    {
313.2504 -        char *name;
313.2505 -
313.2506 -        DTRACE_PRINT2("XS: awt_xsettings_callback(%d) 0x%08lx ",
313.2507 -                      scr, ev->window);
313.2508 -        name = XGetAtomName(dpy, ev->atom);
313.2509 -        if (name == NULL) {
313.2510 -            DTRACE_PRINT1("atom #%d", ev->atom);
313.2511 -        } else {
313.2512 -            DTRACE_PRINT1("%s", name);
313.2513 -            XFree(name);
313.2514 -        }
313.2515 -        DTRACE_PRINTLN1(" %s", ev->state == PropertyNewValue ?
313.2516 -                                        "changed" : "deleted");
313.2517 -    }
313.2518 -#endif
313.2519 -
313.2520 -    if (ev->atom != _XA_XSETTINGS_SETTINGS) {
313.2521 -        DTRACE_PRINTLN("XS:   property != _XSETTINGS_SETTINGS ...  ignoring");
313.2522 -        return;
313.2523 -    }
313.2524 -
313.2525 -
313.2526 -    if (ev->state == PropertyDelete) {
313.2527 -        /* XXX: notify toolkit to reset to "defaults"? */
313.2528 -        return;
313.2529 -    }
313.2530 -
313.2531 -    awt_xsettings_update(scr, ev->window, cookie);
313.2532 -}
313.2533 -
313.2534 -
313.2535 -/*
313.2536 - * Owner of XSETTINGS selection changed on the given screen.
313.2537 - */
313.2538 -static void
313.2539 -awt_xsettings_owner_callback(int scr, Window owner, long *data_unused,
313.2540 -                             void *cookie)
313.2541 -{
313.2542 -    if (owner == None) {
313.2543 -        DTRACE_PRINTLN("XS: awt_xsettings_owner_callback: owner = None");
313.2544 -        /* XXX: reset to defaults??? */
313.2545 -        return;
313.2546 -    }
313.2547 -
313.2548 -    DTRACE_PRINTLN1("XS: awt_xsettings_owner_callback: owner = 0x%08lx",
313.2549 -                    owner);
313.2550 -
313.2551 -    awt_xsettings_update(scr, owner, cookie);
313.2552 -}
313.2553 -
313.2554 -/*
313.2555 - * Returns a reference to the class java.awt.Component.
313.2556 - */
313.2557 -jclass
313.2558 -getComponentClass(JNIEnv *env)
313.2559 -{
313.2560 -    static jclass componentCls = NULL;
313.2561 -
313.2562 -    // get global reference of java/awt/Component class (run only once)
313.2563 -    if (componentCls == NULL) {
313.2564 -        jclass componentClsLocal = (*env)->FindClass(env, "java/awt/Component");
313.2565 -        DASSERT(componentClsLocal != NULL);
313.2566 -        if (componentClsLocal == NULL) {
313.2567 -            /* exception already thrown */
313.2568 -            return NULL;
313.2569 -        }
313.2570 -        componentCls = (jclass)(*env)->NewGlobalRef(env, componentClsLocal);
313.2571 -        (*env)->DeleteLocalRef(env, componentClsLocal);
313.2572 -    }
313.2573 -    return componentCls;
313.2574 -}
313.2575 -
313.2576 -
313.2577 -/*
313.2578 - * Returns a reference to the class java.awt.MenuComponent.
313.2579 - */
313.2580 -jclass
313.2581 -getMenuComponentClass(JNIEnv *env)
313.2582 -{
313.2583 -    static jclass menuComponentCls = NULL;
313.2584 -
313.2585 -    // get global reference of java/awt/MenuComponent class (run only once)
313.2586 -    if (menuComponentCls == NULL) {
313.2587 -        jclass menuComponentClsLocal = (*env)->FindClass(env, "java/awt/MenuComponent");
313.2588 -        DASSERT(menuComponentClsLocal != NULL);
313.2589 -        if (menuComponentClsLocal == NULL) {
313.2590 -            /* exception already thrown */
313.2591 -            return NULL;
313.2592 -        }
313.2593 -        menuComponentCls = (jclass)(*env)->NewGlobalRef(env, menuComponentClsLocal);
313.2594 -        (*env)->DeleteLocalRef(env, menuComponentClsLocal);
313.2595 -    }
313.2596 -    return menuComponentCls;
313.2597 -}
313.2598 -
313.2599 -/*
313.2600 - * Class:     sun_awt_motif_MToolkit
313.2601 - * Method:    init
313.2602 - * Signature: (Ljava/lang/String;)V
313.2603 - */
313.2604 -JNIEXPORT void JNICALL
313.2605 -Java_sun_awt_motif_MToolkit_init(JNIEnv *env, jobject this,
313.2606 -    jstring mainClassName)
313.2607 -{
313.2608 -    char *appName = NULL;
313.2609 -    char *mainChars = NULL;
313.2610 -
313.2611 -    int32_t   argc     = 0;
313.2612 -    char *argv[10] = { NULL };
313.2613 -
313.2614 -    /*
313.2615 -     * Note: The MToolkit object depends on the static initializer
313.2616 -     * of X11GraphicsEnvironment to initialize the connection to
313.2617 -     * the X11 server.
313.2618 -     */
313.2619 -    XFontStruct *xfont;
313.2620 -    XmFontListEntry tmpFontListEntry;
313.2621 -    char *multiclick_time_query;
313.2622 -    AwtGraphicsConfigDataPtr defaultConfig =
313.2623 -        getDefaultConfig(DefaultScreen(awt_display));
313.2624 -    AwtScreenDataPtr defaultScreen =
313.2625 -        getScreenData(DefaultScreen(awt_display));
313.2626 -
313.2627 -    static String fallback_resources[] =
313.2628 -    {
313.2629 -        "*enableThinThickness:                   True",
313.2630 -        "*XmFileSelectionBox.fileFilterStyle:    XmFILTER_HIDDEN_FILES",
313.2631 -        "*XmFileSelectionBox.pathMode:           XmPATH_MODE_RELATIVE",
313.2632 -        "*XmFileSelectionBox.resizePolicy:       XmRESIZE_GROW",
313.2633 -        "*XmFileSelectionBox*dirTextLabelString:         Enter path or folder name:",
313.2634 -        "*XmFileSelectionBox*applyLabelString:           Update",
313.2635 -        "*XmFileSelectionBox*selectionLabelString:       Enter file name:",
313.2636 -        "*XmFileSelectionBox*dirListLabelString:         Folders",
313.2637 -        NULL                        /* Must be NULL terminated */
313.2638 -    };
313.2639 -
313.2640 -    focusOutEvent.type = FocusOut;
313.2641 -    focusOutEvent.xfocus.send_event = True;
313.2642 -    focusOutEvent.xfocus.display = awt_display;
313.2643 -    focusOutEvent.xfocus.mode = NotifyNormal;
313.2644 -    focusOutEvent.xfocus.detail = NotifyNonlinear;
313.2645 -
313.2646 -    /* Need to make sure this is deleted someplace! */
313.2647 -    AWT_LOCK();
313.2648 -
313.2649 -    XSetIOErrorHandler(xIOError);
313.2650 -
313.2651 -    if (!XSupportsLocale()) {
313.2652 -        jio_fprintf(stderr,
313.2653 -                    "current locale is not supported in X11, locale is set to C");
313.2654 -        setlocale(LC_ALL, "C");
313.2655 -    }
313.2656 -    if (!XSetLocaleModifiers("")) {
313.2657 -        jio_fprintf(stderr, "X locale modifiers are not supported, using default");
313.2658 -    }
313.2659 -#ifdef NETSCAPE
313.2660 -    if (awt_init_xt) {
313.2661 -        XtToolkitInitialize();
313.2662 -    }
313.2663 -#else
313.2664 -    XtToolkitInitialize();
313.2665 -#endif
313.2666 -
313.2667 -    {
313.2668 -        jclass  fontConfigClass;
313.2669 -        jmethodID methID;
313.2670 -        jstring jFontList;
313.2671 -        char       *cFontRsrc;
313.2672 -        char       *cFontRsrc2;
313.2673 -
313.2674 -        fontConfigClass = (*env)->FindClass(env, "sun/awt/motif/MFontConfiguration");
313.2675 -        methID = (*env)->GetStaticMethodID(env, fontConfigClass,
313.2676 -                                           "getDefaultMotifFontSet",
313.2677 -                                           "()Ljava/lang/String;");
313.2678 -        jFontList = (*env)->CallStaticObjectMethod(env, fontConfigClass, methID);
313.2679 -        if (jFontList == NULL) {
313.2680 -            motifFontList =
313.2681 -                "-monotype-arial-regular-r-normal--*-140-*-*-p-*-iso8859-1";
313.2682 -        } else {
313.2683 -            motifFontList = JNU_GetStringPlatformChars(env, jFontList, NULL);
313.2684 -        }
313.2685 -
313.2686 -        /* fprintf(stderr, "motifFontList: %s\n", motifFontList); */
313.2687 -
313.2688 -        cFontRsrc = malloc(strlen(motifFontList) + 20);
313.2689 -        strcpy(cFontRsrc, "*fontList: ");
313.2690 -        strcat(cFontRsrc, motifFontList);
313.2691 -        cFontRsrc2 = malloc(strlen(motifFontList) + 20);
313.2692 -        strcpy(cFontRsrc2, "*labelFontList: ");
313.2693 -        strcat(cFontRsrc2, motifFontList);
313.2694 -
313.2695 -        argc = 1;
313.2696 -        argv[argc++] = "-xrm";
313.2697 -        argv[argc++] = cFontRsrc;
313.2698 -        argv[argc++] = "-xrm";
313.2699 -        argv[argc++] = cFontRsrc2;
313.2700 -        argv[argc++] = "-font";
313.2701 -        argv[argc++] = (char *)defaultMotifFont;
313.2702 -    }
313.2703 -
313.2704 -    awt_appContext = XtCreateApplicationContext();
313.2705 -    XtAppSetErrorHandler(awt_appContext, (XtErrorHandler) xtError);
313.2706 -    XtAppSetFallbackResources(awt_appContext, fallback_resources);
313.2707 -
313.2708 -    appName = NULL;
313.2709 -    mainChars = NULL;
313.2710 -    if (!JNU_IsNull(env, mainClassName)) {
313.2711 -        mainChars = (char *)JNU_GetStringPlatformChars(env, mainClassName, NULL);
313.2712 -        appName = mainChars;
313.2713 -    }
313.2714 -    if (appName == NULL || appName[0] == '\0') {
313.2715 -        appName = "AWT";
313.2716 -    }
313.2717 -
313.2718 -    XtDisplayInitialize(awt_appContext, awt_display,
313.2719 -                        appName, /* application name  */
313.2720 -                        appName, /* application class */
313.2721 -                        NULL, 0, &argc, argv);
313.2722 -
313.2723 -    /* Root shell widget that serves as a parent for all AWT top-levels.    */
313.2724 -    awt_root_shell = XtVaAppCreateShell(appName, /* application name  */
313.2725 -                                        appName, /* application class */
313.2726 -                                        applicationShellWidgetClass,
313.2727 -                                        awt_display,
313.2728 -                                        /* va_list */
313.2729 -                                        XmNmappedWhenManaged, False,
313.2730 -                                        NULL);
313.2731 -    XtRealizeWidget(awt_root_shell);
313.2732 -
313.2733 -    if (mainChars != NULL) {
313.2734 -        JNU_ReleaseStringPlatformChars(env, mainClassName, mainChars);
313.2735 -    }
313.2736 -
313.2737 -    awt_mgrsel_init();
313.2738 -    awt_wm_init();
313.2739 -    init_xembed();
313.2740 -
313.2741 -    /*
313.2742 -     * Find the correct awt_multiclick_time to use. We normally
313.2743 -     * would call XtMultiClickTime() and wouldn't have to do
313.2744 -     * anything special, but because OpenWindows defines its own
313.2745 -     * version (OpenWindows.MultiClickTimeout), we need to
313.2746 -     * determine out which resource to use.
313.2747 -     *
313.2748 -     * We do this by searching in order for:
313.2749 -     *
313.2750 -     *   1) an explicit definition of multiClickTime
313.2751 -     *      (this is the resource that XtGetMultiClickTime uses)
313.2752 -     *
313.2753 -     * if that fails, search for:
313.2754 -     *
313.2755 -     *   2) an explicit definition of Openwindows.MultiClickTimeout
313.2756 -     *
313.2757 -     * if both searches fail:
313.2758 -     *
313.2759 -     *   3) use the fallback provided by XtGetMultiClickTime()
313.2760 -     *      (which is 200 milliseconds... I looked at the source :-)
313.2761 -     *
313.2762 -     */
313.2763 -    multiclick_time_query = XGetDefault(awt_display, "*", "multiClickTime");
313.2764 -    if (multiclick_time_query) {
313.2765 -        awt_multiclick_time = XtGetMultiClickTime(awt_display);
313.2766 -    } else {
313.2767 -        multiclick_time_query = XGetDefault(awt_display,
313.2768 -                                            "OpenWindows", "MultiClickTimeout");
313.2769 -        if (multiclick_time_query) {
313.2770 -            /* Note: OpenWindows.MultiClickTimeout is in tenths of
313.2771 -               a second, so we need to multiply by 100 to convert to
313.2772 -               milliseconds */
313.2773 -            awt_multiclick_time = atoi(multiclick_time_query) * 100;
313.2774 -        } else {
313.2775 -            awt_multiclick_time = XtGetMultiClickTime(awt_display);
313.2776 -        }
313.2777 -    }
313.2778 -
313.2779 -    scrollBugWorkAround = TRUE;
313.2780 -
313.2781 -    /*
313.2782 -     * Create the cursor for TextArea scrollbars...
313.2783 -     */
313.2784 -    awt_scrollCursor = XCreateFontCursor(awt_display, XC_left_ptr);
313.2785 -
313.2786 -    awt_defaultBg = defaultConfig->AwtColorMatch(200, 200, 200, defaultConfig);
313.2787 -    awt_defaultFg = defaultScreen->blackpixel;
313.2788 -    setup_modifier_map(awt_display);
313.2789 -
313.2790 -    awt_initialize_DataTransferer();
313.2791 -    awt_initialize_Xm_DnD(awt_display);
313.2792 -
313.2793 -    /*
313.2794 -     * fix for bug #4088106 - ugly text boxes and grayed out looking text
313.2795 -     */
313.2796 -    oldColorProc = XmGetColorCalculation();
313.2797 -    XmSetColorCalculation(ColorProc);
313.2798 -
313.2799 -    AWT_UNLOCK();
313.2800 -}
313.2801 -
313.2802 -/*
313.2803 - * Class:     sun_awt_motif_MToolkit
313.2804 - * Method:    run
313.2805 - * Signature: ()V
313.2806 - */
313.2807 -JNIEXPORT void JNICALL Java_sun_awt_motif_MToolkit_run
313.2808 -  (JNIEnv *env, jobject this)
313.2809 -{
313.2810 -    /*
313.2811 -     * in performSelect(), we multiply the timeout by 1000. Make sure
313.2812 -     * that the maximum value will not cause an overflow.
313.2813 -     */
313.2814 -    DASSERT(AWT_MAX_POLL_TIMEOUT <= (ULONG_MAX/1000));
313.2815 -
313.2816 -    awt_MainThread = (*env)->NewGlobalRef(env, awtJNI_GetCurrentThread(env));
313.2817 -    awt_MToolkit_loop(env); /* never returns */
313.2818 -}
313.2819 -
313.2820 -/*
313.2821 - * Class:     sun_awt_motif_MToolkit
313.2822 - * Method:    makeColorModel
313.2823 - * Signature: ()Ljava/awt/image/ColorModel;
313.2824 - */
313.2825 -JNIEXPORT jobject JNICALL Java_sun_awt_motif_MToolkit_makeColorModel
313.2826 -  (JNIEnv *env, jclass this)
313.2827 -{
313.2828 -    AwtGraphicsConfigDataPtr defaultConfig =
313.2829 -        getDefaultConfig(DefaultScreen(awt_display));
313.2830 -
313.2831 -    return awtJNI_GetColorModel(env, defaultConfig);
313.2832 -}
313.2833 -
313.2834 -/*
313.2835 - * Class:     sun_awt_motif_MToolkit
313.2836 - * Method:    getScreenResolution
313.2837 - * Signature: ()I
313.2838 - */
313.2839 -JNIEXPORT jint JNICALL Java_sun_awt_motif_MToolkit_getScreenResolution
313.2840 -  (JNIEnv *env, jobject this)
313.2841 -{
313.2842 -    return (jint) ((DisplayWidth(awt_display, DefaultScreen(awt_display))
313.2843 -                    * 25.4) /
313.2844 -                   DisplayWidthMM(awt_display, DefaultScreen(awt_display)));
313.2845 -}
313.2846 -
313.2847 -/*
313.2848 - * Class:     sun_awt_motif_MToolkit
313.2849 - * Method:    getScreenWidth
313.2850 - * Signature: ()I
313.2851 - */
313.2852 -JNIEXPORT jint JNICALL Java_sun_awt_motif_MToolkit_getScreenWidth
313.2853 -  (JNIEnv *env, jobject this)
313.2854 -{
313.2855 -    return DisplayWidth(awt_display, DefaultScreen(awt_display));
313.2856 -}
313.2857 -/*
313.2858 - * Class:     sun_awt_motif_MToolkit
313.2859 - * Method:    getScreenHeight
313.2860 - * Signature: ()I
313.2861 - */
313.2862 -JNIEXPORT jint JNICALL Java_sun_awt_motif_MToolkit_getScreenHeight
313.2863 -  (JNIEnv *env, jobject this)
313.2864 -{
313.2865 -    return DisplayHeight(awt_display, DefaultScreen(awt_display));
313.2866 -}
313.2867 -
313.2868 -/*
313.2869 - * Class:     sun_awt_motif_MToolkit
313.2870 - * Method:    beep
313.2871 - * Signature: ()V
313.2872 - */
313.2873 -JNIEXPORT void JNICALL Java_sun_awt_motif_MToolkit_beep
313.2874 -  (JNIEnv *env, jobject this)
313.2875 -{
313.2876 -    AWT_LOCK();
313.2877 -    XBell(awt_display, 0);
313.2878 -    AWT_FLUSH_UNLOCK();
313.2879 -}
313.2880 -
313.2881 -/*
313.2882 - * Class:     sun_awt_motif_MToolkit
313.2883 - * Method:    shutdown
313.2884 - * Signature: ()V
313.2885 - */
313.2886 -
313.2887 -JNIEXPORT void JNICALL Java_sun_awt_motif_MToolkit_shutdown
313.2888 -  (JNIEnv *env, jobject this)
313.2889 -{
313.2890 -    X11SD_LibDispose(env);
313.2891 -}
313.2892 -
313.2893 -/*
313.2894 - * Class:     sun_awt_motif_MToolkit
313.2895 - * Method:    getLockingKeyStateNative
313.2896 - * Signature: (I)B
313.2897 - */
313.2898 -JNIEXPORT jboolean JNICALL Java_sun_awt_motif_MToolkit_getLockingKeyStateNative
313.2899 -  (JNIEnv *env, jobject this, jint awtKey)
313.2900 -{
313.2901 -    KeySym sym;
313.2902 -    KeyCode keyCode;
313.2903 -    uint32_t byteIndex;
313.2904 -    uint32_t bitIndex;
313.2905 -    char keyVector[32];
313.2906 -
313.2907 -    AWT_LOCK();
313.2908 -
313.2909 -    sym = awt_getX11KeySym(awtKey);
313.2910 -    keyCode = XKeysymToKeycode(awt_display, sym);
313.2911 -    if (sym == NoSymbol || keyCode == 0) {
313.2912 -        JNU_ThrowByName(env, "java/lang/UnsupportedOperationException", "Keyboard doesn't have requested key");
313.2913 -        AWT_UNLOCK();
313.2914 -        return False;
313.2915 -    }
313.2916 -
313.2917 -    byteIndex = (keyCode/8);
313.2918 -    bitIndex = keyCode & 7;
313.2919 -    XQueryKeymap(awt_display, keyVector);
313.2920 -
313.2921 -    AWT_UNLOCK();
313.2922 -
313.2923 -    return (1 & (keyVector[byteIndex] >> bitIndex));
313.2924 -}
313.2925 -
313.2926 -/*
313.2927 - * Class:     sun_awt_motif_MToolkit
313.2928 - * Method:    loadSystemColors
313.2929 - * Signature: ([I)V
313.2930 - */
313.2931 -JNIEXPORT void JNICALL Java_sun_awt_motif_MToolkit_loadSystemColors
313.2932 -  (JNIEnv *env, jobject this, jintArray systemColors)
313.2933 -{
313.2934 -    Widget frame, panel, control, menu, text, scrollbar;
313.2935 -    Colormap cmap;
313.2936 -    Pixel bg, fg, highlight, shadow;
313.2937 -    Pixel pixels[java_awt_SystemColor_NUM_COLORS];
313.2938 -    XColor *colorsPtr;
313.2939 -    jint rgbColors[java_awt_SystemColor_NUM_COLORS];
313.2940 -    int32_t count = 0;
313.2941 -    int32_t i, j;
313.2942 -    Arg args[10];
313.2943 -    int32_t argc;
313.2944 -    AwtGraphicsConfigDataPtr defaultConfig =
313.2945 -        getDefaultConfig(DefaultScreen(awt_display));
313.2946 -
313.2947 -    AWT_LOCK();
313.2948 -
313.2949 -    /*
313.2950 -     * initialize array of pixels
313.2951 -     */
313.2952 -    for (i = 0; i < java_awt_SystemColor_NUM_COLORS; i++) {
313.2953 -        pixels[i] = -1;
313.2954 -    }
313.2955 -
313.2956 -    /*
313.2957 -     * Create phantom widgets in order to determine the default
313.2958 -     * colors;  this is somewhat inelegant, however it is the simplest
313.2959 -     * and most reliable way to determine the system's default colors
313.2960 -     * for objects.
313.2961 -     */
313.2962 -    argc = 0;
313.2963 -    XtSetArg(args[argc], XmNbuttonFontList,  getMotifFontList()); argc++;
313.2964 -    XtSetArg(args[argc], XmNlabelFontList,   getMotifFontList()); argc++;
313.2965 -    XtSetArg(args[argc], XmNtextFontList,    getMotifFontList()); argc++;
313.2966 -    frame = XtAppCreateShell("AWTColors", "XApplication",
313.2967 -                             vendorShellWidgetClass,
313.2968 -                             awt_display,
313.2969 -                             args, argc);
313.2970 -    /*
313.2971 -      XtSetMappedWhenManaged(frame, False);
313.2972 -      XtRealizeWidget(frame);
313.2973 -    */
313.2974 -    panel = XmCreateDrawingArea(frame, "awtPanelColor", NULL, 0);
313.2975 -    argc = 0;
313.2976 -    XtSetArg(args[argc], XmNfontList,        getMotifFontList()); argc++;
313.2977 -    control = XmCreatePushButton(panel, "awtControlColor", args, argc);
313.2978 -    argc = 0;
313.2979 -    XtSetArg(args[argc], XmNlabelFontList,   getMotifFontList()); argc++;
313.2980 -    XtSetArg(args[argc], XmNbuttonFontList,  getMotifFontList()); argc++;
313.2981 -    menu = XmCreatePulldownMenu(control, "awtColorMenu", args, argc);
313.2982 -    argc = 0;
313.2983 -    XtSetArg(args[argc], XmNfontList,        getMotifFontList()); argc++;
313.2984 -    text = XmCreateText(panel, "awtTextColor", args, argc);
313.2985 -    scrollbar = XmCreateScrollBar(panel, "awtScrollbarColor", NULL, 0);
313.2986 -
313.2987 -    XtVaGetValues(panel,
313.2988 -                  XmNbackground, &bg,
313.2989 -                  XmNforeground, &fg,
313.2990 -                  XmNcolormap, &cmap,
313.2991 -                  NULL);
313.2992 -
313.2993 -    pixels[java_awt_SystemColor_WINDOW] = bg;
313.2994 -    count++;
313.2995 -    pixels[java_awt_SystemColor_INFO] = bg;
313.2996 -    count++;
313.2997 -    pixels[java_awt_SystemColor_WINDOW_TEXT] = fg;
313.2998 -    count++;
313.2999 -    pixels[java_awt_SystemColor_INFO_TEXT] = fg;
313.3000 -    count++;
313.3001 -
313.3002 -    XtVaGetValues(menu,
313.3003 -                  XmNbackground, &bg,
313.3004 -                  XmNforeground, &fg,
313.3005 -                  NULL);
313.3006 -
313.3007 -    pixels[java_awt_SystemColor_MENU] = bg;
313.3008 -    count++;
313.3009 -    pixels[java_awt_SystemColor_MENU_TEXT] = fg;
313.3010 -    count++;
313.3011 -
313.3012 -    XtVaGetValues(text,
313.3013 -                  XmNbackground, &bg,
313.3014 -                  XmNforeground, &fg,
313.3015 -                  NULL);
313.3016 -
313.3017 -    pixels[java_awt_SystemColor_TEXT] = bg;
313.3018 -    count++;
313.3019 -    pixels[java_awt_SystemColor_TEXT_TEXT] = fg;
313.3020 -    count++;
313.3021 -    pixels[java_awt_SystemColor_TEXT_HIGHLIGHT] = fg;
313.3022 -    count++;
313.3023 -    pixels[java_awt_SystemColor_TEXT_HIGHLIGHT_TEXT] = bg;
313.3024 -    count++;
313.3025 -
313.3026 -    XtVaGetValues(control,
313.3027 -                  XmNbackground, &bg,
313.3028 -                  XmNforeground, &fg,
313.3029 -                  XmNtopShadowColor, &highlight,
313.3030 -                  XmNbottomShadowColor, &shadow,
313.3031 -                  NULL);
313.3032 -
313.3033 -    pixels[java_awt_SystemColor_CONTROL] = bg;
313.3034 -    count++;
313.3035 -    pixels[java_awt_SystemColor_CONTROL_TEXT] = fg;
313.3036 -    count++;
313.3037 -    pixels[java_awt_SystemColor_CONTROL_HIGHLIGHT] = highlight;
313.3038 -    count++;
313.3039 -    pixels[java_awt_SystemColor_CONTROL_LT_HIGHLIGHT] = highlight;
313.3040 -    count++;
313.3041 -    pixels[java_awt_SystemColor_CONTROL_SHADOW] = shadow;
313.3042 -    count++;
313.3043 -    pixels[java_awt_SystemColor_CONTROL_DK_SHADOW] = shadow;
313.3044 -    count++;
313.3045 -
313.3046 -    XtVaGetValues(scrollbar,
313.3047 -                  XmNbackground, &bg,
313.3048 -                  NULL);
313.3049 -    pixels[java_awt_SystemColor_SCROLLBAR] = bg;
313.3050 -    count++;
313.3051 -
313.3052 -    /*
313.3053 -     * Convert pixel values to RGB
313.3054 -     */
313.3055 -    colorsPtr = (XColor *) malloc(count * sizeof(XColor));
313.3056 -    j = 0;
313.3057 -    for (i = 0; i < java_awt_SystemColor_NUM_COLORS; i++) {
313.3058 -        if (pixels[i] != -1) {
313.3059 -            colorsPtr[j++].pixel = pixels[i];
313.3060 -        }
313.3061 -    }
313.3062 -    XQueryColors(awt_display, cmap, colorsPtr, count);
313.3063 -
313.3064 -    /* Get current System Colors */
313.3065 -
313.3066 -    (*env)->GetIntArrayRegion (env, systemColors, 0,
313.3067 -                              java_awt_SystemColor_NUM_COLORS,
313.3068 -                              rgbColors);
313.3069 -
313.3070 -    /*
313.3071 -     * Fill systemColor array with new rgb values
313.3072 -     */
313.3073 -
313.3074 -    j = 0;
313.3075 -    for (i = 0; i < java_awt_SystemColor_NUM_COLORS; i++) {
313.3076 -        if (pixels[i] != -1) {
313.3077 -            uint32_t rgb = colorToRGB(&colorsPtr[j++]);
313.3078 -
313.3079 -            /*
313.3080 -              printf("SystemColor[%d] = %x\n", i, rgb);
313.3081 -            */
313.3082 -            rgbColors[i] = (rgb | 0xFF000000);
313.3083 -        }
313.3084 -    }
313.3085 -
313.3086 -    (*env)->SetIntArrayRegion(env,
313.3087 -                              systemColors,
313.3088 -                              0,
313.3089 -                              java_awt_SystemColor_NUM_COLORS,
313.3090 -                              rgbColors);
313.3091 -
313.3092 -    /* Duplicate system colors. If color allocation is unsuccessful,
313.3093 -       system colors will be approximated with matched colors */
313.3094 -    if (defaultConfig->awt_depth == 8)
313.3095 -        awt_allocate_systemcolors(colorsPtr, count, defaultConfig);
313.3096 -
313.3097 -    /*
313.3098 -     * Cleanup
313.3099 -     */
313.3100 -    XtDestroyWidget(frame);
313.3101 -    free(colorsPtr);
313.3102 -
313.3103 -    AWT_UNLOCK();
313.3104 -}
313.3105 -
313.3106 -/*
313.3107 - * Class:     sun_awt_motif_MToolkit
313.3108 - * Method:    isDynamicLayoutSupportedNative
313.3109 - * Signature: ()Z
313.3110 - *
313.3111 - * Note: there doesn't seem to be a protocol for querying the WM
313.3112 - * about its opaque resize settings, so this function just returns
313.3113 - * whether there is a solid resize option available for that WM.
313.3114 - */
313.3115 -JNIEXPORT jboolean JNICALL
313.3116 -Java_sun_awt_motif_MToolkit_isDynamicLayoutSupportedNative(JNIEnv *env, jobject this)
313.3117 -{
313.3118 -    enum wmgr_t wm;
313.3119 -
313.3120 -    AWT_LOCK();
313.3121 -    wm = awt_wm_getRunningWM();
313.3122 -    AWT_UNLOCK();
313.3123 -
313.3124 -    switch (wm) {
313.3125 -      case ENLIGHTEN_WM:
313.3126 -      case KDE2_WM:
313.3127 -      case SAWFISH_WM:
313.3128 -      case ICE_WM:
313.3129 -      case METACITY_WM:
313.3130 -        return JNI_TRUE;
313.3131 -      case OPENLOOK_WM:
313.3132 -      case MOTIF_WM:
313.3133 -      case CDE_WM:
313.3134 -        return JNI_FALSE;
313.3135 -      default:
313.3136 -        return JNI_FALSE;
313.3137 -    }
313.3138 -}
313.3139 -
313.3140 -/*
313.3141 - * Class:     sun_awt_motif_MToolkit
313.3142 - * Method:    isFrameStateSupported
313.3143 - * Signature: (I)Z
313.3144 - */
313.3145 -JNIEXPORT jboolean JNICALL
313.3146 -Java_sun_awt_motif_MToolkit_isFrameStateSupported(JNIEnv *env, jobject this,
313.3147 -    jint state)
313.3148 -{
313.3149 -    if (state == java_awt_Frame_NORMAL || state == java_awt_Frame_ICONIFIED) {
313.3150 -        return JNI_TRUE;
313.3151 -    } else {
313.3152 -        return awt_wm_supportsExtendedState(state) ? JNI_TRUE : JNI_FALSE;
313.3153 -    }
313.3154 -}
313.3155 -
313.3156 -/*
313.3157 - * Class:     sun_awt_motif_MToolkit
313.3158 - * Method:    getMulticlickTime
313.3159 - * Signature: ()I
313.3160 - */
313.3161 -JNIEXPORT jint JNICALL Java_sun_awt_motif_MToolkit_getMulticlickTime
313.3162 -  (JNIEnv *env, jobject this)
313.3163 -{
313.3164 -    return awt_multiclick_time;
313.3165 -}
313.3166 -
313.3167 -/*
313.3168 - * Class:     sun_awt_motif_MToolkit
313.3169 - * Method:    loadXSettings
313.3170 - * Signature: ()V
313.3171 - */
313.3172 -JNIEXPORT void JNICALL
313.3173 -Java_sun_awt_motif_MToolkit_loadXSettings(JNIEnv *env, jobject this)
313.3174 -{
313.3175 -    static Boolean registered = False;
313.3176 -
313.3177 -    jclass mtoolkitCLS;
313.3178 -    Display *dpy = awt_display;
313.3179 -    const Window *owners;
313.3180 -    int scr;
313.3181 -
313.3182 -    AWT_LOCK();
313.3183 -
313.3184 -    if (registered) {
313.3185 -        AWT_UNLOCK();
313.3186 -        return;
313.3187 -    }
313.3188 -
313.3189 -    if (_XA_XSETTINGS_SETTINGS == None) {
313.3190 -        _XA_XSETTINGS_SETTINGS = XInternAtom(dpy, "_XSETTINGS_SETTINGS", False);
313.3191 -        if (_XA_XSETTINGS_SETTINGS == None) {
313.3192 -            JNU_ThrowNullPointerException(env,
313.3193 -                "unable to intern _XSETTINGS_SETTINGS");
313.3194 -            AWT_UNLOCK();
313.3195 -            return;
313.3196 -        }
313.3197 -    }
313.3198 -
313.3199 -    mtoolkitCLS = (*env)->GetObjectClass(env, this);
313.3200 -
313.3201 -    xsettings_callback_cookie.mtoolkit =
313.3202 -        (*env)->NewGlobalRef(env, this);
313.3203 -    xsettings_callback_cookie.upcallMID =
313.3204 -        (*env)->GetMethodID(env, mtoolkitCLS,
313.3205 -                            "parseXSettings", "(I[B)V");
313.3206 -
313.3207 -    if (JNU_IsNull(env, xsettings_callback_cookie.upcallMID)) {
313.3208 -        JNU_ThrowNoSuchMethodException(env,
313.3209 -            "sun.awt.motif.MToolkit.parseXSettings");
313.3210 -        AWT_UNLOCK();
313.3211 -        return;
313.3212 -    }
313.3213 -
313.3214 -    owners = awt_mgrsel_select("_XSETTINGS", PropertyChangeMask,
313.3215 -                               &xsettings_callback_cookie,
313.3216 -                               awt_xsettings_callback,
313.3217 -                               awt_xsettings_owner_callback);
313.3218 -    if (owners == NULL) {
313.3219 -        JNU_ThrowNullPointerException(env,
313.3220 -            "unable to regiser _XSETTINGS with mgrsel");
313.3221 -        AWT_UNLOCK();
313.3222 -        return;
313.3223 -    }
313.3224 -
313.3225 -    registered = True;
313.3226 -
313.3227 -    for (scr = 0; scr < ScreenCount(dpy); ++scr) {
313.3228 -        if (owners[scr] == None) {
313.3229 -            DTRACE_PRINTLN1("XS: MToolkit.loadXSettings: none on screen %d",
313.3230 -                            scr);
313.3231 -            continue;
313.3232 -        }
313.3233 -
313.3234 -        awt_xsettings_update(scr, owners[scr], &xsettings_callback_cookie);
313.3235 -    }
313.3236 -
313.3237 -    AWT_UNLOCK();
313.3238 -}
313.3239 -
313.3240 -JNIEXPORT jboolean JNICALL
313.3241 -Java_sun_awt_motif_MToolkit_isAlwaysOnTopSupported(JNIEnv *env, jobject toolkit) {
313.3242 -    Boolean res;
313.3243 -    AWT_LOCK();
313.3244 -    res = awt_wm_supportsAlwaysOnTop();
313.3245 -    AWT_UNLOCK();
313.3246 -    return res;
313.3247 -}
313.3248 -
313.3249 -/*
313.3250 - * Returns true if the current thread is privileged. Currently,
313.3251 - * only the main event loop thread is considered to be privileged.
313.3252 - */
313.3253 -Boolean
313.3254 -awt_currentThreadIsPrivileged(JNIEnv *env) {
313.3255 -    return (*env)->IsSameObject(env,
313.3256 -                        awt_MainThread, awtJNI_GetCurrentThread(env));
313.3257 -}
313.3258 -
313.3259 -JNIEXPORT jboolean JNICALL
313.3260 -Java_sun_awt_motif_MToolkit_isSyncUpdated(JNIEnv *env, jobject toolkit) {
313.3261 -    return syncUpdated;
313.3262 -}
313.3263 -
313.3264 -JNIEXPORT jboolean JNICALL
313.3265 -Java_sun_awt_motif_MToolkit_isSyncFailed(JNIEnv *env, jobject toolkit) {
313.3266 -    return syncFailed;
313.3267 -}
313.3268 -
313.3269 -JNIEXPORT void JNICALL
313.3270 -Java_sun_awt_motif_MToolkit_updateSyncSelection(JNIEnv *env, jobject toolkit) {
313.3271 -
313.3272 -    // AWT_LOCK is held by calling function
313.3273 -    if (wm_selection == None) {
313.3274 -        wm_selection = XInternAtom(awt_display, "WM_S0", False);
313.3275 -    }
313.3276 -    if (version_atom == None) {
313.3277 -        version_atom = XInternAtom(awt_display, "VERSION", False);
313.3278 -    }
313.3279 -    if (oops_atom == None) {
313.3280 -        oops_atom = XInternAtom(awt_display, "OOPS", False);
313.3281 -    }
313.3282 -    syncUpdated = False;
313.3283 -    syncFailed = False;
313.3284 -    XConvertSelection(awt_display, wm_selection, version_atom, oops_atom, XtWindow(awt_root_shell), CurrentTime);
313.3285 -    XSync(awt_display, False);
313.3286 -    inSyncWait = True; // Protect from spurious events
313.3287 -    // Calling function will call AWT_LOCK_WAIT instead of AWT_UNLOCK
313.3288 -}
313.3289 -
313.3290 -JNIEXPORT jint JNICALL
313.3291 -Java_sun_awt_motif_MToolkit_getEventNumber(JNIEnv *env, jobject toolkit) {
313.3292 -    // AWT_LOCK must be held by the calling method
313.3293 -    return eventNumber;
313.3294 -}
313.3295 -
313.3296 -static void
313.3297 -syncWait_eventHandler(XEvent * event) {
313.3298 -    static jmethodID syncNotifyMID = NULL;
313.3299 -    if (event != NULL && event->xany.type == SelectionNotify &&
313.3300 -        event->xselection.requestor == XtWindow(awt_root_shell) &&
313.3301 -        event->xselection.property == oops_atom &&
313.3302 -        inSyncWait)
313.3303 -    {
313.3304 -        JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
313.3305 -        syncUpdated = True;
313.3306 -        inSyncWait = False;
313.3307 -        AWT_NOTIFY_ALL();
313.3308 -    } else if (event != NULL && event->xany.type == SelectionNotify &&
313.3309 -               event->xselection.requestor == XtWindow(awt_root_shell) &&
313.3310 -               event->xselection.target == version_atom &&
313.3311 -               event->xselection.property == None &&
313.3312 -               XGetSelectionOwner(awt_display, wm_selection) == None &&
313.3313 -               event->xselection.selection == wm_selection)
313.3314 -    {
313.3315 -        JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
313.3316 -        syncFailed = True;
313.3317 -        inSyncWait = False;
313.3318 -        AWT_NOTIFY_ALL();
313.3319 -    }
313.3320 -}
313.3321 -
313.3322 -JNIEXPORT void JNICALL
313.3323 -Java_sun_awt_motif_MToolkit_nativeGrab(JNIEnv *env, jobject toolkit, jobject window) {
313.3324 -    struct FrameData    *wdata;
313.3325 -    static Cursor cursor = None;
313.3326 -    int grab_result;
313.3327 -
313.3328 -    AWT_LOCK();
313.3329 -
313.3330 -    wdata = (struct FrameData *)
313.3331 -        JNU_GetLongFieldAsPtr(env, window, mComponentPeerIDs.pData);
313.3332 -
313.3333 -    if (wdata == NULL ||
313.3334 -        wdata->winData.comp.widget == NULL ||
313.3335 -        wdata->winData.shell == NULL)
313.3336 -    {
313.3337 -        AWT_UNLOCK();
313.3338 -        return;
313.3339 -    }
313.3340 -    if (None == cursor) {
313.3341 -        cursor = XCreateFontCursor(awt_display, XC_hand2);
313.3342 -    }
313.3343 -    grabbed_widget = wdata->winData.shell;
313.3344 -    grab_result = XGrabPointer(awt_display, XtWindow(wdata->winData.shell),
313.3345 -                               True, (ButtonPressMask | ButtonReleaseMask
313.3346 -                                      | EnterWindowMask | LeaveWindowMask | PointerMotionMask
313.3347 -                                      | ButtonMotionMask),
313.3348 -                               GrabModeAsync, GrabModeAsync, None,
313.3349 -                               cursor, CurrentTime);
313.3350 -    if (GrabSuccess != grab_result) {
313.3351 -        XUngrabPointer(awt_display, CurrentTime);
313.3352 -        AWT_UNLOCK();
313.3353 -        DTRACE_PRINTLN1("XGrabPointer() failed, result %d", grab_result);
313.3354 -        return;
313.3355 -    }
313.3356 -    grab_result = XGrabKeyboard(awt_display, XtWindow(wdata->winData.shell),
313.3357 -                                True,
313.3358 -                                GrabModeAsync, GrabModeAsync, CurrentTime);
313.3359 -    if (GrabSuccess != grab_result) {
313.3360 -        XUngrabKeyboard(awt_display, CurrentTime);
313.3361 -        XUngrabPointer(awt_display, CurrentTime);
313.3362 -        DTRACE_PRINTLN1("XGrabKeyboard() failed, result %d", grab_result);
313.3363 -    }
313.3364 -    AWT_UNLOCK();
313.3365 -}
313.3366 -
313.3367 -JNIEXPORT void JNICALL
313.3368 -Java_sun_awt_motif_MToolkit_nativeUnGrab(JNIEnv *env, jobject toolkit, jobject window) {
313.3369 -    struct FrameData    *wdata;
313.3370 -
313.3371 -    AWT_LOCK();
313.3372 -
313.3373 -    wdata = (struct FrameData *)
313.3374 -        JNU_GetLongFieldAsPtr(env, window, mComponentPeerIDs.pData);
313.3375 -
313.3376 -    if (wdata == NULL ||
313.3377 -        wdata->winData.comp.widget == NULL ||
313.3378 -        wdata->winData.shell == NULL)
313.3379 -    {
313.3380 -        AWT_UNLOCK();
313.3381 -        return;
313.3382 -    }
313.3383 -
313.3384 -    XUngrabPointer(awt_display, CurrentTime);
313.3385 -    XUngrabKeyboard(awt_display, CurrentTime);
313.3386 -    grabbed_widget = NULL;
313.3387 -    AWT_FLUSHOUTPUT_NOW();
313.3388 -
313.3389 -    AWT_UNLOCK();
313.3390 -
313.3391 -}
313.3392 -
313.3393 -/*
313.3394 - * Class:     sun_awt_motif_MToolkit
313.3395 - * Method:    getWMName
313.3396 - * Signature: ()Ljava/lang/String;
313.3397 - */
313.3398 -JNIEXPORT jstring JNICALL
313.3399 -Java_sun_awt_motif_MToolkit_getWMName(JNIEnv *env, jclass this)
313.3400 -{
313.3401 -    enum wmgr_t wm;
313.3402 -
313.3403 -    AWT_LOCK();
313.3404 -    wm = awt_wm_getRunningWM();
313.3405 -    AWT_UNLOCK();
313.3406 -
313.3407 -    switch (wm) {
313.3408 -      case NO_WM:
313.3409 -          return (*env)->NewStringUTF(env, "NO_WM");
313.3410 -      case OTHER_WM:
313.3411 -          return (*env)->NewStringUTF(env, "OTHER_WM");
313.3412 -      case ENLIGHTEN_WM:
313.3413 -          return (*env)->NewStringUTF(env, "ENLIGHTEN_WM");
313.3414 -      case KDE2_WM:
313.3415 -          return (*env)->NewStringUTF(env, "KDE2_WM");
313.3416 -      case SAWFISH_WM:
313.3417 -          return (*env)->NewStringUTF(env, "SAWFISH_WM");
313.3418 -      case ICE_WM:
313.3419 -          return (*env)->NewStringUTF(env, "ICE_WM");
313.3420 -      case METACITY_WM:
313.3421 -          return (*env)->NewStringUTF(env, "METACITY_WM");
313.3422 -      case OPENLOOK_WM:
313.3423 -          return (*env)->NewStringUTF(env, "OPENLOOK_WM");
313.3424 -      case MOTIF_WM:
313.3425 -          return (*env)->NewStringUTF(env, "MOTIF_WM");
313.3426 -      case CDE_WM:
313.3427 -          return (*env)->NewStringUTF(env, "CDE_WM");
313.3428 -    }
313.3429 -    return (*env)->NewStringUTF(env, "UNDETERMINED_WM");
313.3430 -}
313.3431 -
313.3432 -
313.3433 -#endif /* !HEADLESS */
   314.1 --- a/src/solaris/native/sun/awt/awt_MToolkit.h	Tue Dec 06 16:31:58 2011 -0800
   314.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   314.3 @@ -1,40 +0,0 @@
   314.4 -/*
   314.5 - * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
   314.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   314.7 - *
   314.8 - * This code is free software; you can redistribute it and/or modify it
   314.9 - * under the terms of the GNU General Public License version 2 only, as
  314.10 - * published by the Free Software Foundation.  Oracle designates this
  314.11 - * particular file as subject to the "Classpath" exception as provided
  314.12 - * by Oracle in the LICENSE file that accompanied this code.
  314.13 - *
  314.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
  314.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  314.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  314.17 - * version 2 for more details (a copy is included in the LICENSE file that
  314.18 - * accompanied this code).
  314.19 - *
  314.20 - * You should have received a copy of the GNU General Public License version
  314.21 - * 2 along with this work; if not, write to the Free Software Foundation,
  314.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  314.23 - *
  314.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  314.25 - * or visit www.oracle.com if you need additional information or have any
  314.26 - * questions.
  314.27 - */
  314.28 -#ifndef _MTOOLKIT_H_
  314.29 -#define _MTOOLKIT_H_
  314.30 -#ifndef HEADLESS
  314.31 -extern void *findPeer(Widget * pwidget);
  314.32 -extern Widget findWindowsProxy(jobject window, JNIEnv *env);
  314.33 -extern struct WidgetInfo *findWidgetInfo(Widget widget);
  314.34 -extern Boolean isAncestor(Window ancestor, Window child);
  314.35 -extern void clearFocusPath(Widget shell);
  314.36 -extern void globalClearFocusPath(Widget focusOwnerShell);
  314.37 -extern Boolean isFrameOrDialog(jobject target, JNIEnv * env);
  314.38 -extern jobject getOwningFrameOrDialog(jobject target, JNIEnv *env);
  314.39 -
  314.40 -#define SPECIAL_KEY_EVENT 2
  314.41 -
  314.42 -#endif /* !HEADLESS */
  314.43 -#endif           /* _MTOOLKIT_H_ */
   315.1 --- a/src/solaris/native/sun/awt/awt_MenuItem.h	Tue Dec 06 16:31:58 2011 -0800
   315.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   315.3 @@ -1,41 +0,0 @@
   315.4 -/*
   315.5 - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
   315.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   315.7 - *
   315.8 - * This code is free software; you can redistribute it and/or modify it
   315.9 - * under the terms of the GNU General Public License version 2 only, as
  315.10 - * published by the Free Software Foundation.  Oracle designates this
  315.11 - * particular file as subject to the "Classpath" exception as provided
  315.12 - * by Oracle in the LICENSE file that accompanied this code.
  315.13 - *
  315.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
  315.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  315.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  315.17 - * version 2 for more details (a copy is included in the LICENSE file that
  315.18 - * accompanied this code).
  315.19 - *
  315.20 - * You should have received a copy of the GNU General Public License version
  315.21 - * 2 along with this work; if not, write to the Free Software Foundation,
  315.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  315.23 - *
  315.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  315.25 - * or visit www.oracle.com if you need additional information or have any
  315.26 - * questions.
  315.27 - */
  315.28 -
  315.29 -#include <jni_util.h>
  315.30 -
  315.31 -/* fieldIDs for MenuItem fields that may be accessed from C */
  315.32 -struct MenuItemIDs {
  315.33 -    jfieldID label;
  315.34 -    jfieldID enabled;
  315.35 -    jfieldID shortcut;
  315.36 -};
  315.37 -
  315.38 -/* fieldIDs for MMenuItemPeer fields that may be accessed from C */
  315.39 -struct MMenuItemPeerIDs {
  315.40 -    jfieldID target;
  315.41 -    jfieldID pData;
  315.42 -    jfieldID isCheckbox;
  315.43 -    jfieldID jniGlobalRef;
  315.44 -};
   316.1 --- a/src/solaris/native/sun/awt/awt_PopupMenu.h	Tue Dec 06 16:31:58 2011 -0800
   316.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   316.3 @@ -1,29 +0,0 @@
   316.4 -/*
   316.5 - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
   316.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   316.7 - *
   316.8 - * This code is free software; you can redistribute it and/or modify it
   316.9 - * under the terms of the GNU General Public License version 2 only, as
  316.10 - * published by the Free Software Foundation.  Oracle designates this
  316.11 - * particular file as subject to the "Classpath" exception as provided
  316.12 - * by Oracle in the LICENSE file that accompanied this code.
  316.13 - *
  316.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
  316.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  316.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  316.17 - * version 2 for more details (a copy is included in the LICENSE file that
  316.18 - * accompanied this code).
  316.19 - *
  316.20 - * You should have received a copy of the GNU General Public License version
  316.21 - * 2 along with this work; if not, write to the Free Software Foundation,
  316.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  316.23 - *
  316.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  316.25 - * or visit www.oracle.com if you need additional information or have any
  316.26 - * questions.
  316.27 - */
  316.28 -
  316.29 -/* methodsIDs for MPopupMenuPeer methods that may be accessed from C */
  316.30 -struct MPopupMenuPeerIDs {
  316.31 -  jmethodID destroyNativeWidgetAfterGettingTreeLock;
  316.32 -};
   317.1 --- a/src/solaris/native/sun/awt/awt_Robot.c	Tue Dec 06 16:31:58 2011 -0800
   317.2 +++ b/src/solaris/native/sun/awt/awt_Robot.c	Mon Dec 19 10:06:23 2011 -0800
   317.3 @@ -28,7 +28,6 @@
   317.4  #endif
   317.5  
   317.6  #include "awt_p.h"
   317.7 -#include "awt_Component.h"
   317.8  #include "awt_GraphicsEnv.h"
   317.9  #define XK_MISCELLANY
  317.10  #include <X11/keysymdef.h>
   318.1 --- a/src/solaris/native/sun/awt/awt_TopLevel.h	Tue Dec 06 16:31:58 2011 -0800
   318.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   318.3 @@ -1,41 +0,0 @@
   318.4 -/*
   318.5 - * Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
   318.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   318.7 - *
   318.8 - * This code is free software; you can redistribute it and/or modify it
   318.9 - * under the terms of the GNU General Public License version 2 only, as
  318.10 - * published by the Free Software Foundation.  Oracle designates this
  318.11 - * particular file as subject to the "Classpath" exception as provided
  318.12 - * by Oracle in the LICENSE file that accompanied this code.
  318.13 - *
  318.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
  318.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  318.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  318.17 - * version 2 for more details (a copy is included in the LICENSE file that
  318.18 - * accompanied this code).
  318.19 - *
  318.20 - * You should have received a copy of the GNU General Public License version
  318.21 - * 2 along with this work; if not, write to the Free Software Foundation,
  318.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  318.23 - *
  318.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  318.25 - * or visit www.oracle.com if you need additional information or have any
  318.26 - * questions.
  318.27 - */
  318.28 -
  318.29 -/*
  318.30 - */
  318.31 -#ifndef _TOPLEVEL_H_
  318.32 -#define _TOPLEVEL_H_
  318.33 -#ifndef HEADLESS
  318.34 -
  318.35 -extern Widget findFocusProxy(Widget widget);
  318.36 -extern Widget findTopLevelByShell(Widget widget);
  318.37 -extern jobject findTopLevel(jobject peer, JNIEnv *env);
  318.38 -extern void shellEH(Widget w, XtPointer data, XEvent *event, Boolean *continueToDispatch);
  318.39 -extern Boolean isFocusableWindowByShell(JNIEnv * env, Widget shell);
  318.40 -extern Boolean isFocusableWindowByPeer(JNIEnv * env, jobject peer);
  318.41 -extern Widget getShellWidget(Widget child);
  318.42 -extern Boolean isFocusableComponentTopLevelByWidget(JNIEnv * env, Widget child);
  318.43 -#endif /* !HEADLESS */
  318.44 -#endif           /* _TOPLEVEL_H_ */
   319.1 --- a/src/solaris/native/sun/awt/awt_Window.h	Tue Dec 06 16:31:58 2011 -0800
   319.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   319.3 @@ -1,47 +0,0 @@
   319.4 -/*
   319.5 - * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
   319.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   319.7 - *
   319.8 - * This code is free software; you can redistribute it and/or modify it
   319.9 - * under the terms of the GNU General Public License version 2 only, as
  319.10 - * published by the Free Software Foundation.  Oracle designates this
  319.11 - * particular file as subject to the "Classpath" exception as provided
  319.12 - * by Oracle in the LICENSE file that accompanied this code.
  319.13 - *
  319.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
  319.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  319.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  319.17 - * version 2 for more details (a copy is included in the LICENSE file that
  319.18 - * accompanied this code).
  319.19 - *
  319.20 - * You should have received a copy of the GNU General Public License version
  319.21 - * 2 along with this work; if not, write to the Free Software Foundation,
  319.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  319.23 - *
  319.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  319.25 - * or visit www.oracle.com if you need additional information or have any
  319.26 - * questions.
  319.27 - */
  319.28 -
  319.29 -#include <jni_util.h>
  319.30 -
  319.31 -/* fieldIDs for Window fields that may be accessed from C */
  319.32 -struct WindowIDs {
  319.33 -    jfieldID warningString;
  319.34 -    jfieldID locationByPlatform;
  319.35 -    jfieldID isAutoRequestFocus;
  319.36 -};
  319.37 -
  319.38 -/* fieldIDs for MWindowPeer fields that may be accessed from C */
  319.39 -struct MWindowPeerIDs {
  319.40 -    jfieldID insets;
  319.41 -    jfieldID iconWidth;
  319.42 -    jfieldID iconHeight;
  319.43 -    jfieldID winAttr;
  319.44 -    jmethodID handleWindowFocusIn;
  319.45 -    jmethodID handleWindowFocusOut;
  319.46 -    jmethodID handleIconify;
  319.47 -    jmethodID handleDeiconify;
  319.48 -    jmethodID handleStateChange;
  319.49 -    jmethodID draggedToScreenMID;
  319.50 -};
   320.1 --- a/src/solaris/native/sun/awt/awt_mgrsel.c	Tue Dec 06 16:31:58 2011 -0800
   320.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   320.3 @@ -1,449 +0,0 @@
   320.4 -/*
   320.5 - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
   320.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   320.7 - *
   320.8 - * This code is free software; you can redistribute it and/or modify it
   320.9 - * under the terms of the GNU General Public License version 2 only, as
  320.10 - * published by the Free Software Foundation.  Oracle designates this
  320.11 - * particular file as subject to the "Classpath" exception as provided
  320.12 - * by Oracle in the LICENSE file that accompanied this code.
  320.13 - *
  320.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
  320.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  320.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  320.17 - * version 2 for more details (a copy is included in the LICENSE file that
  320.18 - * accompanied this code).
  320.19 - *
  320.20 - * You should have received a copy of the GNU General Public License version
  320.21 - * 2 along with this work; if not, write to the Free Software Foundation,
  320.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  320.23 - *
  320.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  320.25 - * or visit www.oracle.com if you need additional information or have any
  320.26 - * questions.
  320.27 - */
  320.28 -
  320.29 -#ifdef HEADLESS
  320.30 -    #error This file should not be included in headless library
  320.31 -#endif
  320.32 -
  320.33 -#include "awt_mgrsel.h"
  320.34 -
  320.35 -static Atom XA_MANAGER = None;
  320.36 -
  320.37 -/*
  320.38 - * Structures that describes the manager selection AWT listens to with
  320.39 - * callabacks to the subsytems interested in the selection.  (We only
  320.40 - * listen to a couple of selections, so linear search is enough).
  320.41 - */
  320.42 -struct AwtMgrsel {
  320.43 -    char *selname;              /* base name of selection atoms */
  320.44 -    Atom *per_scr_atoms;        /* per-screen selection atoms (ICCCM 1.2.6) */
  320.45 -    Atom *per_scr_owners;       /* windows currently owning the selection */
  320.46 -    long extra_mask;            /* extra events to listen to on owners */
  320.47 -    void *cookie;
  320.48 -    void (*callback_event)(int, XEvent *, void *); /* extra_mask events */
  320.49 -    void (*callback_owner)(int, Window, long *, void *); /* owner changes */
  320.50 -    struct AwtMgrsel *next;
  320.51 -};
  320.52 -
  320.53 -static struct AwtMgrsel *mgrsel_list = NULL;
  320.54 -
  320.55 -
  320.56 -static int awt_mgrsel_screen(Window w);
  320.57 -static Window awt_mgrsel_select_per_screen(Atom, long);
  320.58 -static int awt_mgrsel_managed(XClientMessageEvent *mgrown);
  320.59 -static int awt_mgrsel_unmanaged(XDestroyWindowEvent *ev);
  320.60 -
  320.61 -#ifdef DEBUG
  320.62 -static void awt_mgrsel_dtraceManaged(XClientMessageEvent *mgrown);
  320.63 -#endif
  320.64 -
  320.65 -
  320.66 -
  320.67 -/*
  320.68 - * Find which screen the window W is the root of.
  320.69 - * Returns the screen number, or -1 if W is not a root.
  320.70 - */
  320.71 -static int
  320.72 -awt_mgrsel_screen(Window w)
  320.73 -{
  320.74 -    Display *dpy = awt_display;
  320.75 -    int scr;
  320.76 -
  320.77 -    for (scr = 0; scr < ScreenCount(dpy); ++scr) {
  320.78 -        if (w == RootWindow(dpy, scr)) {
  320.79 -            return (scr);
  320.80 -        }
  320.81 -    }
  320.82 -
  320.83 -    return (-1);
  320.84 -}
  320.85 -
  320.86 -
  320.87 -/************************************************************************
  320.88 - * For every one that asketh receiveth; and he that seeketh findeth;
  320.89 - * and to him that knocketh it shall be opened.  (Luke 11:10).
  320.90 - */
  320.91 -
  320.92 -
  320.93 -/*
  320.94 - * A method for a subsytem to express its interest in a certain
  320.95 - * manager selection.
  320.96 - *
  320.97 - * If owner changes, the callback_owner will be called with the screen
  320.98 - * number and the new owning window when onwership is established, or
  320.99 - * None if the owner is gone.
 320.100 - *
 320.101 - * Events in extra_mask are selected for on owning windows (exsiting
 320.102 - * ones and on new owners when established) and callback_event will be
 320.103 - * called with the screen number and an event.
 320.104 - *
 320.105 - * The function returns an array of current owners.  The size of the
 320.106 - * array is ScreenCount(awt_display).  The array is "owned" by this
 320.107 - * module and should be considered by the caller as read-only.
 320.108 - */
 320.109 -const Window *
 320.110 -awt_mgrsel_select(const char *selname, long extra_mask,
 320.111 -                  void *cookie,
 320.112 -                  void (*callback_event)(int, XEvent *, void *),
 320.113 -                  void (*callback_owner)(int, Window, long *, void *))
 320.114 -{
 320.115 -    Display *dpy = awt_display;
 320.116 -    struct AwtMgrsel *mgrsel;
 320.117 -    Atom *per_scr_atoms;
 320.118 -    Window *per_scr_owners;
 320.119 -    char *namesbuf;
 320.120 -    char **names;
 320.121 -    int per_scr_sz;
 320.122 -    int nscreens = ScreenCount(dpy);
 320.123 -    int scr;
 320.124 -    Status status;
 320.125 -
 320.126 -    DASSERT(selname != NULL);
 320.127 -    DTRACE_PRINTLN1("MG: select: %s", selname);
 320.128 -
 320.129 -    /* buffer size for one per-screen atom name */
 320.130 -    per_scr_sz = strlen(selname) + /* "_S" */ 2 + /* %2d */ + 2 /* '\0' */+ 1;
 320.131 -
 320.132 -    namesbuf = malloc(per_scr_sz * nscreens);  /* actual storage for names */
 320.133 -    names = malloc(sizeof(char *) * nscreens); /* pointers to names */
 320.134 -    per_scr_atoms = malloc(sizeof(Atom) * nscreens);
 320.135 -    per_scr_owners = malloc(sizeof(Window) * nscreens);
 320.136 -    mgrsel = malloc(sizeof(struct AwtMgrsel));
 320.137 -
 320.138 -    if (namesbuf == NULL || names == NULL || per_scr_atoms == NULL
 320.139 -        || per_scr_owners == NULL || mgrsel == NULL)
 320.140 -    {
 320.141 -        DTRACE_PRINTLN("MG: select: unable to allocate memory");
 320.142 -        if (namesbuf != NULL) free(namesbuf);
 320.143 -        if (names != NULL) free(names);
 320.144 -        if (per_scr_atoms != NULL) free(per_scr_atoms);
 320.145 -        if (per_scr_owners != NULL) free(per_scr_owners);
 320.146 -        if (mgrsel != NULL) free(mgrsel);
 320.147 -        return (NULL);
 320.148 -    }
 320.149 -
 320.150 -
 320.151 -    for (scr = 0; scr < nscreens; ++scr) {
 320.152 -        size_t sz;
 320.153 -
 320.154 -        names[scr] = &namesbuf[per_scr_sz * scr];
 320.155 -        sz = snprintf(names[scr], per_scr_sz, "%s_S%-d", selname, scr);
 320.156 -        DASSERT(sz < per_scr_sz);
 320.157 -    }
 320.158 -
 320.159 -    status = XInternAtoms(dpy, names, nscreens, False, per_scr_atoms);
 320.160 -
 320.161 -    free(names);
 320.162 -    free(namesbuf);
 320.163 -
 320.164 -    if (status == 0) {
 320.165 -        DTRACE_PRINTLN("MG: select: XInternAtoms failed");
 320.166 -        free(per_scr_atoms);
 320.167 -        free(per_scr_owners);
 320.168 -        return (NULL);
 320.169 -    }
 320.170 -
 320.171 -    mgrsel->selname = strdup(selname);
 320.172 -    mgrsel->per_scr_atoms = per_scr_atoms;
 320.173 -    mgrsel->per_scr_owners = per_scr_owners;
 320.174 -    mgrsel->extra_mask = extra_mask;
 320.175 -    mgrsel->cookie = cookie;
 320.176 -    mgrsel->callback_event = callback_event;
 320.177 -    mgrsel->callback_owner = callback_owner;
 320.178 -
 320.179 -    for (scr = 0; scr < nscreens; ++scr) {
 320.180 -        Window owner;
 320.181 -
 320.182 -        owner = awt_mgrsel_select_per_screen(per_scr_atoms[scr], extra_mask);
 320.183 -        mgrsel->per_scr_owners[scr] = owner;
 320.184 -#ifdef DEBUG
 320.185 -        if (owner == None) {
 320.186 -            DTRACE_PRINTLN1("MG:   screen %d - None", scr);
 320.187 -        } else {
 320.188 -            DTRACE_PRINTLN2("MG:   screen %d - 0x%08lx", scr, owner);
 320.189 -        }
 320.190 -#endif
 320.191 -    }
 320.192 -
 320.193 -    mgrsel->next = mgrsel_list;
 320.194 -    mgrsel_list = mgrsel;
 320.195 -
 320.196 -    return (per_scr_owners);
 320.197 -}
 320.198 -
 320.199 -
 320.200 -static Window
 320.201 -awt_mgrsel_select_per_screen(Atom selection, long extra_mask)
 320.202 -{
 320.203 -    Display *dpy = awt_display;
 320.204 -    Window owner;
 320.205 -
 320.206 -    XGrabServer(dpy);
 320.207 -
 320.208 -    owner = XGetSelectionOwner(dpy, selection);
 320.209 -    if (owner == None) {
 320.210 -        /* we'll get notified later if one arrives */
 320.211 -        XUngrabServer(dpy);
 320.212 -        /* Workaround for bug 5039226 */
 320.213 -        XSync(dpy, False);
 320.214 -        return (None);
 320.215 -    }
 320.216 -
 320.217 -    /*
 320.218 -     * Select for StructureNotifyMask to get DestroyNotify when owner
 320.219 -     * is gone.  Also select for any additional events caller is
 320.220 -     * interested in (e.g. PropertyChangeMask).  Caller will be
 320.221 -     * notifed of these events via ... XXX ...
 320.222 -     */
 320.223 -    XSelectInput(dpy, owner, StructureNotifyMask | extra_mask);
 320.224 -
 320.225 -    XUngrabServer(dpy);
 320.226 -    /* Workaround for bug 5039226 */
 320.227 -    XSync(dpy, False);
 320.228 -    return (owner);
 320.229 -}
 320.230 -
 320.231 -
 320.232 -/************************************************************************
 320.233 - * And so I saw the wicked buried, who had come and gone from the
 320.234 - * place of the holy, and they were forgotten in the city where they
 320.235 - * had so done: this is also vanity.  (Eccl 8:10)
 320.236 - */
 320.237 -
 320.238 -#ifdef DEBUG
 320.239 -/*
 320.240 - * Print the message from the new manager that announces it acquired
 320.241 - * ownership.
 320.242 - */
 320.243 -static void
 320.244 -awt_mgrsel_dtraceManaged(XClientMessageEvent *mgrown)
 320.245 -{
 320.246 -    Display *dpy = awt_display;
 320.247 -    Atom selection;
 320.248 -    char *selname, *print_selname;
 320.249 -    int scr;
 320.250 -
 320.251 -    scr = awt_mgrsel_screen(mgrown->window);
 320.252 -
 320.253 -    selection = mgrown->data.l[1];
 320.254 -    print_selname = selname = XGetAtomName(dpy, selection);
 320.255 -    if (selname == NULL) {
 320.256 -        if (selection == None) {
 320.257 -            print_selname = "<None>";
 320.258 -        } else {
 320.259 -            print_selname = "<Unknown>";
 320.260 -        }
 320.261 -    }
 320.262 -
 320.263 -    DTRACE_PRINTLN4("MG: new MANAGER for %s: screen %d, owner 0x%08lx (@%lu)",
 320.264 -                   print_selname, scr,
 320.265 -                   mgrown->data.l[2],  /* the window owning the selection */
 320.266 -                   mgrown->data.l[0]); /* timestamp */
 320.267 -    DTRACE_PRINTLN4("MG:   %ld %ld / 0x%lx 0x%lx", /* extra data */
 320.268 -                    mgrown->data.l[3], mgrown->data.l[4],
 320.269 -                    mgrown->data.l[3], mgrown->data.l[4]);
 320.270 -
 320.271 -    if (selname != NULL) {
 320.272 -        XFree(selname);
 320.273 -    }
 320.274 -}
 320.275 -#endif /* DEBUG */
 320.276 -
 320.277 -
 320.278 -static int
 320.279 -awt_mgrsel_managed(XClientMessageEvent *mgrown)
 320.280 -{
 320.281 -    Display *dpy = awt_display;
 320.282 -    struct AwtMgrsel *mgrsel;
 320.283 -    int scr;
 320.284 -
 320.285 -    long timestamp;
 320.286 -    Atom selection;
 320.287 -    Window owner;
 320.288 -    long *data;
 320.289 -
 320.290 -    if (mgrown->message_type != XA_MANAGER) {
 320.291 -        DTRACE_PRINTLN("MG: ClientMessage type != MANAGER, ignoring");
 320.292 -        return (0);
 320.293 -    }
 320.294 -
 320.295 -    scr = awt_mgrsel_screen(mgrown->window);
 320.296 -
 320.297 -#ifdef DEBUG
 320.298 -    awt_mgrsel_dtraceManaged(mgrown);
 320.299 -#endif
 320.300 -
 320.301 -    if (scr < 0) {
 320.302 -        DTRACE_PRINTLN("MG: MANAGER ClientMessage with a non-root window!");
 320.303 -        return (0);
 320.304 -    }
 320.305 -
 320.306 -    timestamp = mgrown->data.l[0];
 320.307 -    selection = mgrown->data.l[1];
 320.308 -    owner     = mgrown->data.l[2];
 320.309 -    data      = &mgrown->data.l[3]; /* long[2], selection specific */
 320.310 -
 320.311 -    /* is this a selection we are intrested in? */
 320.312 -    for (mgrsel = mgrsel_list; mgrsel != NULL; mgrsel = mgrsel->next) {
 320.313 -        if (selection == mgrsel->per_scr_atoms[scr])
 320.314 -            break;
 320.315 -    }
 320.316 -
 320.317 -    if (mgrsel == NULL) {
 320.318 -        DTRACE_PRINTLN("MG: not interested in this selection, ignoring");
 320.319 -        return (0);
 320.320 -    }
 320.321 -
 320.322 -
 320.323 -    mgrsel->per_scr_owners[scr] = owner;
 320.324 -
 320.325 -    XSelectInput(dpy, owner, StructureNotifyMask | mgrsel->extra_mask);
 320.326 -
 320.327 -    /* notify the listener */
 320.328 -    if (mgrsel->callback_owner != NULL) {
 320.329 -        (*mgrsel->callback_owner)(scr, owner, data, mgrsel->cookie);
 320.330 -    }
 320.331 -
 320.332 -    return (1);
 320.333 -}
 320.334 -
 320.335 -
 320.336 -static int
 320.337 -awt_mgrsel_unmanaged(XDestroyWindowEvent *ev)
 320.338 -{
 320.339 -    Display *dpy = awt_display;
 320.340 -    struct AwtMgrsel *mgrsel;
 320.341 -    Window exowner;
 320.342 -    int scr;
 320.343 -
 320.344 -    exowner = ev->window;       /* selection owner that's gone */
 320.345 -
 320.346 -    /* is this a selection we are intrested in? */
 320.347 -    for (mgrsel = mgrsel_list; mgrsel != NULL; mgrsel = mgrsel->next) {
 320.348 -        for (scr = 0; scr < ScreenCount(dpy); ++scr) {
 320.349 -            if (exowner == mgrsel->per_scr_owners[scr]) {
 320.350 -                /* can one window own selections for more than one screen? */
 320.351 -                goto out;       /* XXX??? */
 320.352 -            }
 320.353 -        }
 320.354 -    }
 320.355 -  out:
 320.356 -    if (mgrsel == NULL) {
 320.357 -        DTRACE_PRINTLN1("MG: DestroyNotify for 0x%08lx ignored", exowner);
 320.358 -        return (0);
 320.359 -    }
 320.360 -
 320.361 -    DTRACE_PRINTLN3("MG: DestroyNotify for 0x%08lx, owner of %s at screen %d",
 320.362 -                    exowner, mgrsel->selname, scr);
 320.363 -
 320.364 -    /* notify the listener (pass exowner as data???) */
 320.365 -    if (mgrsel->callback_owner != NULL) {
 320.366 -        (*mgrsel->callback_owner)(scr, None, NULL, mgrsel->cookie);
 320.367 -    }
 320.368 -
 320.369 -    return (1);
 320.370 -}
 320.371 -
 320.372 -
 320.373 -/*
 320.374 - * Hook to be called from toolkit event loop.
 320.375 - */
 320.376 -int
 320.377 -awt_mgrsel_processEvent(XEvent *ev)
 320.378 -{
 320.379 -    Display *dpy = awt_display;
 320.380 -    struct AwtMgrsel *mgrsel;
 320.381 -    int scr;
 320.382 -
 320.383 -    if (ev->type == ClientMessage) { /* new manager announces ownership? */
 320.384 -        if (awt_mgrsel_managed(&ev->xclient))
 320.385 -            return (1);
 320.386 -    }
 320.387 -
 320.388 -    if (ev->type == DestroyNotify) { /* manager gives up selection? */
 320.389 -        if (awt_mgrsel_unmanaged(&ev->xdestroywindow))
 320.390 -            return (1);
 320.391 -    }
 320.392 -
 320.393 -    /* is this an event selected on one of selection owners? */
 320.394 -    for (mgrsel = mgrsel_list; mgrsel != NULL; mgrsel = mgrsel->next) {
 320.395 -        for (scr = 0; scr < ScreenCount(dpy); ++scr) {
 320.396 -            if (ev->xany.window == mgrsel->per_scr_owners[scr]) {
 320.397 -                /* can one window own selections for more than one screen? */
 320.398 -                goto out;       /* XXX??? */
 320.399 -            }
 320.400 -        }
 320.401 -    }
 320.402 -  out:
 320.403 -    DTRACE_PRINT2("MG: screen %d, event %d ...  ",
 320.404 -                  scr, ev->xany.type);
 320.405 -    if (mgrsel == NULL) {
 320.406 -        DTRACE_PRINTLN("ignored");
 320.407 -        return (0);             /* not interested */
 320.408 -    }
 320.409 -
 320.410 -    DTRACE_PRINT1("%s ...  ", mgrsel->selname);
 320.411 -    if (mgrsel->callback_event != NULL) {
 320.412 -        DTRACE_PRINTLN("dispatching");
 320.413 -        (*mgrsel->callback_event)(scr, ev, mgrsel->cookie);
 320.414 -    }
 320.415 -#ifdef DEBUG
 320.416 -    else {
 320.417 -        DTRACE_PRINTLN("no callback");
 320.418 -    }
 320.419 -#endif
 320.420 -
 320.421 -    return (1);
 320.422 -}
 320.423 -
 320.424 -
 320.425 -void
 320.426 -awt_mgrsel_init(void)
 320.427 -{
 320.428 -    static Boolean inited = False;
 320.429 -
 320.430 -    Display *dpy = awt_display;
 320.431 -    int scr;
 320.432 -
 320.433 -    if (inited) {
 320.434 -        return;
 320.435 -    }
 320.436 -
 320.437 -    XA_MANAGER = XInternAtom(dpy, "MANAGER", False);
 320.438 -    DASSERT(XA_MANAGER != None);
 320.439 -
 320.440 -
 320.441 -    /*
 320.442 -     * Listen for ClientMessage's on each screen's root.  We hook into
 320.443 -     * the message loop in the toolkit (with awt_mgrsel_processEvent)
 320.444 -     * to get the events processed.  We need this for notifications of
 320.445 -     * new manager acquiring ownership of the manager selection.
 320.446 -     */
 320.447 -    for (scr = 0; scr < ScreenCount(dpy); ++scr) {
 320.448 -        XSelectInput(dpy, RootWindow(dpy, scr), StructureNotifyMask);
 320.449 -    }
 320.450 -
 320.451 -    inited = True;
 320.452 -}
   321.1 --- a/src/solaris/native/sun/awt/awt_mgrsel.h	Tue Dec 06 16:31:58 2011 -0800
   321.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   321.3 @@ -1,42 +0,0 @@
   321.4 -/*
   321.5 - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
   321.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   321.7 - *
   321.8 - * This code is free software; you can redistribute it and/or modify it
   321.9 - * under the terms of the GNU General Public License version 2 only, as
  321.10 - * published by the Free Software Foundation.  Oracle designates this
  321.11 - * particular file as subject to the "Classpath" exception as provided
  321.12 - * by Oracle in the LICENSE file that accompanied this code.
  321.13 - *
  321.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
  321.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  321.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  321.17 - * version 2 for more details (a copy is included in the LICENSE file that
  321.18 - * accompanied this code).
  321.19 - *
  321.20 - * You should have received a copy of the GNU General Public License version
  321.21 - * 2 along with this work; if not, write to the Free Software Foundation,
  321.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  321.23 - *
  321.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  321.25 - * or visit www.oracle.com if you need additional information or have any
  321.26 - * questions.
  321.27 - */
  321.28 -
  321.29 -#ifndef _AWT_MGRSEL_H_
  321.30 -#define _AWT_MGRSEL_H_
  321.31 -
  321.32 -#ifndef HEADLESS
  321.33 -
  321.34 -#include "awt_p.h"
  321.35 -
  321.36 -extern void awt_mgrsel_init(void);
  321.37 -extern int awt_mgrsel_processEvent(XEvent *);
  321.38 -
  321.39 -extern const Window * awt_mgrsel_select(const char *, long,
  321.40 -                                        void *,
  321.41 -                                        void (*)(int, XEvent *, void *),
  321.42 -                                        void (*)(int, Window, long *, void *));
  321.43 -
  321.44 -#endif /* !HEADLESS */
  321.45 -#endif /* _AWT_MGRSEL_H_ */
   322.1 --- a/src/solaris/native/sun/awt/awt_motif.h	Tue Dec 06 16:31:58 2011 -0800
   322.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   322.3 @@ -1,59 +0,0 @@
   322.4 -/*
   322.5 - * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
   322.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   322.7 - *
   322.8 - * This code is free software; you can redistribute it and/or modify it
   322.9 - * under the terms of the GNU General Public License version 2 only, as
  322.10 - * published by the Free Software Foundation.  Oracle designates this
  322.11 - * particular file as subject to the "Classpath" exception as provided
  322.12 - * by Oracle in the LICENSE file that accompanied this code.
  322.13 - *
  322.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
  322.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  322.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  322.17 - * version 2 for more details (a copy is included in the LICENSE file that
  322.18 - * accompanied this code).
  322.19 - *
  322.20 - * You should have received a copy of the GNU General Public License version
  322.21 - * 2 along with this work; if not, write to the Free Software Foundation,
  322.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  322.23 - *
  322.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  322.25 - * or visit www.oracle.com if you need additional information or have any
  322.26 - * questions.
  322.27 - */
  322.28 -
  322.29 -#ifndef _SWITCHXM_P_H_
  322.30 -#define _SWITCHXM_P_H_
  322.31 -
  322.32 -#include <sun_awt_motif_MComponentPeer.h>
  322.33 -
  322.34 -#include "gdefs.h"
  322.35 -#include <X11/Xlib.h>
  322.36 -#include <X11/Intrinsic.h>
  322.37 -
  322.38 -#define MOTIF_NA  sun_awt_motif_MComponentPeer_MOTIF_NA
  322.39 -#define MOTIF_V1  sun_awt_motif_MComponentPeer_MOTIF_V1
  322.40 -#define MOTIF_V2  sun_awt_motif_MComponentPeer_MOTIF_V2
  322.41 -
  322.42 -
  322.43 -extern int32_t awt_motif_getIMStatusHeight(Widget w, jobject tc);
  322.44 -extern XVaNestedList awt_motif_getXICStatusAreaList(Widget w, jobject tc);
  322.45 -extern void awt_motif_Scrollbar_ButtonReleaseHandler (Widget,
  322.46 -                                                      XtPointer,
  322.47 -                                                      XEvent *,
  322.48 -                                                      Boolean *) ;
  322.49 -
  322.50 -    /* This function causes an UnsatisfiedLinkError on Linux.
  322.51 -     * It's a no-op for Motif 2.1.
  322.52 -     * Since Linux only links against Motif 2.1, we can safely remove
  322.53 -     * this function altogether from the Linux build.
  322.54 -     * bchristi 1/22/2001
  322.55 -     */
  322.56 -#ifdef __solaris__
  322.57 -extern void awt_motif_adjustDragTriggerEvent(XEvent* xevent);
  322.58 -#endif
  322.59 -
  322.60 -void awt_motif_enableSingleDragInitiator(Widget w);
  322.61 -
  322.62 -#endif /* _SWITCHXM_P_H_ */
   323.1 --- a/src/solaris/native/sun/awt/awt_p.h	Tue Dec 06 16:31:58 2011 -0800
   323.2 +++ b/src/solaris/native/sun/awt/awt_p.h	Mon Dec 19 10:06:23 2011 -0800
   323.3 @@ -49,28 +49,6 @@
   323.4  #include <X11/keysym.h>
   323.5  #include <X11/keysymdef.h>
   323.6  #include <X11/extensions/Xrender.h>
   323.7 -#ifndef XAWT
   323.8 -#include <Xm/CascadeB.h>
   323.9 -#include <Xm/DrawingA.h>
  323.10 -#include <Xm/FileSB.h>
  323.11 -#include <Xm/BulletinB.h>
  323.12 -#include <Xm/Form.h>
  323.13 -#include <Xm/Frame.h>
  323.14 -#include <Xm/Label.h>
  323.15 -#include <Xm/PushB.h>
  323.16 -#include <Xm/PushBG.h>
  323.17 -#include <Xm/RowColumn.h>
  323.18 -#include <Xm/ScrollBar.h>
  323.19 -#include <Xm/ScrolledW.h>
  323.20 -#include <Xm/SelectioB.h>
  323.21 -#include <Xm/SeparatoG.h>
  323.22 -#include <Xm/ToggleB.h>
  323.23 -#include <Xm/TextF.h>
  323.24 -#include <Xm/Text.h>
  323.25 -#include <Xm/List.h>
  323.26 -#include <Xm/Xm.h>
  323.27 -#include <Xm/MainW.h>
  323.28 -#endif
  323.29  #endif /* !HEADLESS */
  323.30  #include "awt.h"
  323.31  #include "awt_util.h"
  323.32 @@ -78,33 +56,13 @@
  323.33  #include "colordata.h"
  323.34  #include "gdefs.h"
  323.35  
  323.36 -#ifndef XAWT
  323.37 -#include "GLXGraphicsConfig.h"
  323.38 -//#include <sun_awt_motif_MComponentPeer.h>
  323.39 -#endif
  323.40 -
  323.41  #ifndef HEADLESS
  323.42 -#ifndef XAWT
  323.43 -#include "awt_motif.h"
  323.44 -#endif
  323.45  #ifndef min
  323.46  #define min(a,b) ((a) <= (b)? (a):(b))
  323.47  #endif
  323.48  #ifndef max
  323.49  #define max(a,b) ((a) >= (b)? (a):(b))
  323.50  #endif
  323.51 -
  323.52 -extern Pixel awt_pixel_by_name(Display *dpy, char *color, char *defaultColor);
  323.53 -
  323.54 -typedef struct DropSiteInfo* DropSitePtr;
  323.55 -
  323.56 -struct WidgetInfo {
  323.57 -    Widget             widget;
  323.58 -    Widget             origin;
  323.59 -    void*              peer;
  323.60 -    jlong              event_mask;
  323.61 -    struct WidgetInfo* next;
  323.62 -};
  323.63  #endif /* !HEADLESS */
  323.64  
  323.65  #define RepaintPending_NONE     0
  323.66 @@ -112,13 +70,6 @@
  323.67  #define RepaintPending_EXPOSE   (1 << 1)
  323.68  #define LOOKUPSIZE 32
  323.69  
  323.70 -typedef struct _DamageRect {
  323.71 -    int x1;
  323.72 -    int y1;
  323.73 -    int x2;
  323.74 -    int y2;
  323.75 -} DamageRect;
  323.76 -
  323.77  #ifndef HEADLESS
  323.78  
  323.79  typedef XRenderPictFormat *
  323.80 @@ -157,110 +108,9 @@
  323.81  
  323.82  typedef AwtScreenData* AwtScreenDataPtr;
  323.83  
  323.84 -struct ComponentData {
  323.85 -    Widget      widget;
  323.86 -    int         repaintPending;
  323.87 -    DamageRect  repaintRect;
  323.88 -    DamageRect  exposeRect;
  323.89 -    DropSitePtr dsi;
  323.90 -};
  323.91 -
  323.92 -struct MessageDialogData {
  323.93 -    struct ComponentData        comp;
  323.94 -    int                 isModal;
  323.95 -};
  323.96 -
  323.97 -struct CanvasData {
  323.98 -    struct ComponentData        comp;
  323.99 -    Widget                      shell;
 323.100 -    int                         flags;
 323.101 -};
 323.102 -
 323.103 -struct MenuItemData {
 323.104 -    struct ComponentData        comp;
 323.105 -    int                         index;
 323.106 -};
 323.107 -
 323.108 -struct MenuData {
 323.109 -    struct ComponentData        comp;
 323.110 -    struct MenuItemData         itemData;
 323.111 -};
 323.112 -
 323.113 -
 323.114  #define W_GRAVITY_INITIALIZED 1
 323.115  #define W_IS_EMBEDDED 2
 323.116  
 323.117 -struct FrameData {
 323.118 -    struct CanvasData   winData;
 323.119 -    int                 isModal;
 323.120 -    Widget              mainWindow;
 323.121 -    Widget              focusProxy;     /* for all key events */
 323.122 -    Widget              menuBar;
 323.123 -    Widget              warningWindow;
 323.124 -    int                 top;            /* these four are the insets... */
 323.125 -    int                 bottom;
 323.126 -    int                 left;
 323.127 -    int                 right;
 323.128 -    int                 topGuess;       /* these four are the guessed insets */
 323.129 -    int                 bottomGuess;
 323.130 -    int                 leftGuess;
 323.131 -    int                 rightGuess;
 323.132 -    int                 mbHeight;       /* height of the menubar window */
 323.133 -    int                 wwHeight;       /* height of the warning window */
 323.134 -    jint                state;          /* java.awt.Frame.state bits    */
 323.135 -    Boolean             reparented;
 323.136 -    Boolean             configure_seen;
 323.137 -    Boolean             shellResized;   /* frame shell has been resized */
 323.138 -    Boolean             canvasResized;  /* frame inner canvas resized   */
 323.139 -    Boolean             menuBarReset;   /* frame menu bar added/removed */
 323.140 -    Boolean             isResizable;    /* is this window resizable ?   */
 323.141 -    Boolean             isFixedSizeSet; /* is fixed size already set ?  */
 323.142 -    Boolean             isShowing;      /* is this window now showing ? */
 323.143 -    Boolean             hasTextComponentNative;
 323.144 -    Boolean             need_reshape;
 323.145 -    Boolean             callbacksAdded; /* needed for fix for 4078176   */
 323.146 -    Pixmap              iconPixmap;     /* Pixmap to hold icon image    */
 323.147 -    int                 iconWidth;
 323.148 -    int                 iconHeight;
 323.149 -    int                 imHeight;       /* imStatusBar's height         */
 323.150 -    Boolean             imRemove;       /* ImStatusBar is being removed */
 323.151 -    Boolean             fixInsets;      /* [jk] REMINDER: remove if possible */
 323.152 -    int                 decor;          /* type of native decorations */
 323.153 -    Boolean             initialFocus;   /* does Window take focus initially */
 323.154 -    Boolean             isInputMethodWindow;
 323.155 -
 323.156 -    /*
 323.157 -     * Fix for BugTraq ID 4060975.
 323.158 -     * firstShellEH() stores to this field handle of the widget that had
 323.159 -     * focus before the shell was resized so that we can later restore it.
 323.160 -     */
 323.161 -    Widget              focusWidget;
 323.162 -    int screenNum;      /* Which screen this Window is on.  Xinerama-aware. */
 323.163 -    Boolean             isDisposeScheduled;
 323.164 -    Boolean             isFocusableWindow;  /* a cache of Window.isFocusableWindow() return value */
 323.165 -};
 323.166 -
 323.167 -struct ListData {
 323.168 -    struct ComponentData comp;
 323.169 -    Widget               list;
 323.170 -};
 323.171 -
 323.172 -struct TextAreaData {
 323.173 -    struct ComponentData comp;
 323.174 -    Widget               txt;
 323.175 -};
 323.176 -
 323.177 -struct TextFieldData {
 323.178 -    struct ComponentData comp;
 323.179 -    int                  echoContextID;
 323.180 -    Boolean              echoContextIDInit;
 323.181 -};
 323.182 -
 323.183 -struct FileDialogData {
 323.184 -    struct ComponentData comp;
 323.185 -    char        *file;
 323.186 -};
 323.187 -
 323.188  typedef struct awtFontList {
 323.189      char *xlfd;
 323.190      int index_length;
 323.191 @@ -276,33 +126,6 @@
 323.192      XFontStruct *xfont; /* Latin1 font */
 323.193  };
 323.194  
 323.195 -#ifndef XAWT
 323.196 -extern XmFontList getMotifFontList(void);
 323.197 -extern XFontSet getMotifFontSet(void);
 323.198 -extern XFontStruct *getMotifFontStruct(void);
 323.199 -extern Boolean awt_isAwtWidget(Widget widget);
 323.200 -#endif
 323.201 -
 323.202 -struct ChoiceData {
 323.203 -    struct ComponentData comp;
 323.204 -    Widget               menu;
 323.205 -    Widget               *items;
 323.206 -    int                  maxitems;
 323.207 -    int                  n_items;
 323.208 -    short                n_columns;
 323.209 -/* Bug 4255631 Solaris: Size returned by Choice.getSize() does not match
 323.210 - * actual size
 323.211 - * y and height which Choice takes in pReshape
 323.212 -*/
 323.213 -    jint                 bounds_y;
 323.214 -    jint                 bounds_height;
 323.215 -};
 323.216 -
 323.217 -struct MenuList {
 323.218 -    Widget menu;
 323.219 -    struct MenuList* next;
 323.220 -};
 323.221 -
 323.222  extern struct FontData *awtJNI_GetFontData(JNIEnv *env,jobject font, char **errmsg);
 323.223  
 323.224  extern AwtGraphicsConfigDataPtr getDefaultConfig(int screen);
 323.225 @@ -315,20 +138,6 @@
 323.226  #ifndef HEADLESS
 323.227  #define XDISPLAY awt_display;
 323.228  
 323.229 -extern Boolean awt_currentThreadIsPrivileged(JNIEnv *env);
 323.230 -extern void null_event_handler(Widget w, XtPointer client_data,
 323.231 -                        XEvent * event, Boolean * cont);
 323.232 -
 323.233 -extern void awt_put_back_event(JNIEnv *env, XEvent *event);
 323.234 -extern void awt_MToolkit_modalWait(int (*terminateFn)(void *data), void *data);
 323.235 -extern void awt_Frame_guessInsets(struct FrameData *fdata);
 323.236 -
 323.237 -extern void awt_addWidget(Widget w, Widget origin, void *peer, jlong event_mask);
 323.238 -extern void awt_delWidget(Widget w);
 323.239 -
 323.240 -extern void awt_addMenuWidget(Widget w);
 323.241 -extern void awt_delMenuWidget(Widget w);
 323.242 -
 323.243  extern int awt_allocate_colors(AwtGraphicsConfigDataPtr);
 323.244  extern void awt_allocate_systemcolors(XColor *, int, AwtGraphicsConfigDataPtr);
 323.245  extern void awt_allocate_systemrgbcolors(jint *, int, AwtGraphicsConfigDataPtr);
 323.246 @@ -338,24 +147,5 @@
 323.247  extern jobject awtJNI_GetColorModel(JNIEnv *, AwtGraphicsConfigDataPtr);
 323.248  extern void awtJNI_CreateColorData (JNIEnv *, AwtGraphicsConfigDataPtr, int lock);
 323.249  
 323.250 -extern Boolean awtJNI_isSelectionOwner(JNIEnv *env, char *sel_str);
 323.251 -extern void awtJNI_notifySelectionLost(JNIEnv *env, char *sel_str);
 323.252 -extern void removePopupMenus();
 323.253 -extern Boolean awtMenuIsActive();
 323.254  #endif /* !HEADLESS */
 323.255 -
 323.256 -extern void awtJNI_DeleteGlobalRef(JNIEnv *env,jobject thiscomp);
 323.257 -extern void awtJNI_DeleteGlobalMenuRef(JNIEnv *env,jobject thismenu);
 323.258 -extern jobject awtJNI_CreateAndSetGlobalRef(JNIEnv *env,jobject thiscomp);
 323.259 -extern void awtJNI_CleanupGlobalRefs(void);
 323.260 -
 323.261 -#ifndef HEADLESS
 323.262 -/* XXX: Motif internals. Need to fix 4090493. */
 323.263 -#define MOTIF_XmINVALID_DIMENSION       ((Dimension) 0xFFFF)
 323.264 -#define MOTIF_XmDEFAULT_INDICATOR_DIM   ((Dimension) 9)
 323.265 -
 323.266 -extern Dimension awt_computeIndicatorSize(struct FontData *fdata);
 323.267 -extern Dimension awt_adjustIndicatorSizeForMenu(Dimension indSize);
 323.268 -#endif /* !HEADLESS */
 323.269 -
 323.270  #endif           /* _AWT_P_H_ */
   324.1 --- a/src/solaris/native/sun/awt/awt_util.c	Tue Dec 06 16:31:58 2011 -0800
   324.2 +++ b/src/solaris/native/sun/awt/awt_util.c	Mon Dec 19 10:06:23 2011 -0800
   324.3 @@ -29,31 +29,15 @@
   324.4  
   324.5  #include "awt_p.h"
   324.6  #include "color.h"
   324.7 -#include "awt_TopLevel.h"
   324.8  #include <X11/IntrinsicP.h>
   324.9  #include <X11/Xatom.h>
  324.10  #include <X11/Xmd.h>
  324.11  #include <X11/Xutil.h>
  324.12  #include <X11/Xproto.h>
  324.13 -#ifndef XAWT
  324.14 -#include <Xm/MenuShell.h>
  324.15 -#include <Xm/List.h>
  324.16 -#include <Xm/Form.h>
  324.17 -#include <Xm/RowColumn.h>
  324.18 -#include <Xm/MwmUtil.h>
  324.19 -#endif /* XAWT */
  324.20  #include <jni.h>
  324.21  #include <jni_util.h>
  324.22  #include <sys/time.h>
  324.23  
  324.24 -#include "awt_xembed.h"
  324.25 -
  324.26 -
  324.27 -#ifndef XAWT
  324.28 -#if MOTIF_VERSION!=1
  324.29 -    #include <Xm/GrabShell.h>
  324.30 -#endif
  324.31 -#endif
  324.32  
  324.33  #include "java_awt_event_MouseWheelEvent.h"
  324.34  
  324.35 @@ -72,7 +56,6 @@
  324.36  extern jint getModifiers(uint32_t state, jint button, jint keyCode);
  324.37  extern jint getButton(uint32_t button);
  324.38  
  324.39 -static int32_t winmgr_running = 0;
  324.40  static Atom OLDecorDelAtom = 0;
  324.41  static Atom MWMHints = 0;
  324.42  static Atom DTWMHints = 0;
  324.43 @@ -86,840 +69,6 @@
  324.44  #define MIN(a,b) ((a) < (b) ? (a) : (b))
  324.45  #endif
  324.46  
  324.47 -#ifndef XAWT
  324.48 -/*
  324.49 - * The following three funtions are to work around menu problems
  324.50 - */
  324.51 -
  324.52 -/*
  324.53 - * test if there is a menu that has the current focus
  324.54 - * called from awt_Dialog.c and awt_Component.c
  324.55 - */
  324.56 -Boolean
  324.57 -awt_util_focusIsOnMenu(Display *display)
  324.58 -{
  324.59 -  Window window;
  324.60 -  Widget widget;
  324.61 -  int32_t rtr;
  324.62 -
  324.63 -  XGetInputFocus(display, &window, &rtr);
  324.64 -  if (window == None) {
  324.65 -    return False;
  324.66 -  }
  324.67 -
  324.68 -  widget = XtWindowToWidget(display, window);
  324.69 -  if (widget == NULL) {
  324.70 -    return False;
  324.71 -  }
  324.72 -
  324.73 -  if (XtIsSubclass(widget, xmMenuShellWidgetClass)) {
  324.74 -    return True;
  324.75 -  }
  324.76 -
  324.77 -  #if MOTIF_VERSION!=1
  324.78 -  /* Motif 2.1 uses XmGrabShell on XmComboBox instead
  324.79 -     of XmMenuShell
  324.80 -  */
  324.81 -  if (XtIsSubclass(widget, xmGrabShellWidgetClass)) {
  324.82 -      return True;
  324.83 -  }
  324.84 -  /* Fix 4800638 check the ancestor of focus widget is
  324.85 -     GrabSell
  324.86 -   */
  324.87 -  if (XtIsSubclass(widget, xmListWidgetClass))
  324.88 -  {
  324.89 -      Widget shell = getShellWidget(widget);
  324.90 -      if (shell && XtIsSubclass(shell,
  324.91 -          xmGrabShellWidgetClass))
  324.92 -      {
  324.93 -          return True;
  324.94 -      }
  324.95 -  }
  324.96 -  #endif
  324.97 -
  324.98 -  if (XtIsSubclass(widget, xmRowColumnWidgetClass)) {
  324.99 -      unsigned char type;
 324.100 -      XtVaGetValues(widget, XmNrowColumnType, &type, NULL);
 324.101 -      if (type == XmMENU_BAR) {
 324.102 -          return True;
 324.103 -      }
 324.104 -  }
 324.105 -  return False;
 324.106 -}
 324.107 -
 324.108 -static
 324.109 -void fillButtonEvent(XButtonEvent *ev, int32_t type, Display *display, Window window) {
 324.110 -    ev->type = type;
 324.111 -    ev->display = display;
 324.112 -    ev->window = window;
 324.113 -    ev->send_event = True;
 324.114 -
 324.115 -    /* REMIND: multi-screen */
 324.116 -    ev->root = RootWindow(display, DefaultScreen(display));
 324.117 -    ev->subwindow = (Window)None;
 324.118 -    ev->time = CurrentTime;
 324.119 -    ev->x = 0;
 324.120 -    ev->y = 0;
 324.121 -    ev->x_root = 0;
 324.122 -    ev->y_root = 0;
 324.123 -    ev->same_screen = True;
 324.124 -    ev->button = Button1;
 324.125 -    ev->state = Button1Mask;
 324.126 -}
 324.127 -
 324.128 -/*
 324.129 - * generates a mouse press event and a release event
 324.130 - * called from awt_Dialog.c
 324.131 - */
 324.132 -int32_t
 324.133 -awt_util_sendButtonClick(Display *display, Window window)
 324.134 -{
 324.135 -  XButtonEvent ev;
 324.136 -  int32_t status;
 324.137 -
 324.138 -  fillButtonEvent(&ev, ButtonPress, display, window);
 324.139 -  status = XSendEvent(display, window, True, ButtonPressMask, (XEvent *)&ev);
 324.140 -
 324.141 -  if (status != 0) {
 324.142 -      fillButtonEvent(&ev, ButtonRelease, display, window);
 324.143 -      status = XSendEvent(display, window, False, ButtonReleaseMask,
 324.144 -                          (XEvent *)&ev);
 324.145 -  }
 324.146 -  return status;
 324.147 -}
 324.148 -
 324.149 -Widget
 324.150 -awt_util_createWarningWindow(Widget parent, char *warning)
 324.151 -{
 324.152 -    Widget warningWindow;
 324.153 -#ifdef NETSCAPE
 324.154 -    extern Widget FE_MakeAppletSecurityChrome(Widget parent, char* message);
 324.155 -    warningWindow = FE_MakeAppletSecurityChrome(parent, warning);
 324.156 -#else
 324.157 -    Widget label;
 324.158 -    int32_t argc;
 324.159 -#define MAX_ARGC 10
 324.160 -    Arg args[MAX_ARGC];
 324.161 -    int32_t screen = 0;
 324.162 -    int32_t i;
 324.163 -    AwtGraphicsConfigDataPtr adata;
 324.164 -    extern int32_t awt_numScreens;
 324.165 -
 324.166 -    Pixel gray;
 324.167 -    Pixel black;
 324.168 -
 324.169 -    for (i = 0; i < awt_numScreens; i++) {
 324.170 -        if (ScreenOfDisplay(awt_display, i) == XtScreen(parent)) {
 324.171 -            screen = i;
 324.172 -            break;
 324.173 -        }
 324.174 -    }
 324.175 -    adata = getDefaultConfig(screen);
 324.176 -
 324.177 -    gray = adata->AwtColorMatch(192, 192, 192, adata);
 324.178 -    black = adata->AwtColorMatch(0, 0, 0, adata);
 324.179 -
 324.180 -    argc = 0;
 324.181 -    XtSetArg(args[argc], XmNbackground, gray); argc++;
 324.182 -    XtSetArg(args[argc], XmNmarginHeight, 0); argc++;
 324.183 -    XtSetArg(args[argc], XmNmarginWidth, 0); argc++;
 324.184 -    XtSetArg (args[argc], XmNscreen, XtScreen(parent)); argc++;
 324.185 -
 324.186 -    DASSERT(!(argc > MAX_ARGC));
 324.187 -    warningWindow =  XmCreateForm(parent, "main", args, argc);
 324.188 -
 324.189 -    XtManageChild(warningWindow);
 324.190 -    label = XtVaCreateManagedWidget(warning,
 324.191 -                                    xmLabelWidgetClass, warningWindow,
 324.192 -                                    XmNhighlightThickness, 0,
 324.193 -                                    XmNbackground, gray,
 324.194 -                                    XmNforeground, black,
 324.195 -                                    XmNalignment, XmALIGNMENT_CENTER,
 324.196 -                                    XmNrecomputeSize, False,
 324.197 -                                    NULL);
 324.198 -    XtVaSetValues(label,
 324.199 -                  XmNbottomAttachment, XmATTACH_FORM,
 324.200 -                  XmNtopAttachment, XmATTACH_FORM,
 324.201 -                  XmNleftAttachment, XmATTACH_FORM,
 324.202 -                  XmNrightAttachment, XmATTACH_FORM,
 324.203 -                  NULL);
 324.204 -#endif
 324.205 -    return warningWindow;
 324.206 -}
 324.207 -
 324.208 -void
 324.209 -awt_setWidgetGravity(Widget w, int32_t gravity)
 324.210 -{
 324.211 -    XSetWindowAttributes    xattr;
 324.212 -    Window  win = XtWindow(w);
 324.213 -
 324.214 -    if (win != None) {
 324.215 -        xattr.bit_gravity = StaticGravity;
 324.216 -        xattr.win_gravity = StaticGravity;
 324.217 -        XChangeWindowAttributes(XtDisplay(w), win,
 324.218 -                                CWBitGravity|CWWinGravity,
 324.219 -                                &xattr);
 324.220 -    }
 324.221 -}
 324.222 -
 324.223 -Widget get_shell_focused_widget(Widget w) {
 324.224 -    while (w != NULL && !XtIsShell(w)) {
 324.225 -        w = XtParent(w);
 324.226 -    }
 324.227 -    if (w != NULL) {
 324.228 -        return XmGetFocusWidget(w);
 324.229 -    } else {
 324.230 -        return NULL;
 324.231 -    }
 324.232 -}
 324.233 -
 324.234 -void
 324.235 -awt_util_reshape(Widget w, jint x, jint y, jint wd, jint ht)
 324.236 -{
 324.237 -    Widget parent;
 324.238 -    Dimension ww, wh;
 324.239 -    Position wx, wy;
 324.240 -    Boolean move = False;
 324.241 -    Boolean resize = False;
 324.242 -    Boolean mapped_when_managed = False;
 324.243 -    Boolean need_to_unmanage = True;
 324.244 -    Widget saved_focus_widget = NULL;
 324.245 -
 324.246 -    if (w == NULL) {
 324.247 -        JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 324.248 -        JNU_ThrowNullPointerException(env,"NullPointerException");
 324.249 -        return;
 324.250 -    }
 324.251 -    parent = XtParent(w);
 324.252 -
 324.253 -    /* Aim: hack to prevent direct children of scrollpane from
 324.254 -     * being unmanaged during a reshape operation (which results
 324.255 -     * in too many expose events).
 324.256 -     */
 324.257 -    if (parent != NULL && XtParent(parent) != NULL &&
 324.258 -        XtIsSubclass(XtParent(parent), xmScrolledWindowWidgetClass)) {
 324.259 -        need_to_unmanage = False;
 324.260 -    }
 324.261 -
 324.262 -    XtVaGetValues(w,
 324.263 -                  XmNwidth, &ww,
 324.264 -                  XmNheight, &wh,
 324.265 -                  XmNx, &wx,
 324.266 -                  XmNy, &wy,
 324.267 -                  NULL);
 324.268 -
 324.269 -    if (x != wx || y != wy) {
 324.270 -        move = True;
 324.271 -    }
 324.272 -    if (wd != ww || ht != wh) {
 324.273 -        resize = True;
 324.274 -    }
 324.275 -    if (!move && !resize) {
 324.276 -        return;
 324.277 -    }
 324.278 -
 324.279 -    if (need_to_unmanage) {
 324.280 -        if (!resize) {
 324.281 -            mapped_when_managed = w->core.mapped_when_managed;
 324.282 -            w->core.mapped_when_managed = False;
 324.283 -        }
 324.284 -        saved_focus_widget = get_shell_focused_widget(w);
 324.285 -        XtUnmanageChild(w);
 324.286 -    }
 324.287 -
 324.288 -    /* GES: AVH's hack:
 324.289 -     * Motif ignores attempts to move a toplevel window to 0,0.
 324.290 -     * Instead we set the position to 1,1. The expected value is
 324.291 -     * returned by Frame.getBounds() since it uses the internally
 324.292 -     * held rectangle rather than querying the peer.
 324.293 -     * N.B. [pauly, 9/97]  This is only required for wm shells
 324.294 -     * under the Motif Window Manager (MWM), not for any others.
 324.295 -     * Note. Utilizes C short-circuiting if w is not a wm shell.
 324.296 -     */
 324.297 -    if ((x == 0) && (y == 0) &&
 324.298 -        (XtIsSubclass(w, wmShellWidgetClass)) &&
 324.299 -        (XmIsMotifWMRunning(w))) {
 324.300 -        XtVaSetValues(w, XmNx, 1, XmNy, 1, NULL);
 324.301 -    }
 324.302 -
 324.303 -    if (move && !resize) {
 324.304 -        XtVaSetValues(w, XmNx, x, XmNy, y, NULL);
 324.305 -
 324.306 -    } else if (resize && !move) {
 324.307 -        XtVaSetValues(w,
 324.308 -                      XmNwidth, (wd > 0) ? wd : 1,
 324.309 -                      XmNheight, (ht > 0) ? ht : 1,
 324.310 -                      NULL);
 324.311 -
 324.312 -    } else  {
 324.313 -        XtVaSetValues(w,
 324.314 -                  XmNx, x,
 324.315 -                  XmNy, y,
 324.316 -                  XmNwidth, (wd > 0) ? wd : 1,
 324.317 -                  XmNheight, (ht > 0) ? ht : 1,
 324.318 -                  NULL);
 324.319 -    }
 324.320 -
 324.321 -    if (need_to_unmanage) {
 324.322 -        XtManageChild(w);
 324.323 -        if (!resize) {
 324.324 -            w->core.mapped_when_managed = mapped_when_managed;
 324.325 -        }
 324.326 -        if (saved_focus_widget != NULL) {
 324.327 -            Boolean result = XmProcessTraversal(saved_focus_widget, XmTRAVERSE_CURRENT);
 324.328 -            if (!result)
 324.329 -            {
 324.330 -                Widget shell = saved_focus_widget;
 324.331 -                while(shell != NULL && !XtIsShell(shell)) {
 324.332 -                    shell = XtParent(shell);
 324.333 -                }
 324.334 -                XtSetKeyboardFocus(shell, saved_focus_widget);
 324.335 -            }
 324.336 -        }
 324.337 -    }
 324.338 -}
 324.339 -
 324.340 -void
 324.341 -awt_util_hide(Widget w)
 324.342 -{
 324.343 -    if (w == NULL) {
 324.344 -        JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 324.345 -        JNU_ThrowNullPointerException(env,"NullPointerException");
 324.346 -        return;
 324.347 -    }
 324.348 -    XtSetMappedWhenManaged(w, False);
 324.349 -}
 324.350 -
 324.351 -void
 324.352 -awt_util_show(Widget w)
 324.353 -{
 324.354 -/*
 324.355 -    extern Boolean  scrollBugWorkAround;
 324.356 -*/
 324.357 -    if (w == NULL) {
 324.358 -        JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 324.359 -        JNU_ThrowNullPointerException(env,"NullPointerException");
 324.360 -        return;
 324.361 -    }
 324.362 -    XtSetMappedWhenManaged(w, True);
 324.363 -/*
 324.364 -  XXX: causes problems on 2.5
 324.365 -    if (!scrollBugWorkAround) {
 324.366 -        awt_setWidgetGravity(w, StaticGravity);
 324.367 -    }
 324.368 -*/
 324.369 -}
 324.370 -
 324.371 -void
 324.372 -awt_util_enable(Widget w)
 324.373 -{
 324.374 -    XtSetSensitive(w, True);
 324.375 -}
 324.376 -
 324.377 -void
 324.378 -awt_util_disable(Widget w)
 324.379 -{
 324.380 -    XtSetSensitive(w, False);
 324.381 -}
 324.382 -
 324.383 -void
 324.384 -awt_util_mapChildren(Widget w, void (*func)(Widget,void *),
 324.385 -                     int32_t applyToCurrent, void *data) {
 324.386 -    WidgetList                  wlist;
 324.387 -    Cardinal                    wlen = 0;
 324.388 -    Cardinal                    i;
 324.389 -
 324.390 -    /* The widget may have been destroyed by another thread. */
 324.391 -    if ((w == NULL) || (!XtIsObject(w)) || (w->core.being_destroyed))
 324.392 -        return;
 324.393 -
 324.394 -    if (applyToCurrent != 0) {
 324.395 -        (*func)(w, data);
 324.396 -    }
 324.397 -    if (!XtIsComposite(w)) {
 324.398 -        return;
 324.399 -    }
 324.400 -
 324.401 -    XtVaGetValues(w,
 324.402 -                  XmNchildren, &wlist,
 324.403 -                  XmNnumChildren, &wlen,
 324.404 -                  NULL);
 324.405 -    if (wlen > 0) {
 324.406 -        for (i=0; i < wlen; i++) {
 324.407 -            awt_util_mapChildren(wlist[i], func, 1, data);
 324.408 -        }
 324.409 -    }
 324.410 -}
 324.411 -
 324.412 -void
 324.413 -awt_changeAttributes(Display *dpy, Widget w, unsigned long mask,
 324.414 -                     XSetWindowAttributes *xattr)
 324.415 -{
 324.416 -    WidgetList          wlist;
 324.417 -    Cardinal            wlen = 0;
 324.418 -    Cardinal            i;
 324.419 -
 324.420 -    if (XtWindow(w) && XtIsRealized(w)) {
 324.421 -        XChangeWindowAttributes(dpy,
 324.422 -                                XtWindow(w),
 324.423 -                                mask,
 324.424 -                                xattr);
 324.425 -    } else {
 324.426 -        return;
 324.427 -    }
 324.428 -    XtVaGetValues(w,
 324.429 -                  XmNchildren, &wlist,
 324.430 -                  XmNnumChildren, &wlen,
 324.431 -                  NULL);
 324.432 -    for (i = 0; i < wlen; i++) {
 324.433 -        if (XtWindow(wlist[i]) && XtIsRealized(wlist[i])) {
 324.434 -            XChangeWindowAttributes(dpy,
 324.435 -                                    XtWindow(wlist[i]),
 324.436 -                                    mask,
 324.437 -                                    xattr);
 324.438 -        }
 324.439 -    }
 324.440 -}
 324.441 -
 324.442 -static Widget prevWgt = NULL;
 324.443 -
 324.444 -static void
 324.445 -DestroyCB(Widget w, XtPointer client_data, XtPointer call_data) {
 324.446 -    if (prevWgt == w) {
 324.447 -        prevWgt = NULL;
 324.448 -    }
 324.449 -}
 324.450 -
 324.451 -int32_t
 324.452 -awt_util_setCursor(Widget w, Cursor c) {
 324.453 -    static Cursor prevCur = None;
 324.454 -
 324.455 -    if (XtIsRealized(w)) {
 324.456 -        unsigned long valuemask = 0;
 324.457 -        XSetWindowAttributes    attributes;
 324.458 -
 324.459 -        valuemask = CWCursor;
 324.460 -        if (prevWgt != NULL) {
 324.461 -            attributes.cursor = None;
 324.462 -            XChangeWindowAttributes(awt_display,
 324.463 -                        XtWindow(prevWgt),
 324.464 -                        valuemask,
 324.465 -                        &attributes);
 324.466 -        }
 324.467 -
 324.468 -        if (c == None) {
 324.469 -            c = prevCur;
 324.470 -            if (w != NULL) {
 324.471 -                XtAddCallback(w, XmNdestroyCallback, DestroyCB, NULL);
 324.472 -            }
 324.473 -            prevWgt = w;
 324.474 -        } else {
 324.475 -            prevCur = c;
 324.476 -            prevWgt = NULL;
 324.477 -        }
 324.478 -        attributes.cursor = c;
 324.479 -        XChangeWindowAttributes(awt_display,
 324.480 -                                XtWindow(w),
 324.481 -                                valuemask,
 324.482 -                                &attributes);
 324.483 -        XFlush(awt_display);
 324.484 -        return 1;
 324.485 -    } else
 324.486 -        return 0;
 324.487 -}
 324.488 -
 324.489 -void
 324.490 -awt_util_convertEventTimeAndModifiers(XEvent *event,
 324.491 -                                      ConvertEventTimeAndModifiers *output) {
 324.492 -    switch (event->type) {
 324.493 -    case KeyPress:
 324.494 -    case KeyRelease:
 324.495 -        output->when = awt_util_nowMillisUTC_offset(event->xkey.time);
 324.496 -        output->modifiers = getModifiers(event->xkey.state, 0, 0);
 324.497 -        break;
 324.498 -    case ButtonPress:
 324.499 -    case ButtonRelease:
 324.500 -        output->when = awt_util_nowMillisUTC_offset(event->xbutton.time);
 324.501 -        output->modifiers = getModifiers(event->xbutton.state,
 324.502 -            getButton(event->xbutton.button), 0);
 324.503 -        break;
 324.504 -    default:
 324.505 -        output->when = awt_util_nowMillisUTC();
 324.506 -        output->modifiers =0;
 324.507 -        break;
 324.508 -    }
 324.509 -}
 324.510 -
 324.511 -
 324.512 -/*
 324.513 -  Part fix for bug id 4017222. Return the widget at the given screen coords
 324.514 -  by searching the widget tree beginning at root. This function will return
 324.515 -  null if the pointer is not over the root widget or child of the root widget.
 324.516 -
 324.517 -  Additionally, this function will only return a Widget with non-nil XmNuserData.
 324.518 -  In 1.2.1, when the mouse was dragged over a Choice component, this function
 324.519 -  returned the GadgetButton associated with the Choice.  This GadgetButton had
 324.520 -  nil as its XmNuserData.  This lead to a crash when the nil XmNuserData was
 324.521 -  extracted and used as a reference to a peer.  Ooops.
 324.522 -  Now the GadgetButton is not returned and the function goes on to find a widget
 324.523 -  which contains the correct peer reference in XmNuserData.
 324.524 -*/
 324.525 -Widget
 324.526 -awt_WidgetAtXY(Widget root, Position pointerx, Position pointery) {
 324.527 -  Widget answer = NULL;
 324.528 -
 324.529 -  if(!root) return NULL;
 324.530 -
 324.531 -  if(XtIsComposite(root)) {
 324.532 -    int32_t i=0;
 324.533 -    WidgetList wl=NULL;
 324.534 -    Cardinal wlen=0;
 324.535 -
 324.536 -    XtVaGetValues(root, XmNchildren, &wl, XmNnumChildren, &wlen, NULL);
 324.537 -
 324.538 -    if(wlen>0) {
 324.539 -      for(i=0; i<wlen && !answer; i++) {
 324.540 -        answer = awt_WidgetAtXY(wl[i], pointerx, pointery);
 324.541 -      }
 324.542 -    }
 324.543 -  }
 324.544 -
 324.545 -  if(!answer) {
 324.546 -    Position wx=0, wy=0;
 324.547 -    Dimension width=0, height=0;
 324.548 -    int32_t lastx=0, lasty=0;
 324.549 -    XtPointer widgetUserData=NULL;
 324.550 -
 324.551 -    XtVaGetValues(root, XmNwidth, &width, XmNheight, &height,
 324.552 -                  XmNuserData, &widgetUserData,
 324.553 -                  NULL);
 324.554 -
 324.555 -    XtTranslateCoords(root, 0, 0, &wx, &wy);
 324.556 -    lastx = wx + width;
 324.557 -    lasty = wy + height;
 324.558 -
 324.559 -    if(pointerx>=wx && pointerx<=lastx && pointery>=wy && pointery<=lasty &&
 324.560 -           widgetUserData)
 324.561 -        answer = root;
 324.562 -  }
 324.563 -
 324.564 -  return answer;
 324.565 -}
 324.566 -#ifdef __linux__
 324.567 -
 324.568 -
 324.569 -#define MAXARGS 10
 324.570 -static Arg xic_vlist[MAXARGS];
 324.571 -static Arg status_vlist[MAXARGS];
 324.572 -static Arg preedit_vlist[MAXARGS];
 324.573 -
 324.574 -#define NO_ARG_VAL -1
 324.575 -#define SEPARATOR_HEIGHT 2
 324.576 -
 324.577 -static XFontSet extract_fontset(XmFontList);
 324.578 -
 324.579 -/* get_im_height: returns height of the input method status area in pixels.
 324.580 - *
 324.581 - * This function assumes that if any XIM related information cannot be
 324.582 - * queried then the app must not have an input method status area in the
 324.583 - * current locale and returns zero as the status area height
 324.584 - */
 324.585 -
 324.586 -static XtPointer*
 324.587 -get_im_info_ptr(Widget  w,
 324.588 -                Boolean create)
 324.589 -{
 324.590 -  Widget p;
 324.591 -  XmVendorShellExtObject ve;
 324.592 -  XmWidgetExtData extData;
 324.593 -  XmImShellInfo im_info;
 324.594 -  XmImDisplayInfo xim_info;
 324.595 -
 324.596 -  if (w == NULL)
 324.597 -    return NULL;
 324.598 -
 324.599 -  p = w;
 324.600 -  while (!XtIsShell(p))
 324.601 -    p = XtParent(p);
 324.602 -
 324.603 -  /* Check extension data since app could be attempting to create
 324.604 -   * a text widget as child of menu shell.  This is illegal, and will
 324.605 -   * be detected later, but check here so we don't core dump.
 324.606 -   */
 324.607 -  if ((extData = _XmGetWidgetExtData((Widget)p, XmSHELL_EXTENSION)) == NULL)
 324.608 -    return NULL;
 324.609 -
 324.610 -  ve = (XmVendorShellExtObject) extData->widget;
 324.611 -
 324.612 -  return &ve->vendor.im_info;
 324.613 -}
 324.614 -
 324.615 -static XmImShellInfo
 324.616 -get_im_info(Widget w,
 324.617 -            Boolean create)
 324.618 -{
 324.619 -  XmImShellInfo* ptr = (XmImShellInfo *) get_im_info_ptr(w, create);
 324.620 -  if (ptr != NULL)
 324.621 -    return *ptr;
 324.622 -  else
 324.623 -    return NULL;
 324.624 -}
 324.625 -
 324.626 -#endif /* !linux */
 324.627 -
 324.628 -Widget
 324.629 -awt_util_getXICStatusAreaWindow(Widget w)
 324.630 -{
 324.631 -    while (!XtIsShell(w)){
 324.632 -        w = XtParent(w);
 324.633 -    }
 324.634 -    return w;
 324.635 -}
 324.636 -
 324.637 -#ifdef __linux__
 324.638 -static XRectangle geometryRect;
 324.639 -XVaNestedList awt_util_getXICStatusAreaList(Widget w)
 324.640 -{
 324.641 -    XIC xic;
 324.642 -    XmImXICInfo icp;
 324.643 -    XmVendorShellExtObject ve;
 324.644 -    XmWidgetExtData extData;
 324.645 -    XmImShellInfo im_info;
 324.646 -    XmFontList fl=NULL;
 324.647 -
 324.648 -    XRectangle  *ssgeometry = &geometryRect;
 324.649 -    XRectangle geomRect ;
 324.650 -    XRectangle *im_rect;
 324.651 -    XFontSet   *im_font;
 324.652 -
 324.653 -    Pixel bg ;
 324.654 -    Pixel fg ;
 324.655 -    Dimension height, width ;
 324.656 -    Position x,y ;
 324.657 -    Pixmap bpm, *bpmout ;
 324.658 -
 324.659 -    XVaNestedList list = NULL;
 324.660 -
 324.661 -    char *ret;
 324.662 -    Widget p=w;
 324.663 -
 324.664 -    while (!XtIsShell(p)) {
 324.665 -        p = XtParent(p);
 324.666 -    }
 324.667 -
 324.668 -    XtVaGetValues(p,
 324.669 -        XmNx, &x,
 324.670 -        XmNy, &y,
 324.671 -        XmNwidth, &width,
 324.672 -        XmNheight, &height,
 324.673 -        XmNbackgroundPixmap, &bpm,
 324.674 -        NULL);
 324.675 -
 324.676 -    extData = _XmGetWidgetExtData((Widget) p, XmSHELL_EXTENSION);
 324.677 -    if (extData == NULL) {
 324.678 -        return NULL;
 324.679 -    }
 324.680 -    ve = (XmVendorShellExtObject) extData->widget;
 324.681 -    im_info = get_im_info(w, False);
 324.682 -
 324.683 -    if (im_info == NULL) {
 324.684 -        return NULL;
 324.685 -    } else {
 324.686 -        icp = im_info->iclist;
 324.687 -    }
 324.688 -
 324.689 -    if (icp) {
 324.690 -        /*
 324.691 -         * We have at least a textfield/textarea in the frame, use the
 324.692 -         * first one.
 324.693 -         */
 324.694 -        ssgeometry->x = 0;
 324.695 -        ssgeometry->y = height - icp->sp_height;
 324.696 -        ssgeometry->width = icp->status_width;
 324.697 -        ssgeometry->height = icp->sp_height;
 324.698 -        XtVaGetValues(w, XmNbackground, &bg, NULL);
 324.699 -        XtVaGetValues(w, XmNforeground, &fg, NULL);
 324.700 -        XtVaGetValues(w, XmNfontList, &fl, NULL);
 324.701 -        /*
 324.702 -         * use motif TextComponent's resource
 324.703 -         */
 324.704 -
 324.705 -        list = XVaCreateNestedList(0,
 324.706 -                        XNFontSet, extract_fontset(fl),
 324.707 -                        XNArea, ssgeometry,
 324.708 -                        XNBackground, bg,
 324.709 -                        XNForeground, fg,
 324.710 -                        NULL);
 324.711 -   }
 324.712 -   return list ;
 324.713 -}
 324.714 -
 324.715 -static XFontSet
 324.716 -extract_fontset(XmFontList fl)
 324.717 -{
 324.718 -    XmFontContext context;
 324.719 -    XmFontListEntry next_entry;
 324.720 -    XmFontType type_return;
 324.721 -    XtPointer tmp_font;
 324.722 -    XFontSet first_fs = NULL;
 324.723 -    char *font_tag;
 324.724 -
 324.725 -    if (!XmFontListInitFontContext(&context, fl))
 324.726 -        return NULL;
 324.727 -
 324.728 -    do {
 324.729 -        next_entry = XmFontListNextEntry(context);
 324.730 -        if (next_entry) {
 324.731 -            tmp_font = XmFontListEntryGetFont(next_entry, &type_return);
 324.732 -            if (type_return == XmFONT_IS_FONTSET) {
 324.733 -                font_tag = XmFontListEntryGetTag(next_entry);
 324.734 -                if (!strcmp(font_tag, XmFONTLIST_DEFAULT_TAG)) {
 324.735 -                    XmFontListFreeFontContext(context);
 324.736 -                    XtFree(font_tag);
 324.737 -                    return (XFontSet) tmp_font;
 324.738 -                }
 324.739 -                XtFree(font_tag);
 324.740 -                if (first_fs == NULL)
 324.741 -                    first_fs = (XFontSet) tmp_font;
 324.742 -            }
 324.743 -        }
 324.744 -    } while (next_entry);
 324.745 -
 324.746 -    XmFontListFreeFontContext(context);
 324.747 -    return first_fs;
 324.748 -}
 324.749 -#endif
 324.750 -
 324.751 -/*the caller does have the responsibility to free the memory return
 324.752 -  from this function...*/
 324.753 -char* awt_util_makeWMMenuItem(char *target, Atom protocol){
 324.754 -    char        *buf = NULL;
 324.755 -    int32_t         buflen = 0;
 324.756 -
 324.757 -    /*a label in a menuitem is not supposed to be a FullOfSpaceString... */
 324.758 -    buflen = strlen(target) * 3;
 324.759 -    buf = (char*)malloc(buflen + 20);
 324.760 -    if (buf == NULL){
 324.761 -        JNU_ThrowOutOfMemoryError((JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2), NULL);
 324.762 -    }
 324.763 -    else{
 324.764 -      int32_t   off = 0;
 324.765 -      char  *ptr = target;
 324.766 -      while ((off < (buflen - 20)) && (*ptr != '\0')){
 324.767 -        if (*ptr == ' '){
 324.768 -          *(buf + off++) = 0x5c;
 324.769 -        }
 324.770 -        *(buf + off++) = *ptr++;
 324.771 -      }
 324.772 -      sprintf(buf + off, " f.send_msg %ld", protocol);
 324.773 -    }
 324.774 -    return buf;
 324.775 -}
 324.776 -
 324.777 -/*
 324.778 - * This callback proc is installed via setting the XmNinsertPosition
 324.779 - * resource on a widget. It ensures that components added
 324.780 - * to a widget are inserted in the correct z-order position
 324.781 - * to match up with their peer/target ordering in Container.java
 324.782 - */
 324.783 -Cardinal
 324.784 -awt_util_insertCallback(Widget w)
 324.785 -{
 324.786 -    jobject peer;
 324.787 -    WidgetList children;
 324.788 -    Cardinal num_children;
 324.789 -    Widget parent;
 324.790 -    XtPointer userdata;
 324.791 -    Cardinal index;
 324.792 -    int32_t pos;
 324.793 -    JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 324.794 -
 324.795 -    parent = XtParent(w);
 324.796 -    XtVaGetValues(parent,
 324.797 -                  XmNnumChildren, &num_children,
 324.798 -                  XmNchildren, &children,
 324.799 -                  NULL);
 324.800 -    XtVaGetValues(w, XmNuserData, &userdata, NULL);
 324.801 -
 324.802 -    index = num_children;         /* default is to add to end */
 324.803 -
 324.804 -    if (userdata != NULL) {
 324.805 -        peer = (jobject) userdata;
 324.806 -
 324.807 -        // SECURITY: We are running on the privileged toolkit thread.
 324.808 -        //           The peer must *NOT* call into user code
 324.809 -        pos = (int32_t) JNU_CallMethodByName(env
 324.810 -                                          ,NULL
 324.811 -                                          ,(jobject) peer
 324.812 -                                          ,"getZOrderPosition_NoClientCode"
 324.813 -                                          ,"()I").i;
 324.814 -        if ((*env)->ExceptionOccurred(env)) {
 324.815 -            (*env)->ExceptionDescribe(env);
 324.816 -            (*env)->ExceptionClear(env);
 324.817 -        }
 324.818 -        index = (Cardinal) (pos != -1 ? pos : num_children);
 324.819 -    }
 324.820 -    return index;
 324.821 -}
 324.822 -
 324.823 -void
 324.824 -awt_util_consumeAllXEvents(Widget widget)
 324.825 -{
 324.826 -    /* Remove all queued X Events for the window of the widget. */
 324.827 -
 324.828 -#define ALL_EVENTS_MASK 0xFFFF
 324.829 -
 324.830 -    XEvent xev;
 324.831 -
 324.832 -    XFlush(awt_display);
 324.833 -    while (XCheckWindowEvent(awt_display, XtWindow(widget),
 324.834 -               ALL_EVENTS_MASK, &xev)) ;
 324.835 -}
 324.836 -
 324.837 -#endif /* XAWT */
 324.838 -/**
 324.839 - * Gets the thread we are currently executing on
 324.840 - */
 324.841 -jobject
 324.842 -awtJNI_GetCurrentThread(JNIEnv *env) {
 324.843 -    static jclass threadClass = NULL;
 324.844 -    static jmethodID currentThreadMethodID = NULL;
 324.845 -
 324.846 -    jobject currentThread = NULL;
 324.847 -
 324.848 -    /* Initialize our java identifiers once. Checking before locking
 324.849 -     * is a huge performance win.
 324.850 -     */
 324.851 -    if (threadClass == NULL) {
 324.852 -        // should enter a monitor here...
 324.853 -        Boolean err = FALSE;
 324.854 -        if (threadClass == NULL) {
 324.855 -            jclass tc = (*env)->FindClass(env, "java/lang/Thread");
 324.856 -            threadClass = (*env)->NewGlobalRef(env, tc);
 324.857 -            if (threadClass != NULL) {
 324.858 -                currentThreadMethodID = (*env)->GetStaticMethodID(env,
 324.859 -                                              threadClass,
 324.860 -                                              "currentThread",
 324.861 -                                              "()Ljava/lang/Thread;"
 324.862 -                                                );
 324.863 -            }
 324.864 -        }
 324.865 -        if (currentThreadMethodID == NULL) {
 324.866 -            threadClass = NULL;
 324.867 -            err = TRUE;
 324.868 -        }
 324.869 -        if (err) {
 324.870 -            return NULL;
 324.871 -        }
 324.872 -    } /* threadClass == NULL*/
 324.873 -
 324.874 -    currentThread = (*env)->CallStaticObjectMethod(
 324.875 -                        env, threadClass, currentThreadMethodID);
 324.876 -    DASSERT(!((*env)->ExceptionOccurred(env)));
 324.877 -    /*JNU_PrintString(env, "getCurrentThread() -> ", JNU_ToString(env,currentThread));*/
 324.878 -    return currentThread;
 324.879 -} /* awtJNI_GetCurrentThread() */
 324.880 -
 324.881  void
 324.882  awtJNI_ThreadYield(JNIEnv *env) {
 324.883  
 324.884 @@ -956,426 +105,3 @@
 324.885      (*env)->CallStaticVoidMethod(env, threadClass, yieldMethodID);
 324.886      DASSERT(!((*env)->ExceptionOccurred(env)));
 324.887  } /* awtJNI_ThreadYield() */
 324.888 -
 324.889 -#ifndef XAWT
 324.890 -
 324.891 -void
 324.892 -awt_util_cleanupBeforeDestroyWidget(Widget widget)
 324.893 -{
 324.894 -    /* Bug 4017222: Drag processing uses global prevWidget. */
 324.895 -    if (widget == prevWidget) {
 324.896 -        prevWidget = NULL;
 324.897 -    }
 324.898 -}
 324.899 -
 324.900 -static Boolean timeStampUpdated = False;
 324.901 -
 324.902 -static int32_t
 324.903 -isTimeStampUpdated(void* p) {
 324.904 -    return timeStampUpdated;
 324.905 -}
 324.906 -
 324.907 -static void
 324.908 -propertyChangeEventHandler(Widget w, XtPointer client_data,
 324.909 -                           XEvent* event, Boolean* continue_to_dispatch) {
 324.910 -    timeStampUpdated = True;
 324.911 -}
 324.912 -
 324.913 -/*
 324.914 - * If the application doesn't receive events with timestamp for a long time
 324.915 - * XtLastTimestampProcessed() will return out-of-date value. This may cause
 324.916 - * selection handling routines to fail (see BugTraq ID 4085183).
 324.917 - * This routine is to resolve this problem. It queries the current X server
 324.918 - * time by appending a zero-length data to a property as prescribed by
 324.919 - * X11 Reference Manual.
 324.920 - * Note that this is a round-trip request, so it can be slow. If you know
 324.921 - * that the Xt timestamp is up-to-date use XtLastTimestampProcessed().
 324.922 - */
 324.923 -Time
 324.924 -awt_util_getCurrentServerTime() {
 324.925 -
 324.926 -    JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 324.927 -    static Atom _XA_JAVA_TIME_PROPERTY_ATOM = 0;
 324.928 -    Time server_time = 0;
 324.929 -
 324.930 -    AWT_LOCK();
 324.931 -
 324.932 -    if (_XA_JAVA_TIME_PROPERTY_ATOM == 0) {
 324.933 -        XtAddEventHandler(awt_root_shell, PropertyChangeMask, False,
 324.934 -                          propertyChangeEventHandler, NULL);
 324.935 -        _XA_JAVA_TIME_PROPERTY_ATOM = XInternAtom(awt_display, "_SUNW_JAVA_AWT_TIME", False);
 324.936 -    }
 324.937 -
 324.938 -    timeStampUpdated = False;
 324.939 -    XChangeProperty(awt_display, XtWindow(awt_root_shell),
 324.940 -                    _XA_JAVA_TIME_PROPERTY_ATOM, XA_ATOM, 32, PropModeAppend,
 324.941 -                    (unsigned char *)"", 0);
 324.942 -    XFlush(awt_display);
 324.943 -
 324.944 -    if (awt_currentThreadIsPrivileged(env)) {
 324.945 -        XEvent event;
 324.946 -        XMaskEvent(awt_display, PropertyChangeMask, &event);
 324.947 -        XtDispatchEvent(&event);
 324.948 -    } else {
 324.949 -        awt_MToolkit_modalWait(isTimeStampUpdated, NULL);
 324.950 -    }
 324.951 -    server_time = XtLastTimestampProcessed(awt_display);
 324.952 -
 324.953 -    AWT_UNLOCK();
 324.954 -
 324.955 -    return server_time;
 324.956 -}
 324.957 -
 324.958 -/*
 324.959 - * This function is stolen from /src/solaris/hpi/src/system_md.c
 324.960 - * It is used in setting the time in Java-level InputEvents
 324.961 - */
 324.962 -jlong
 324.963 -awt_util_nowMillisUTC()
 324.964 -{
 324.965 -    struct timeval t;
 324.966 -    gettimeofday(&t, NULL);
 324.967 -    return ((jlong)t.tv_sec) * 1000 + (jlong)(t.tv_usec/1000);
 324.968 -}
 324.969 -
 324.970 -/*
 324.971 - * This function converts between the X server time (number of milliseconds
 324.972 - * since the last server reset) and the UTC time for the 'when' field of an
 324.973 - * InputEvent (or another event type with a timestamp).
 324.974 - */
 324.975 -jlong
 324.976 -awt_util_nowMillisUTC_offset(Time server_offset)
 324.977 -{
 324.978 -    /*
 324.979 -     * Because Time is of type 'unsigned long', it is possible that Time will
 324.980 -     * never wrap when using 64-bit Xlib. However, if a 64-bit client
 324.981 -     * connects to a 32-bit server, I suspect the values will still wrap. So
 324.982 -     * we should not attempt to remove the wrap checking even if _LP64 is
 324.983 -     * true.
 324.984 -     */
 324.985 -    static const jlong WRAP_TIME_MILLIS = (jlong)((uint32_t)-1);
 324.986 -    static jlong reset_time_utc;
 324.987 -
 324.988 -    jlong current_time_utc = awt_util_nowMillisUTC();
 324.989 -
 324.990 -    if ((current_time_utc - reset_time_utc) > WRAP_TIME_MILLIS) {
 324.991 -        reset_time_utc = awt_util_nowMillisUTC() -
 324.992 -            awt_util_getCurrentServerTime();
 324.993 -    }
 324.994 -
 324.995 -    return reset_time_utc + server_offset;
 324.996 -}
 324.997 -
 324.998 -void awt_util_do_wheel_scroll(Widget scrolled_window, jint scrollType,
 324.999 -                              jint scrollAmt, jint wheelAmt) {
324.1000 -    Widget scrollbar = NULL;
324.1001 -    int value;
324.1002 -    int slider_size;
324.1003 -    int min;
324.1004 -    int max;
324.1005 -    int increment;
324.1006 -    int page_increment;
324.1007 -    int scrollAdjustment;
324.1008 -    int newValue;
324.1009 -
324.1010 -    /* TODO:
324.1011 -     * If a TextArea's scrollbar policy is set to never, it should still
324.1012 -     * wheel scroll, but right now it doesn't.
324.1013 -     */
324.1014 -
324.1015 -    scrollbar = awt_util_get_scrollbar_to_scroll(scrolled_window);
324.1016 -    if (scrollbar == NULL) { /* no suitable scrollbar for scrolling */
324.1017 -        return;
324.1018 -    }
324.1019 -
324.1020 -    XtVaGetValues(scrollbar, XmNvalue, &value,
324.1021 -                             XmNsliderSize, &slider_size,
324.1022 -                             XmNminimum, &min,
324.1023 -                             XmNmaximum, &max,
324.1024 -                             XmNincrement, &increment,
324.1025 -                             XmNpageIncrement, &page_increment, NULL);
324.1026 -
324.1027 -    if (scrollType == java_awt_event_MouseWheelEvent_WHEEL_BLOCK_SCROLL) {
324.1028 -        scrollAdjustment = page_increment;
324.1029 -    }
324.1030 -    else { // WHEEL_UNIT_SCROLL
324.1031 -        scrollAdjustment = increment * scrollAmt;
324.1032 -    }
324.1033 -
324.1034 -    if (wheelAmt < 0) {
324.1035 -        // Don't need to check that newValue < max - slider_size because
324.1036 -        // newValue < current value.  If scrollAmt is ever user-configurable,
324.1037 -        // we'll have to check this.
324.1038 -        newValue = MAX(min, value+ (scrollAdjustment * wheelAmt));
324.1039 -    }
324.1040 -    else {
324.1041 -        newValue = MIN(max - slider_size,
324.1042 -                       value + (scrollAdjustment * wheelAmt));
324.1043 -    }
324.1044 -
324.1045 -    XtVaSetValues(scrollbar, XmNvalue, newValue, NULL);
324.1046 -    XtCallCallbacks(scrollbar, XmNvalueChangedCallback, NULL);
324.1047 -}
324.1048 -
324.1049 -
324.1050 -/* Given a ScrollWindow widget, return the Scrollbar that the wheel should
324.1051 - * scroll.  A null return value means that the ScrollWindow has a scrollbar
324.1052 - * display policy of none, or that neither scrollbar can be scrolled.
324.1053 - */
324.1054 -Widget awt_util_get_scrollbar_to_scroll(Widget scrolled_window) {
324.1055 -    Widget scrollbar = NULL;
324.1056 -    int value;
324.1057 -    int slider_size;
324.1058 -    int min;
324.1059 -    int max;
324.1060 -
324.1061 -    /* first, try the vertical scrollbar */
324.1062 -    XtVaGetValues(scrolled_window, XmNverticalScrollBar, &scrollbar, NULL);
324.1063 -    if (scrollbar != NULL) {
324.1064 -        XtVaGetValues(scrollbar, XmNvalue, &value,
324.1065 -                                 XmNsliderSize, &slider_size,
324.1066 -                                 XmNminimum, &min,
324.1067 -                                 XmNmaximum, &max, NULL);
324.1068 -        if (slider_size < max - min) {
324.1069 -            return scrollbar;
324.1070 -        }
324.1071 -    }
324.1072 -
324.1073 -    /* then, try the horiz */
324.1074 -    XtVaGetValues(scrolled_window, XmNhorizontalScrollBar, &scrollbar, NULL);
324.1075 -    if (scrollbar != NULL) {
324.1076 -        XtVaGetValues(scrollbar, XmNvalue, &value,
324.1077 -                                 XmNsliderSize, &slider_size,
324.1078 -                                 XmNminimum, &min,
324.1079 -                                 XmNmaximum, &max, NULL);
324.1080 -        if (slider_size < max - min) {
324.1081 -            return scrollbar;
324.1082 -        }
324.1083 -    }
324.1084 -    /* neither is suitable for scrolling */
324.1085 -    return NULL;
324.1086 -}
324.1087 -
324.1088 -EmbeddedFrame *theEmbeddedFrameList = NULL;
324.1089 -
324.1090 -static void awt_util_updateXtCoordinatesForEmbeddedFrame(Widget ef)
324.1091 -{
324.1092 -    Window ef_window;
324.1093 -    Window win;
324.1094 -    int32_t x, y;
324.1095 -    ef_window = XtWindow(ef);
324.1096 -    if (ef_window != None) {
324.1097 -        if (XTranslateCoordinates(awt_display, ef_window,
324.1098 -            RootWindowOfScreen(XtScreen(ef)),
324.1099 -            0, 0, &x, &y, &win)) {
324.1100 -            DTRACE_PRINTLN("correcting coordinates");
324.1101 -            ef->core.x = x;
324.1102 -            ef->core.y = y;
324.1103 -        }
324.1104 -    }
324.1105 -}
324.1106 -
324.1107 -Boolean awt_util_processEventForEmbeddedFrame(XEvent *ev)
324.1108 -{
324.1109 -    EmbeddedFrame *ef;
324.1110 -    Boolean dummy;
324.1111 -    Boolean eventProcessed = False;
324.1112 -    switch (ev->type) {
324.1113 -    case FocusIn:
324.1114 -    case FocusOut:
324.1115 -        ef = theEmbeddedFrameList;
324.1116 -        while (ef != NULL) {
324.1117 -            if (ef->frameContainer == ev->xfocus.window) {
324.1118 -                eventProcessed = True;
324.1119 -                if (isXEmbedActiveByWindow(XtWindow(ef->embeddedFrame))) {
324.1120 -                    return True;
324.1121 -                }
324.1122 -                // pretend that the embedded frame gets a focus event
324.1123 -                // the event's window field is not the same as
324.1124 -                // the embeddedFrame's widget, but luckily the shellEH
324.1125 -                // doesnt seem to care about this.
324.1126 -                shellEH(ef->embeddedFrame, ef->javaRef, ev, &dummy);
324.1127 -            }
324.1128 -            ef = ef->next;
324.1129 -        }
324.1130 -        return eventProcessed;
324.1131 -    case ConfigureNotify:
324.1132 -        for (ef = theEmbeddedFrameList; ef != NULL; ef = ef->next) {
324.1133 -            awt_util_updateXtCoordinatesForEmbeddedFrame(ef->embeddedFrame);
324.1134 -        }
324.1135 -        return True;
324.1136 -    }
324.1137 -    return False;
324.1138 -}
324.1139 -
324.1140 -void awt_util_addEmbeddedFrame(Widget embeddedFrame, jobject javaRef)
324.1141 -{
324.1142 -    EmbeddedFrame *ef, *eflist;
324.1143 -    Atom WM_STATE;
324.1144 -    Window win;
324.1145 -    Window parent, root;
324.1146 -    Window *children;
324.1147 -    uint32_t nchildren;
324.1148 -    Atom type = None;
324.1149 -    int32_t format;
324.1150 -    unsigned long nitems, after;
324.1151 -    unsigned char * data;
324.1152 -    XWindowAttributes win_attributes;
324.1153 -
324.1154 -    WM_STATE = XInternAtom(awt_display, "WM_STATE", True);
324.1155 -    if (WM_STATE == None) {
324.1156 -        return;
324.1157 -    }
324.1158 -    win = XtWindow(embeddedFrame);
324.1159 -    if (win == None)
324.1160 -        return;
324.1161 -    /*
324.1162 -     * according to XICCM, we search our toplevel window
324.1163 -     * by looking for WM_STATE property
324.1164 -     */
324.1165 -    while (True) {
324.1166 -        if (!XQueryTree(awt_display, win, &root, &parent,
324.1167 -            &children, &nchildren)) {
324.1168 -            return;
324.1169 -        }
324.1170 -        if (children) {
324.1171 -            XFree(children);
324.1172 -        }
324.1173 -        if (parent == NULL || parent == root) {
324.1174 -            return;
324.1175 -        }
324.1176 -        win = parent;
324.1177 -        /*
324.1178 -         * Add StructureNotifyMask through hierarchy upto toplevel
324.1179 -         */
324.1180 -        XGetWindowAttributes(awt_display, win, &win_attributes);
324.1181 -        XSelectInput(awt_display, win, win_attributes.your_event_mask |
324.1182 -                StructureNotifyMask);
324.1183 -
324.1184 -        if (XGetWindowProperty(awt_display, win, WM_STATE,
324.1185 -                0, 0, False, AnyPropertyType,
324.1186 -                &type, &format, &nitems, &after, &data) == Success) {
324.1187 -            XFree(data);
324.1188 -            if (type) {
324.1189 -                break;
324.1190 -            }
324.1191 -        }
324.1192 -    }
324.1193 -    ef = (EmbeddedFrame *) malloc(sizeof(EmbeddedFrame));
324.1194 -    if (ef == NULL) {
324.1195 -        JNU_ThrowOutOfMemoryError((JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2),
324.1196 -            "OutOfMemory in awt_util_addEmbeddedFrame");
324.1197 -        return;
324.1198 -    }
324.1199 -    ef->embeddedFrame = embeddedFrame;
324.1200 -    ef->frameContainer = win;
324.1201 -    ef->javaRef = javaRef;
324.1202 -    ef->eventSelectedPreviously = False;
324.1203 -    /* initialize the xt coordinates */
324.1204 -    awt_util_updateXtCoordinatesForEmbeddedFrame(embeddedFrame);
324.1205 -
324.1206 -    /*
324.1207 -     * go through the exisiting embedded frames see if we have
324.1208 -     * already selected the event on the same frameContainer
324.1209 -     */
324.1210 -    eflist = theEmbeddedFrameList;
324.1211 -    while (eflist != NULL) {
324.1212 -        if (eflist->frameContainer == win) {
324.1213 -            break;
324.1214 -        }
324.1215 -        eflist = eflist->next;
324.1216 -    }
324.1217 -    if (eflist != NULL) {
324.1218 -        /*
324.1219 -         * we already have a embedded frame selecting this container's
324.1220 -         * event, we remember its eventSelectedPreviously value
324.1221 -         * so that we know whether to deselect later when we are removed
324.1222 -         */
324.1223 -        ef->eventSelectedPreviously = eflist->eventSelectedPreviously;
324.1224 -    } else {
324.1225 -        XGetWindowAttributes(awt_display, ef->frameContainer,
324.1226 -            &win_attributes);
324.1227 -        XSelectInput(awt_display, ef->frameContainer,
324.1228 -                     win_attributes.your_event_mask | FocusChangeMask);
324.1229 -    }
324.1230 -
324.1231 -    /* ef will become the head of the embedded frame list */
324.1232 -    ef->next = theEmbeddedFrameList;
324.1233 -    if (theEmbeddedFrameList != NULL) {
324.1234 -        theEmbeddedFrameList->prev = ef;
324.1235 -    }
324.1236 -    ef->prev = NULL;
324.1237 -    theEmbeddedFrameList = ef;
324.1238 -}
324.1239 -
324.1240 -void awt_util_delEmbeddedFrame(Widget embeddedFrame)
324.1241 -{
324.1242 -    EmbeddedFrame *ef = theEmbeddedFrameList;
324.1243 -    Window frameContainer;
324.1244 -    XWindowAttributes win_attributes;
324.1245 -    Boolean needToDeselect;
324.1246 -
324.1247 -    while (ef != NULL) {
324.1248 -        if (ef->embeddedFrame == embeddedFrame) {
324.1249 -            break;
324.1250 -        }
324.1251 -        ef = ef->next;
324.1252 -    }
324.1253 -    if (ef == NULL) { /* cannot find specified embedded frame */
324.1254 -        return;
324.1255 -    }
324.1256 -    /* remove ef from link list EmbeddedFrameList */
324.1257 -    if (ef->prev) {
324.1258 -        ef->prev->next = ef->next;
324.1259 -    }
324.1260 -    if (ef->next) {
324.1261 -        ef->next->prev = ef->prev;
324.1262 -    }
324.1263 -    if (theEmbeddedFrameList == ef) {
324.1264 -        theEmbeddedFrameList = ef->next;
324.1265 -    }
324.1266 -
324.1267 -    frameContainer = ef->frameContainer;
324.1268 -    needToDeselect = ef->eventSelectedPreviously ? False : True;
324.1269 -    free(ef);
324.1270 -    if (!needToDeselect) {
324.1271 -        return;
324.1272 -    }
324.1273 -    /*
324.1274 -     * now decide whether we need to stop listenning event for
324.1275 -     * frameContainer
324.1276 -     */
324.1277 -    ef = theEmbeddedFrameList;
324.1278 -    while (ef != NULL) {
324.1279 -        if (ef->frameContainer == frameContainer) {
324.1280 -            break;
324.1281 -        }
324.1282 -        ef = ef->next;
324.1283 -    }
324.1284 -    if (ef == NULL)  {
324.1285 -        /*
324.1286 -         * if we get here, no one is interested in this frame
324.1287 -         * and StructureNotify was not selected by anyone else
324.1288 -         * so we deselect it
324.1289 -         */
324.1290 -        DTRACE_PRINTLN("remove event from frame");
324.1291 -        XGetWindowAttributes(awt_display, frameContainer, &win_attributes);
324.1292 -        XSelectInput(awt_display, frameContainer,
324.1293 -            win_attributes.your_event_mask &
324.1294 -                (~FocusChangeMask));
324.1295 -    }
324.1296 -}
324.1297 -
324.1298 -#endif /* XAWT */
324.1299 -
324.1300 -void awt_util_debug_init() {
324.1301 -#if defined(DEBUG)
324.1302 -    DTrace_Initialize();
324.1303 -#endif
324.1304 -}
324.1305 -
324.1306 -static void awt_util_debug_fini() {
324.1307 -#if defined(DEBUG)
324.1308 -    DTrace_Shutdown();
324.1309 -#endif
324.1310 -}
   325.1 --- a/src/solaris/native/sun/awt/awt_util.h	Tue Dec 06 16:31:58 2011 -0800
   325.2 +++ b/src/solaris/native/sun/awt/awt_util.h	Mon Dec 19 10:06:23 2011 -0800
   325.3 @@ -27,58 +27,8 @@
   325.4  #define _AWT_UTIL_H_
   325.5  
   325.6  #ifndef HEADLESS
   325.7 -#ifndef XAWT
   325.8 -#include <Xm/VendorSEP.h>
   325.9 -#include <Xm/VendorSP.h>
  325.10 -#endif
  325.11  #include "gdefs.h"
  325.12  
  325.13 -typedef struct ConvertEventTimeAndModifiers {
  325.14 -    jlong when;
  325.15 -    jint modifiers;
  325.16 -} ConvertEventTimeAndModifiers;
  325.17 -
  325.18 -Boolean awt_util_focusIsOnMenu(Display *display);
  325.19 -int32_t awt_util_sendButtonClick(Display *display, Window window);
  325.20 -
  325.21 -Widget awt_util_createWarningWindow(Widget parent, char *warning);
  325.22 -void awt_util_show(Widget w);
  325.23 -void awt_util_hide(Widget w);
  325.24 -void awt_util_enable(Widget w);
  325.25 -void awt_util_disable(Widget w);
  325.26 -void awt_util_reshape(Widget w, jint x, jint y, jint wd, jint ht);
  325.27 -void awt_util_mapChildren(Widget w, void (*func)(Widget,void *),
  325.28 -                          int32_t applyToSelf, void *data);
  325.29 -int32_t awt_util_setCursor(Widget w, Cursor c);
  325.30 -void awt_util_convertEventTimeAndModifiers
  325.31 -    (XEvent *event, ConvertEventTimeAndModifiers *output);
  325.32 -Widget awt_WidgetAtXY(Widget root, Position x, Position y);
  325.33 -char *awt_util_makeWMMenuItem(char *target, Atom protocol);
  325.34 -Cardinal awt_util_insertCallback(Widget w);
  325.35 -void awt_util_consumeAllXEvents(Widget widget);
  325.36 -void awt_util_cleanupBeforeDestroyWidget(Widget widget);
  325.37 -void awt_util_debug_init();
  325.38 -Time awt_util_getCurrentServerTime();
  325.39 -jlong awt_util_nowMillisUTC();
  325.40 -jlong awt_util_nowMillisUTC_offset(Time server_offset);
  325.41 -void awt_util_do_wheel_scroll(Widget scrolled_window, jint scrollType,
  325.42 -                                jint scrollAmt, jint wheelAmt);
  325.43 -Widget awt_util_get_scrollbar_to_scroll(Widget window);
  325.44 -
  325.45 -
  325.46 -typedef struct _EmbeddedFrame {
  325.47 -    Widget embeddedFrame;
  325.48 -    Window frameContainer;
  325.49 -    jobject javaRef;
  325.50 -    Boolean eventSelectedPreviously;
  325.51 -    struct _EmbeddedFrame * next;
  325.52 -    struct _EmbeddedFrame * prev;
  325.53 -} EmbeddedFrame;
  325.54 -
  325.55 -void awt_util_addEmbeddedFrame(Widget embeddedFrame, jobject javaRef);
  325.56 -void awt_util_delEmbeddedFrame(Widget embeddedFrame);
  325.57 -Boolean awt_util_processEventForEmbeddedFrame(XEvent *ev);
  325.58 -
  325.59  #define WITH_XERROR_HANDLER(f) do {             \
  325.60      XSync(awt_display, False);                  \
  325.61      xerror_code = Success;                      \
  325.62 @@ -115,8 +65,6 @@
  325.63   */
  325.64  extern unsigned char xerror_code;
  325.65  
  325.66 -extern int xerror_ignore_bad_window(Display *dpy, XErrorEvent *err);
  325.67 -
  325.68  #endif /* !HEADLESS */
  325.69  
  325.70  #ifndef INTERSECTS
  325.71 @@ -143,13 +91,8 @@
  325.72      int32_t echoC;
  325.73  };
  325.74  
  325.75 -extern jobject awtJNI_GetCurrentThread(JNIEnv *env);
  325.76  extern void awtJNI_ThreadYield(JNIEnv *env);
  325.77  
  325.78 -#ifndef HEADLESS
  325.79 -extern Widget prevWidget;
  325.80 -#endif /* !HEADLESS */
  325.81 -
  325.82  /*
  325.83   * Functions for accessing fields by name and signature
  325.84   */
  325.85 @@ -183,69 +126,4 @@
  325.86  JNIEXPORT jint JNICALL
  325.87  JNU_GetCharField(JNIEnv *env, jobject self, const char *name);
  325.88  
  325.89 -#ifndef HEADLESS
  325.90 -#ifdef __solaris__
  325.91 -extern Widget awt_util_getXICStatusAreaWindow(Widget w);
  325.92 -#else
  325.93 -int32_t awt_util_getIMStatusHeight(Widget vw);
  325.94 -XVaNestedList awt_util_getXICStatusAreaList(Widget w);
  325.95 -Widget awt_util_getXICStatusAreaWindow(Widget w);
  325.96 -#endif
  325.97 -
  325.98 -
  325.99 -
 325.100 -
 325.101 -#ifdef __linux__
 325.102 -typedef struct _XmImRefRec {
 325.103 -  Cardinal      num_refs;       /* Number of referencing widgets. */
 325.104 -  Cardinal      max_refs;       /* Maximum length of refs array. */
 325.105 -  Widget*       refs;           /* Array of referencing widgets. */
 325.106 -  XtPointer     **callbacks;
 325.107 -} XmImRefRec, *XmImRefInfo;
 325.108 -
 325.109 -typedef struct _PreeditBufferRec {
 325.110 -  unsigned short length;
 325.111 -  wchar_t        *text;
 325.112 -  XIMFeedback    *feedback;
 325.113 -  int32_t            caret;
 325.114 -  XIMCaretStyle  style;
 325.115 -} PreeditBufferRec, *PreeditBuffer;
 325.116 -
 325.117 -typedef struct _XmImXICRec {
 325.118 -  struct _XmImXICRec *next;     /* Links all have the same XIM. */
 325.119 -  XIC           xic;            /* The XIC. */
 325.120 -  Window        focus_window;   /* Cached information about the XIC. */
 325.121 -  XIMStyle      input_style;    /* ...ditto... */
 325.122 -  int32_t           status_width;   /* ...ditto... */
 325.123 -  int32_t           preedit_width;  /* ...ditto... */
 325.124 -  int32_t           sp_height;      /* ...ditto... */
 325.125 -  Boolean       has_focus;      /* Does this XIC have keyboard focus. */
 325.126 -  Boolean       anonymous;      /* Do we have exclusive rights to this XIC. */
 325.127 -  XmImRefRec    widget_refs;    /* Widgets referencing this XIC. */
 325.128 -  struct _XmImXICRec **source; /* Original source of shared XICs. */
 325.129 -  PreeditBuffer preedit_buffer;
 325.130 -} XmImXICRec, *XmImXICInfo;
 325.131 -
 325.132 -typedef struct _XmImShellRec {
 325.133 -  /* per-Shell fields. */
 325.134 -  Widget        im_widget;      /* Dummy widget to make intrinsics behave. */
 325.135 -  Widget        current_widget; /* Widget whose visual we're matching. */
 325.136 -
 325.137 -  /* per <Shell,XIM> fields. */
 325.138 -  XmImXICInfo   shell_xic;      /* For PER_SHELL sharing policy. */
 325.139 -  XmImXICInfo   iclist;         /* All known XICs for this <XIM,Shell>. */
 325.140 -} XmImShellRec, *XmImShellInfo;
 325.141 -
 325.142 -typedef struct {
 325.143 -  /* per-Display fields. */
 325.144 -  XContext      current_xics;   /* Map widget -> current XmImXICInfo. */
 325.145 -
 325.146 -  /* per-XIM fields. */
 325.147 -  XIM           xim;            /* The XIM. */
 325.148 -  XIMStyles     *styles;        /* XNQueryInputStyle result. */
 325.149 -  XmImRefRec    shell_refs;     /* Shells referencing this XIM. */
 325.150 -} XmImDisplayRec, *XmImDisplayInfo;
 325.151 -
 325.152 -#endif
 325.153 -#endif /* !HEADLESS */
 325.154  #endif           /* _AWT_UTIL_H_ */
   326.1 --- a/src/solaris/native/sun/awt/awt_wm.c	Tue Dec 06 16:31:58 2011 -0800
   326.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   326.3 @@ -1,2869 +0,0 @@
   326.4 -/*
   326.5 - * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
   326.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   326.7 - *
   326.8 - * This code is free software; you can redistribute it and/or modify it
   326.9 - * under the terms of the GNU General Public License version 2 only, as
  326.10 - * published by the Free Software Foundation.  Oracle designates this
  326.11 - * particular file as subject to the "Classpath" exception as provided
  326.12 - * by Oracle in the LICENSE file that accompanied this code.
  326.13 - *
  326.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
  326.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  326.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  326.17 - * version 2 for more details (a copy is included in the LICENSE file that
  326.18 - * accompanied this code).
  326.19 - *
  326.20 - * You should have received a copy of the GNU General Public License version
  326.21 - * 2 along with this work; if not, write to the Free Software Foundation,
  326.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  326.23 - *
  326.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  326.25 - * or visit www.oracle.com if you need additional information or have any
  326.26 - * questions.
  326.27 - */
  326.28 -
  326.29 -#ifdef HEADLESS
  326.30 -    #error This file should not be included in headless library
  326.31 -#endif
  326.32 -
  326.33 -/*
  326.34 - * Some SCIENCE stuff happens, and it is CONFUSING
  326.35 - */
  326.36 -
  326.37 -#include "awt_p.h"
  326.38 -
  326.39 -#include <X11/Xproto.h>
  326.40 -#include <X11/Xlib.h>
  326.41 -#include <X11/Xatom.h>
  326.42 -#include <Xm/MwmUtil.h>
  326.43 -
  326.44 -/* JNI headers */
  326.45 -#include "java_awt_Frame.h"     /* for frame state constants */
  326.46 -
  326.47 -#include "awt_wm.h"
  326.48 -#include "awt_util.h"           /* for X11 error handling macros */
  326.49 -
  326.50 -/*
  326.51 - * NB: 64 bit awareness.
  326.52 - *
  326.53 - * Since this code reads/writes window properties heavily, one thing
  326.54 - * should be noted well.  Xlib uses C type 'long' for properties of
  326.55 - * format 32.  Fortunately, typedef for Atom is 'long' as well, so
  326.56 - * passing property data as or casting returned property data to
  326.57 - * arrays of atoms is safe.
  326.58 - */
  326.59 -
  326.60 -
  326.61 -/*
  326.62 - * Atoms used to communicate with window manager(s).
  326.63 - * Naming convention:
  326.64 - *   o  for atom  "FOO" the variable is  "XA_FOO"
  326.65 - *   o  for atom "_BAR" the variable is "_XA_BAR"
  326.66 - * Don't forget to add initialization to awt_wm_initAtoms below.
  326.67 - */
  326.68 -
  326.69 -/*
  326.70 - * Before WM rototill JDK used to check for running WM by just testing
  326.71 - * if certain atom is interned or not.  We'd better not confuse older
  326.72 - * JDK by interning these atoms.  Use awt_wm_atomInterned() to intern
  326.73 - * them lazily.
  326.74 - *
  326.75 - * ENLIGHTENMENT_COMMS
  326.76 - * _ICEWM_WINOPTHINT
  326.77 - * _SAWMILL_TIMESTAMP
  326.78 - * _DT_SM_WINDOW_INFO
  326.79 - * _MOTIF_WM_INFO
  326.80 - * _SUN_WM_PROTOCOLS
  326.81 - */
  326.82 -
  326.83 -/* Good old ICCCM */
  326.84 -static Atom XA_WM_STATE;
  326.85 -
  326.86 -/* New "netwm" spec from www.freedesktop.org */
  326.87 -static Atom XA_UTF8_STRING;     /* like STRING but encoding is UTF-8 */
  326.88 -static Atom _XA_NET_SUPPORTING_WM_CHECK;
  326.89 -static Atom _XA_NET_SUPPORTED;  /* list of protocols (property of root) */
  326.90 -static Atom _XA_NET_WM_NAME;    /* window property */
  326.91 -static Atom _XA_NET_WM_STATE;   /* both window property and request */
  326.92 -
  326.93 -/*
  326.94 - * _NET_WM_STATE is a list of atoms.
  326.95 - * NB: Standard spelling is "HORZ" (yes, without an 'I'), but KDE2
  326.96 - * uses misspelled "HORIZ" (see KDE bug #20229).  This was fixed in
  326.97 - * KDE 2.2.  Under earlier versions of KDE2 horizontal and full
  326.98 - * maximization doesn't work .
  326.99 - */
 326.100 -static Atom _XA_NET_WM_STATE_MAXIMIZED_HORZ;
 326.101 -static Atom _XA_NET_WM_STATE_MAXIMIZED_VERT;
 326.102 -static Atom _XA_NET_WM_STATE_SHADED;
 326.103 -static Atom _XA_NET_WM_STATE_ABOVE;
 326.104 -static Atom _XA_NET_WM_STATE_BELOW;
 326.105 -static Atom _XA_NET_WM_STATE_HIDDEN;
 326.106 -
 326.107 -/* Currently we only care about max_v and max_h in _NET_WM_STATE */
 326.108 -#define AWT_NET_N_KNOWN_STATES 2
 326.109 -
 326.110 -/* Gnome WM spec (superseded by "netwm" above, but still in use) */
 326.111 -static Atom _XA_WIN_SUPPORTING_WM_CHECK;
 326.112 -static Atom _XA_WIN_PROTOCOLS;
 326.113 -static Atom _XA_WIN_STATE;
 326.114 -static Atom _XA_WIN_LAYER;
 326.115 -
 326.116 -/* Enlightenment */
 326.117 -static Atom _XA_E_FRAME_SIZE;
 326.118 -
 326.119 -/* KWin (KDE2) */
 326.120 -static Atom _XA_KDE_NET_WM_FRAME_STRUT;
 326.121 -
 326.122 -/* KWM (KDE 1.x) OBSOLETE??? */
 326.123 -static Atom XA_KWM_WIN_ICONIFIED;
 326.124 -static Atom XA_KWM_WIN_MAXIMIZED;
 326.125 -
 326.126 -/* OpenLook */
 326.127 -static Atom _XA_OL_DECOR_DEL;
 326.128 -static Atom _XA_OL_DECOR_HEADER;
 326.129 -static Atom _XA_OL_DECOR_RESIZE;
 326.130 -static Atom _XA_OL_DECOR_PIN;
 326.131 -static Atom _XA_OL_DECOR_CLOSE;
 326.132 -
 326.133 -/* For _NET_WM_STATE ClientMessage requests */
 326.134 -#define _NET_WM_STATE_REMOVE    0 /* remove/unset property */
 326.135 -#define _NET_WM_STATE_ADD       1 /* add/set property      */
 326.136 -#define _NET_WM_STATE_TOGGLE    2 /* toggle property       */
 326.137 -
 326.138 -/* _WIN_STATE bits */
 326.139 -#define WIN_STATE_STICKY          (1<<0) /* everyone knows sticky            */
 326.140 -#define WIN_STATE_MINIMIZED       (1<<1) /* Reserved - definition is unclear */
 326.141 -#define WIN_STATE_MAXIMIZED_VERT  (1<<2) /* window in maximized V state      */
 326.142 -#define WIN_STATE_MAXIMIZED_HORIZ (1<<3) /* window in maximized H state      */
 326.143 -#define WIN_STATE_HIDDEN          (1<<4) /* not on taskbar but window visible*/
 326.144 -#define WIN_STATE_SHADED          (1<<5) /* shaded (MacOS / Afterstep style) */
 326.145 -#define WIN_LAYER_ONTOP           6
 326.146 -#define WIN_LAYER_NORMAL          4
 326.147 -
 326.148 -#define  URGENCY_HINT             (1<<8)
 326.149 -#define  LAYER_ALWAYS_ON_TOP      1
 326.150 -#define  LAYER_NORMAL             0
 326.151 -
 326.152 -
 326.153 -/*
 326.154 - * Intern a bunch of atoms we are going use.
 326.155 - */
 326.156 -static void
 326.157 -awt_wm_initAtoms(void)
 326.158 -{
 326.159 -    /* Minimize X traffic by creating atoms en mass...  This requires
 326.160 -       slightly more code but reduces number of server requests. */
 326.161 -    struct atominit {
 326.162 -        Atom *atomptr;
 326.163 -        const char *name;
 326.164 -    };
 326.165 -
 326.166 -    /* Just add new atoms to this list */
 326.167 -    static struct atominit atom_list[] = {
 326.168 -        { &XA_WM_STATE,                      "WM_STATE"                      },
 326.169 -
 326.170 -        { &XA_UTF8_STRING,                   "UTF8_STRING"                   },
 326.171 -
 326.172 -        { &_XA_NET_SUPPORTING_WM_CHECK,      "_NET_SUPPORTING_WM_CHECK"      },
 326.173 -        { &_XA_NET_SUPPORTED,                "_NET_SUPPORTED"                },
 326.174 -        { &_XA_NET_WM_STATE,                 "_NET_WM_STATE"                 },
 326.175 -        { &_XA_NET_WM_STATE_MAXIMIZED_VERT,  "_NET_WM_STATE_MAXIMIZED_VERT"  },
 326.176 -        { &_XA_NET_WM_STATE_MAXIMIZED_HORZ,  "_NET_WM_STATE_MAXIMIZED_HORZ"  },
 326.177 -        { &_XA_NET_WM_STATE_SHADED,          "_NET_WM_STATE_SHADED"          },
 326.178 -        { &_XA_NET_WM_STATE_ABOVE,           "_NET_WM_STATE_ABOVE"           },
 326.179 -        { &_XA_NET_WM_STATE_BELOW,           "_NET_WM_STATE_BELOW"           },
 326.180 -        { &_XA_NET_WM_STATE_HIDDEN,          "_NET_WM_STATE_HIDDEN"          },
 326.181 -        { &_XA_NET_WM_NAME,                  "_NET_WM_NAME"                  },
 326.182 -
 326.183 -        { &_XA_WIN_SUPPORTING_WM_CHECK,      "_WIN_SUPPORTING_WM_CHECK"      },
 326.184 -        { &_XA_WIN_PROTOCOLS,                "_WIN_PROTOCOLS"                },
 326.185 -        { &_XA_WIN_STATE,                    "_WIN_STATE"                    },
 326.186 -        { &_XA_WIN_LAYER,                    "_WIN_LAYER"                    },
 326.187 -
 326.188 -        { &_XA_KDE_NET_WM_FRAME_STRUT,       "_KDE_NET_WM_FRAME_STRUT"       },
 326.189 -
 326.190 -        { &_XA_E_FRAME_SIZE,                 "_E_FRAME_SIZE"                 },
 326.191 -
 326.192 -        { &XA_KWM_WIN_ICONIFIED,             "KWM_WIN_ICONIFIED"             },
 326.193 -        { &XA_KWM_WIN_MAXIMIZED,             "KWM_WIN_MAXIMIZED"             },
 326.194 -
 326.195 -        { &_XA_OL_DECOR_DEL,                 "_OL_DECOR_DEL"                 },
 326.196 -        { &_XA_OL_DECOR_HEADER,              "_OL_DECOR_HEADER"              },
 326.197 -        { &_XA_OL_DECOR_RESIZE,              "_OL_DECOR_RESIZE"              },
 326.198 -        { &_XA_OL_DECOR_PIN,                 "_OL_DECOR_PIN"                 },
 326.199 -        { &_XA_OL_DECOR_CLOSE,               "_OL_DECOR_CLOSE"               }
 326.200 -    };
 326.201 -#define ATOM_LIST_LENGTH (sizeof(atom_list)/sizeof(atom_list[0]))
 326.202 -
 326.203 -    const char *names[ATOM_LIST_LENGTH];
 326.204 -    Atom atoms[ATOM_LIST_LENGTH];
 326.205 -    Status status;
 326.206 -    size_t i;
 326.207 -
 326.208 -    /* Fill the array of atom names */
 326.209 -    for (i = 0; i < ATOM_LIST_LENGTH; ++i) {
 326.210 -        names[i] = atom_list[i].name;
 326.211 -    }
 326.212 -
 326.213 -    DTRACE_PRINT("WM: initializing atoms ...  ");
 326.214 -    status = XInternAtoms(awt_display, (char**)names, ATOM_LIST_LENGTH,
 326.215 -                          False, atoms);
 326.216 -    if (status == 0) {
 326.217 -        DTRACE_PRINTLN("failed");
 326.218 -        return;
 326.219 -    }
 326.220 -
 326.221 -    /* Store returned atoms into corresponding global variables */
 326.222 -    DTRACE_PRINTLN("ok");
 326.223 -    for (i = 0; i < ATOM_LIST_LENGTH; ++i) {
 326.224 -        *atom_list[i].atomptr = atoms[i];
 326.225 -    }
 326.226 -#undef ATOM_LIST_LENGTH
 326.227 -}
 326.228 -
 326.229 -
 326.230 -/*
 326.231 - * When checking for various WMs don't intern certain atoms we use to
 326.232 - * distinguish those WMs.  Rather check if the atom is interned first.
 326.233 - * If it's not, further tests are not necessary anyway.
 326.234 - * This also saves older JDK a great deal of confusion (4487993).
 326.235 - */
 326.236 -static Boolean
 326.237 -awt_wm_atomInterned(Atom *pa, const char *name)
 326.238 -{
 326.239 -    DASSERT(pa != NULL);
 326.240 -    if (*pa == None) {
 326.241 -        DASSERT(name != NULL);
 326.242 -        *pa = XInternAtom(awt_display, name, True);
 326.243 -        if (*pa == None) {
 326.244 -            DTRACE_PRINTLN1("\"%s\" is not interned", name);
 326.245 -            return False;
 326.246 -        } else {
 326.247 -            return True;
 326.248 -        }
 326.249 -    } else {
 326.250 -        return True;
 326.251 -    }
 326.252 -}
 326.253 -
 326.254 -
 326.255 -
 326.256 -/*****************************************************************************\
 326.257 - *
 326.258 - * DTRACE utils for various states ...
 326.259 - *
 326.260 -\*****************************************************************************/
 326.261 -
 326.262 -
 326.263 -static void
 326.264 -awt_wm_dtraceWMState(uint32_t wm_state)
 326.265 -{
 326.266 -#ifdef DEBUG
 326.267 -    DTRACE_PRINT("WM_STATE = ");
 326.268 -    switch (wm_state) {
 326.269 -      case WithdrawnState:
 326.270 -          DTRACE_PRINTLN("Withdrawn");
 326.271 -          break;
 326.272 -      case NormalState:
 326.273 -          DTRACE_PRINTLN("Normal");
 326.274 -          break;
 326.275 -      case IconicState:
 326.276 -          DTRACE_PRINTLN("Iconic");
 326.277 -          break;
 326.278 -      default:
 326.279 -          DTRACE_PRINTLN1("unknown state %d", wm_state);
 326.280 -          break;
 326.281 -    }
 326.282 -#endif /* DEBUG */
 326.283 -}
 326.284 -
 326.285 -static void
 326.286 -awt_wm_dtraceStateNet(Atom *net_wm_state, unsigned long nitems)
 326.287 -{
 326.288 -#ifdef DEBUG
 326.289 -    unsigned long i;
 326.290 -
 326.291 -    DTRACE_PRINT("_NET_WM_STATE = {");
 326.292 -    for (i = 0; i < nitems; ++i) {
 326.293 -        char *name, *print_name;
 326.294 -        name = XGetAtomName(awt_display, net_wm_state[i]);
 326.295 -        if (name == NULL) {
 326.296 -            print_name = "???";
 326.297 -        } else if (strncmp(name, "_NET_WM_STATE", 13) == 0) {
 326.298 -            print_name = name + 13; /* skip common prefix to reduce noice */
 326.299 -        } else {
 326.300 -            print_name = name;
 326.301 -        }
 326.302 -        DTRACE_PRINT1(" %s", print_name);
 326.303 -        if (name) {
 326.304 -            XFree(name);
 326.305 -        }
 326.306 -    }
 326.307 -    DTRACE_PRINTLN(" }");
 326.308 -#endif
 326.309 -}
 326.310 -
 326.311 -
 326.312 -static void
 326.313 -awt_wm_dtraceStateWin(uint32_t win_state)
 326.314 -{
 326.315 -#ifdef DEBUG
 326.316 -    DTRACE_PRINT("_WIN_STATE = {");
 326.317 -    if (win_state & WIN_STATE_STICKY) {
 326.318 -        DTRACE_PRINT(" STICKY");
 326.319 -    }
 326.320 -    if (win_state & WIN_STATE_MINIMIZED) {
 326.321 -        DTRACE_PRINT(" MINIMIZED");
 326.322 -    }
 326.323 -    if (win_state & WIN_STATE_MAXIMIZED_VERT) {
 326.324 -        DTRACE_PRINT(" MAXIMIZED_VERT");
 326.325 -    }
 326.326 -    if (win_state & WIN_STATE_MAXIMIZED_HORIZ) {
 326.327 -        DTRACE_PRINT(" MAXIMIZED_HORIZ");
 326.328 -    }
 326.329 -    if (win_state & WIN_STATE_HIDDEN) {
 326.330 -        DTRACE_PRINT(" HIDDEN");
 326.331 -    }
 326.332 -    if (win_state & WIN_STATE_SHADED) {
 326.333 -        DTRACE_PRINT(" SHADED");
 326.334 -    }
 326.335 -    DTRACE_PRINTLN(" }");
 326.336 -#endif
 326.337 -}
 326.338 -
 326.339 -
 326.340 -static void
 326.341 -awt_wm_dtraceStateJava(jint java_state)
 326.342 -{
 326.343 -#ifdef DEBUG
 326.344 -    DTRACE_PRINT("java state = ");
 326.345 -    if (java_state == java_awt_Frame_NORMAL) {
 326.346 -        DTRACE_PRINTLN("NORMAL");
 326.347 -    }
 326.348 -    else {
 326.349 -        DTRACE_PRINT("{");
 326.350 -        if (java_state & java_awt_Frame_ICONIFIED) {
 326.351 -            DTRACE_PRINT(" ICONIFIED");
 326.352 -        }
 326.353 -        if ((java_state & java_awt_Frame_MAXIMIZED_BOTH)
 326.354 -                       == java_awt_Frame_MAXIMIZED_BOTH)
 326.355 -        {
 326.356 -            DTRACE_PRINT(" MAXIMIZED_BOTH");
 326.357 -        }
 326.358 -        else if (java_state & java_awt_Frame_MAXIMIZED_HORIZ) {
 326.359 -            DTRACE_PRINT(" MAXIMIZED_HORIZ");
 326.360 -        }
 326.361 -        else if (java_state & java_awt_Frame_MAXIMIZED_VERT) {
 326.362 -            DTRACE_PRINT(" MAXIMIZED_VERT");
 326.363 -        }
 326.364 -        DTRACE_PRINTLN(" }");
 326.365 -    }
 326.366 -#endif /* DEBUG */
 326.367 -}
 326.368 -
 326.369 -
 326.370 -
 326.371 -/*****************************************************************************\
 326.372 - *
 326.373 - * Utility functions ...
 326.374 - *
 326.375 -\*****************************************************************************/
 326.376 -
 326.377 -/*
 326.378 - * Instead of validating window id, we simply call XGetWindowProperty,
 326.379 - * but temporary install this function as the error handler to ignore
 326.380 - * BadWindow error.
 326.381 - */
 326.382 -int /* but ingored */
 326.383 -xerror_ignore_bad_window(Display *dpy, XErrorEvent *err)
 326.384 -{
 326.385 -    XERROR_SAVE(err);
 326.386 -    if (err->error_code == BadWindow) {
 326.387 -        DTRACE_PRINTLN("IGNORING BadWindow");
 326.388 -        return 0; /* ok to fail */
 326.389 -    }
 326.390 -    else {
 326.391 -        return (*xerror_saved_handler)(dpy, err);
 326.392 -    }
 326.393 -}
 326.394 -
 326.395 -
 326.396 -/*
 326.397 - * Convenience wrapper for XGetWindowProperty for XA_ATOM properties.
 326.398 - * E.g. WM_PROTOCOLS, _NET_WM_STATE, _OL_DECOR_DEL.
 326.399 - * It's up to caller to XFree returned value.
 326.400 - * Number of items returned is stored to nitems_ptr (if non-null).
 326.401 - */
 326.402 -static Atom *
 326.403 -awt_getAtomListProperty(Window w, Atom property, unsigned long *nitems_ptr)
 326.404 -{
 326.405 -    /* Request status */
 326.406 -    int status;
 326.407 -
 326.408 -    /* Returns of XGetWindowProperty */
 326.409 -    Atom actual_type;
 326.410 -    int actual_format;
 326.411 -    unsigned long nitems_stub;
 326.412 -    unsigned long bytes_after;
 326.413 -    Atom *list;
 326.414 -
 326.415 -    if (nitems_ptr == NULL) {
 326.416 -        /* Caller is not interested in the number of items,
 326.417 -           provide a stub for XGetWindowProperty */
 326.418 -        nitems_ptr = &nitems_stub;
 326.419 -    }
 326.420 -
 326.421 -    status = XGetWindowProperty(awt_display, w,
 326.422 -                 property, 0, 0xFFFF, False, XA_ATOM,
 326.423 -                 &actual_type, &actual_format, nitems_ptr, &bytes_after,
 326.424 -                 (unsigned char **)&list);
 326.425 -
 326.426 -    if (status != Success || list == NULL) {
 326.427 -        *nitems_ptr = 0;
 326.428 -        return NULL;
 326.429 -    }
 326.430 -
 326.431 -    if (actual_type != XA_ATOM || actual_format != 32) {
 326.432 -        XFree(list);
 326.433 -        *nitems_ptr = 0;
 326.434 -        return NULL;
 326.435 -    }
 326.436 -
 326.437 -    if (*nitems_ptr == 0) {
 326.438 -        XFree(list);
 326.439 -        return NULL;
 326.440 -    }
 326.441 -
 326.442 -    return list;
 326.443 -}
 326.444 -
 326.445 -
 326.446 -/*
 326.447 - * Auxiliary function that returns the value of 'property' of type
 326.448 - * 'property_type' on window 'w'.  Format of the property must be 8.
 326.449 - * Terminating zero added by XGetWindowProperty is preserved.
 326.450 - * It's up to caller to XFree the result.
 326.451 - */
 326.452 -static unsigned char *
 326.453 -awt_getProperty8(Window w, Atom property, Atom property_type)
 326.454 -{
 326.455 -    /* Request status */
 326.456 -    int status;
 326.457 -
 326.458 -    /* Returns of XGetWindowProperty */
 326.459 -    Atom actual_type;
 326.460 -    int actual_format;
 326.461 -    unsigned long nitems;
 326.462 -    unsigned long bytes_after;
 326.463 -    unsigned char *string;
 326.464 -
 326.465 -    /* BadWindow is ok and will be blocked by our special handler */
 326.466 -    WITH_XERROR_HANDLER(xerror_ignore_bad_window);
 326.467 -    {
 326.468 -        status = XGetWindowProperty(awt_display, w,
 326.469 -                     property, 0, 0xFFFF, False, property_type,
 326.470 -                     &actual_type, &actual_format, &nitems, &bytes_after,
 326.471 -                     &string);
 326.472 -    }
 326.473 -    RESTORE_XERROR_HANDLER;
 326.474 -
 326.475 -    if (status != Success || string == NULL) {
 326.476 -        return NULL;
 326.477 -    }
 326.478 -
 326.479 -    if (actual_type != property_type || actual_format != 8) {
 326.480 -        XFree(string);
 326.481 -        return NULL;
 326.482 -    }
 326.483 -
 326.484 -    /* XGetWindowProperty kindly supplies terminating zero */
 326.485 -    return string;
 326.486 -}
 326.487 -
 326.488 -
 326.489 -/*
 326.490 - * Auxiliary function that returns the value of 'property' of type
 326.491 - * 'property_type' on window 'w'.  Format of the property must be 32.
 326.492 - */
 326.493 -static int32_t
 326.494 -awt_getProperty32(Window w, Atom property, Atom property_type)
 326.495 -{
 326.496 -    /* Property value*/
 326.497 -    int32_t value;
 326.498 -
 326.499 -    /* Request status */
 326.500 -    int status;
 326.501 -
 326.502 -    /* Returns of XGetWindowProperty */
 326.503 -    Atom actual_type;
 326.504 -    int actual_format;
 326.505 -    unsigned long nitems;
 326.506 -    unsigned long bytes_after;
 326.507 -    long *data;                 /* NB: 64 bit: Format 32 props are 'long' */
 326.508 -
 326.509 -    /* BadWindow is ok and will be blocked by our special handler */
 326.510 -    WITH_XERROR_HANDLER(xerror_ignore_bad_window);
 326.511 -    {
 326.512 -        status = XGetWindowProperty(awt_display, w,
 326.513 -                     property, 0, 1, False, property_type,
 326.514 -                     &actual_type, &actual_format, &nitems, &bytes_after,
 326.515 -                     (unsigned char **)&data);
 326.516 -    }
 326.517 -    RESTORE_XERROR_HANDLER;
 326.518 -
 326.519 -    if (status != Success || data == NULL) {
 326.520 -        return 0;
 326.521 -    }
 326.522 -
 326.523 -    if (actual_type != property_type || actual_format != 32) {
 326.524 -        XFree(data);            /* NULL data already catched above */
 326.525 -        return 0;
 326.526 -    }
 326.527 -
 326.528 -    value = (int32_t)*data;
 326.529 -    XFree(data);
 326.530 -
 326.531 -    return value;
 326.532 -}
 326.533 -
 326.534 -
 326.535 -
 326.536 -/*****************************************************************************\
 326.537 - *
 326.538 - * Detecting WM ...
 326.539 - *
 326.540 -\*****************************************************************************/
 326.541 -
 326.542 -
 326.543 -
 326.544 -/*
 326.545 - * Check for anchor_prop(anchor_type) on root, take the value as the
 326.546 - * window id and check if that window exists and has anchor_prop(anchor_type)
 326.547 - * with the same value (i.e. pointing back to self).
 326.548 - *
 326.549 - * Returns the anchor window, as some WM may put interesting stuff in
 326.550 - * its properties (e.g. sawfish).
 326.551 - */
 326.552 -static Window
 326.553 -awt_wm_checkAnchor(Atom anchor_prop, Atom anchor_type)
 326.554 -{
 326.555 -    Window root_xref;
 326.556 -    Window self_xref;
 326.557 -
 326.558 -    root_xref = (Window)awt_getProperty32(DefaultRootWindow(awt_display),
 326.559 -                                          anchor_prop, anchor_type);
 326.560 -    if (root_xref == None) {
 326.561 -        DTRACE_PRINTLN("no");
 326.562 -        return None;
 326.563 -    }
 326.564 -
 326.565 -    DTRACE_PRINT1("0x%x ...  ", (unsigned int)root_xref);
 326.566 -    self_xref = (Window)awt_getProperty32(root_xref,
 326.567 -                                          anchor_prop, anchor_type);
 326.568 -    if (self_xref != root_xref) {
 326.569 -        DTRACE_PRINTLN("stale");
 326.570 -        return None;
 326.571 -    }
 326.572 -
 326.573 -    DTRACE_PRINTLN("ok");
 326.574 -    return self_xref;
 326.575 -}
 326.576 -
 326.577 -
 326.578 -/*
 326.579 - * New WM spec: KDE 2.0.1, sawfish 0.3x, ...
 326.580 - * <http://www.freedesktop.org/standards/wm-spec.html>
 326.581 - */
 326.582 -static Window
 326.583 -awt_wm_isNetSupporting(void)
 326.584 -{
 326.585 -    static Boolean checked = False;
 326.586 -    static Window isNetSupporting = None;
 326.587 -
 326.588 -    if (checked) {
 326.589 -        return isNetSupporting;
 326.590 -    }
 326.591 -
 326.592 -    DTRACE_PRINT("WM: checking for _NET_SUPPORTING ...  ");
 326.593 -    isNetSupporting = awt_wm_checkAnchor(_XA_NET_SUPPORTING_WM_CHECK,
 326.594 -                                         XA_WINDOW);
 326.595 -    checked = True;
 326.596 -    return isNetSupporting;
 326.597 -}
 326.598 -
 326.599 -
 326.600 -/*
 326.601 - * Old Gnome WM spec: WindowMaker, Enlightenment, IceWM ...
 326.602 - * <http://developer.gnome.org/doc/standards/wm/book1.html>
 326.603 - */
 326.604 -static Window
 326.605 -awt_wm_isWinSupporting(void)
 326.606 -{
 326.607 -    static Boolean checked = False;
 326.608 -    static Window isWinSupporting = None;
 326.609 -
 326.610 -    if (checked) {
 326.611 -        return isWinSupporting;
 326.612 -    }
 326.613 -
 326.614 -    DTRACE_PRINT("WM: checking for _WIN_SUPPORTING ...  ");
 326.615 -    isWinSupporting = awt_wm_checkAnchor(_XA_WIN_SUPPORTING_WM_CHECK,
 326.616 -                                         XA_CARDINAL);
 326.617 -    checked = True;
 326.618 -    return isWinSupporting;
 326.619 -}
 326.620 -
 326.621 -
 326.622 -/*
 326.623 - * Check that that the list of protocols specified by WM in property
 326.624 - * named LIST_NAME on the root window contains protocol PROTO.
 326.625 - */
 326.626 -static Boolean
 326.627 -awt_wm_checkProtocol(Atom list_name, Atom proto)
 326.628 -{
 326.629 -    Atom *protocols;
 326.630 -    unsigned long nproto;
 326.631 -    Boolean found;
 326.632 -    unsigned long i;
 326.633 -
 326.634 -    protocols = awt_getAtomListProperty(DefaultRootWindow(awt_display),
 326.635 -                                        list_name, &nproto);
 326.636 -    if (protocols == NULL) {
 326.637 -        return False;
 326.638 -    }
 326.639 -
 326.640 -    found = False;
 326.641 -    for (i = 0; i < nproto; ++i) {
 326.642 -        if (protocols[i] == proto) {
 326.643 -            found = True;
 326.644 -            break;
 326.645 -        }
 326.646 -    }
 326.647 -
 326.648 -    if (protocols != NULL) {
 326.649 -        XFree(protocols);
 326.650 -    }
 326.651 -    return found;
 326.652 -}
 326.653 -
 326.654 -static Boolean
 326.655 -awt_wm_doStateProtocolNet(void)
 326.656 -{
 326.657 -    static Boolean checked = False;
 326.658 -    static Boolean supported = False;
 326.659 -
 326.660 -    if (checked) {
 326.661 -        return supported;
 326.662 -    }
 326.663 -
 326.664 -    if (awt_wm_isNetSupporting()) {
 326.665 -        DTRACE_PRINT("WM: checking for _NET_WM_STATE in _NET_SUPPORTED ...  ");
 326.666 -        supported = awt_wm_checkProtocol(_XA_NET_SUPPORTED, _XA_NET_WM_STATE);
 326.667 -        DTRACE_PRINTLN1("%s", supported ? "yes" : "no");
 326.668 -    }
 326.669 -
 326.670 -    checked = True;
 326.671 -    return supported;
 326.672 -}
 326.673 -
 326.674 -static Boolean
 326.675 -awt_wm_doStateProtocolWin(void)
 326.676 -{
 326.677 -    static Boolean checked = False;
 326.678 -    static Boolean supported = False;
 326.679 -
 326.680 -    if (checked) {
 326.681 -        return supported;
 326.682 -    }
 326.683 -
 326.684 -    if (awt_wm_isWinSupporting()) {
 326.685 -        DTRACE_PRINT("WM: checking for _WIN_STATE in _WIN_PROTOCOLS ...  ");
 326.686 -        supported = awt_wm_checkProtocol(_XA_WIN_PROTOCOLS, _XA_WIN_STATE);
 326.687 -        DTRACE_PRINTLN1("%s", supported ? "yes" : "no");
 326.688 -    }
 326.689 -    checked = True;
 326.690 -    return supported;
 326.691 -}
 326.692 -
 326.693 -
 326.694 -
 326.695 -/*
 326.696 - * Helper function for awt_wm_isEnlightenment.
 326.697 - * Enlightenment uses STRING property for its comms window id.  Gaaa!
 326.698 - * The property is ENLIGHTENMENT_COMMS, STRING/8 and the string format
 326.699 - * is "WINID %8x".  Gee, I haven't been using scanf for *ages*... :-)
 326.700 - */
 326.701 -static Window
 326.702 -awt_getECommsWindowIDProperty(Window w)
 326.703 -{
 326.704 -    static Atom XA_ENLIGHTENMENT_COMMS = None;
 326.705 -
 326.706 -    /* Property value*/
 326.707 -    Window value;
 326.708 -
 326.709 -    /* Request status */
 326.710 -    int status;
 326.711 -
 326.712 -    /* Returns of XGetWindowProperty */
 326.713 -    Atom actual_type;
 326.714 -    int actual_format;
 326.715 -    unsigned long nitems;
 326.716 -    unsigned long bytes_after;
 326.717 -    unsigned char *data;
 326.718 -
 326.719 -    if (!awt_wm_atomInterned(&XA_ENLIGHTENMENT_COMMS, "ENLIGHTENMENT_COMMS")) {
 326.720 -        return False;
 326.721 -    }
 326.722 -
 326.723 -    /* BadWindow is ok and will be blocked by our special handler */
 326.724 -    WITH_XERROR_HANDLER(xerror_ignore_bad_window);
 326.725 -    {
 326.726 -        status = XGetWindowProperty(awt_display, w,
 326.727 -                     XA_ENLIGHTENMENT_COMMS, 0, 14, False, XA_STRING,
 326.728 -                     &actual_type, &actual_format, &nitems, &bytes_after,
 326.729 -                     &data);
 326.730 -    }
 326.731 -    RESTORE_XERROR_HANDLER;
 326.732 -
 326.733 -    if (status != Success || data == NULL) {
 326.734 -        DTRACE_PRINTLN("no ENLIGHTENMENT_COMMS");
 326.735 -        return None;
 326.736 -    }
 326.737 -
 326.738 -    if (actual_type != XA_STRING || actual_format != 8
 326.739 -        || nitems != 14 || bytes_after != 0)
 326.740 -    {
 326.741 -        DTRACE_PRINTLN("malformed ENLIGHTENMENT_COMMS");
 326.742 -        XFree(data);            /* NULL data already catched above */
 326.743 -        return None;
 326.744 -    }
 326.745 -
 326.746 -    value = None;
 326.747 -    sscanf((char *)data, "WINID %8lx", &value); /* NB: 64 bit: XID is long */
 326.748 -    XFree(data);
 326.749 -
 326.750 -    return value;
 326.751 -}
 326.752 -
 326.753 -
 326.754 -/*
 326.755 - * Is Enlightenment WM running?  Congruent to awt_wm_checkAnchor, but
 326.756 - * uses STRING property peculiar to Enlightenment.
 326.757 - */
 326.758 -static Boolean
 326.759 -awt_wm_isEnlightenment(void)
 326.760 -{
 326.761 -    Window root_xref;
 326.762 -    Window self_xref;
 326.763 -
 326.764 -    DTRACE_PRINT("WM: checking for Enlightenment ...  ");
 326.765 -    root_xref = awt_getECommsWindowIDProperty(DefaultRootWindow(awt_display));
 326.766 -    if (root_xref == None) {
 326.767 -        return False;
 326.768 -    }
 326.769 -
 326.770 -    DTRACE_PRINT1("0x%x ...  ", root_xref);
 326.771 -    self_xref = awt_getECommsWindowIDProperty(root_xref);
 326.772 -    if (self_xref != root_xref) {
 326.773 -        return False;
 326.774 -    }
 326.775 -
 326.776 -    DTRACE_PRINTLN("ok");
 326.777 -    return True;
 326.778 -}
 326.779 -
 326.780 -
 326.781 -/*
 326.782 - * Is CDE running?
 326.783 - *
 326.784 - * XXX: This is hairy...  CDE is MWM as well.  It seems we simply test
 326.785 - * for default setup and will be bitten if user changes things...
 326.786 - *
 326.787 - * Check for _DT_SM_WINDOW_INFO(_DT_SM_WINDOW_INFO) on root.  Take the
 326.788 - * second element of the property and check for presence of
 326.789 - * _DT_SM_STATE_INFO(_DT_SM_STATE_INFO) on that window.
 326.790 - *
 326.791 - * XXX: Any header that defines this structures???
 326.792 - */
 326.793 -static Boolean
 326.794 -awt_wm_isCDE(void)
 326.795 -{
 326.796 -    static Atom _XA_DT_SM_WINDOW_INFO = None;
 326.797 -    static Atom _XA_DT_SM_STATE_INFO = None;
 326.798 -
 326.799 -    /* Property value*/
 326.800 -    Window wmwin;
 326.801 -
 326.802 -    /* Request status */
 326.803 -    int status;
 326.804 -
 326.805 -    /* Returns of XGetWindowProperty */
 326.806 -    Atom actual_type;
 326.807 -    int actual_format;
 326.808 -    unsigned long nitems;
 326.809 -    unsigned long bytes_after;
 326.810 -    long *data;                 /* NB: 64 bit: Format 32 props are 'long' */
 326.811 -
 326.812 -    DTRACE_PRINT("WM: checking for CDE ...  ");
 326.813 -
 326.814 -    if (!awt_wm_atomInterned(&_XA_DT_SM_WINDOW_INFO, "_DT_SM_WINDOW_INFO")) {
 326.815 -        return False;
 326.816 -    }
 326.817 -
 326.818 -    status = XGetWindowProperty(awt_display, DefaultRootWindow(awt_display),
 326.819 -                 _XA_DT_SM_WINDOW_INFO, 0, 2, False, _XA_DT_SM_WINDOW_INFO,
 326.820 -                 &actual_type, &actual_format, &nitems, &bytes_after,
 326.821 -                 (unsigned char **)&data);
 326.822 -
 326.823 -    if (status != Success || data == NULL) {
 326.824 -        DTRACE_PRINTLN("no _DT_SM_WINDOW_INFO on root");
 326.825 -        return False;
 326.826 -    }
 326.827 -
 326.828 -    if (actual_type != _XA_DT_SM_WINDOW_INFO || actual_format != 32
 326.829 -        || nitems != 2 || bytes_after != 0)
 326.830 -    {
 326.831 -        DTRACE_PRINTLN("malformed _DT_SM_WINDOW_INFO on root");
 326.832 -        XFree(data);            /* NULL data already catched above */
 326.833 -        return False;
 326.834 -    }
 326.835 -
 326.836 -    wmwin = (Window)data[1];
 326.837 -    XFree(data);
 326.838 -
 326.839 -    /* Now check that this window has _DT_SM_STATE_INFO (ignore contents) */
 326.840 -
 326.841 -    if (!awt_wm_atomInterned(&_XA_DT_SM_STATE_INFO, "_DT_SM_STATE_INFO")) {
 326.842 -        return False;
 326.843 -    }
 326.844 -
 326.845 -    /* BadWindow is ok and will be blocked by our special handler */
 326.846 -    WITH_XERROR_HANDLER(xerror_ignore_bad_window);
 326.847 -    {
 326.848 -        status = XGetWindowProperty(awt_display, wmwin,
 326.849 -                     _XA_DT_SM_STATE_INFO, 0, 1, False, _XA_DT_SM_STATE_INFO,
 326.850 -                     &actual_type, &actual_format, &nitems, &bytes_after,
 326.851 -                     (unsigned char **)&data);
 326.852 -    }
 326.853 -    RESTORE_XERROR_HANDLER;
 326.854 -
 326.855 -    if (status != Success || data == NULL) {
 326.856 -        DTRACE_PRINTLN("no _DT_SM_STATE_INFO");
 326.857 -        return False;
 326.858 -    }
 326.859 -
 326.860 -    if (actual_type != _XA_DT_SM_STATE_INFO || actual_format != 32) {
 326.861 -        DTRACE_PRINTLN("malformed _DT_SM_STATE_INFO");
 326.862 -        XFree(data);            /* NULL data already catched above */
 326.863 -        return False;
 326.864 -    }
 326.865 -
 326.866 -    DTRACE_PRINTLN("yes");
 326.867 -    XFree(data);
 326.868 -    return True;
 326.869 -}
 326.870 -
 326.871 -/*
 326.872 - * Is MWM running?  (Note that CDE will test positive as well).
 326.873 - *
 326.874 - * Check for _MOTIF_WM_INFO(_MOTIF_WM_INFO) on root.  Take the
 326.875 - * second element of the property and check for presence of
 326.876 - * _DT_SM_STATE_INFO(_DT_SM_STATE_INFO) on that window.
 326.877 - */
 326.878 -static Boolean
 326.879 -awt_wm_isMotif(void)
 326.880 -{
 326.881 -    /*
 326.882 -     * Grr.  Motif just had to be different, ain't it!?  Everyone use
 326.883 -     * "XA" for things of type Atom, but motif folks chose to define
 326.884 -     * _XA_MOTIF_* to be atom *names*.  How pathetic...
 326.885 -     */
 326.886 -#undef _XA_MOTIF_WM_INFO
 326.887 -    static Atom _XA_MOTIF_WM_INFO = None;
 326.888 -    static Atom _XA_DT_WORKSPACE_CURRENT = None;
 326.889 -
 326.890 -    /* Property value */
 326.891 -    Window wmwin;
 326.892 -    Atom *curws;
 326.893 -
 326.894 -    /* Request status */
 326.895 -    int status;
 326.896 -
 326.897 -    /* Returns of XGetWindowProperty */
 326.898 -    Atom actual_type;
 326.899 -    int actual_format;
 326.900 -    unsigned long nitems;
 326.901 -    unsigned long bytes_after;
 326.902 -    long *data;                 /* NB: 64 bit: Format 32 props are 'long' */
 326.903 -
 326.904 -    DTRACE_PRINT("WM: checking for MWM ...  ");
 326.905 -
 326.906 -    if (!awt_wm_atomInterned(&_XA_MOTIF_WM_INFO, "_MOTIF_WM_INFO")
 326.907 -        || !awt_wm_atomInterned(&_XA_DT_WORKSPACE_CURRENT, "_DT_WORKSPACE_CURRENT"))
 326.908 -    {
 326.909 -        return False;
 326.910 -    }
 326.911 -
 326.912 -
 326.913 -    status = XGetWindowProperty(awt_display, DefaultRootWindow(awt_display),
 326.914 -                 _XA_MOTIF_WM_INFO, 0, PROP_MOTIF_WM_INFO_ELEMENTS, False,
 326.915 -                 _XA_MOTIF_WM_INFO, &actual_type,
 326.916 -                 &actual_format, &nitems, &bytes_after,
 326.917 -                 (unsigned char **)&data);
 326.918 -
 326.919 -    if (status != Success || data == NULL) {
 326.920 -        DTRACE_PRINTLN("no _MOTIF_WM_INFO on root");
 326.921 -        return False;
 326.922 -    }
 326.923 -
 326.924 -    if (actual_type != _XA_MOTIF_WM_INFO || actual_format != 32
 326.925 -        || nitems != PROP_MOTIF_WM_INFO_ELEMENTS || bytes_after != 0)
 326.926 -    {
 326.927 -        DTRACE_PRINTLN("malformed _MOTIF_WM_INFO on root");
 326.928 -        XFree(data);            /* NULL data already catched above */
 326.929 -        return False;
 326.930 -    }
 326.931 -
 326.932 -    /* NB: 64 bit: Cannot cast data to MotifWmInfo */
 326.933 -    wmwin = (Window)data[1];
 326.934 -    XFree(data);
 326.935 -
 326.936 -    /* Now check that this window has _DT_WORKSPACE_CURRENT */
 326.937 -    curws = awt_getAtomListProperty(wmwin, _XA_DT_WORKSPACE_CURRENT, NULL);
 326.938 -    if (curws == NULL) {
 326.939 -        DTRACE_PRINTLN("no _DT_WORKSPACE_CURRENT");
 326.940 -        return False;
 326.941 -    }
 326.942 -
 326.943 -    DTRACE_PRINTLN("yes");
 326.944 -    XFree(curws);
 326.945 -    return True;
 326.946 -}
 326.947 -
 326.948 -
 326.949 -static Boolean
 326.950 -awt_wm_isNetWMName(char *name)
 326.951 -{
 326.952 -    Window anchor;
 326.953 -    unsigned char *net_wm_name;
 326.954 -    Boolean matched;
 326.955 -
 326.956 -    anchor = awt_wm_isNetSupporting();
 326.957 -    if (anchor == None) {
 326.958 -        return False;
 326.959 -    }
 326.960 -
 326.961 -    DTRACE_PRINT1("WM: checking for %s by _NET_WM_NAME ...  ", name);
 326.962 -
 326.963 -    /*
 326.964 -     * Check both UTF8_STRING and STRING.  We only call this function
 326.965 -     * with ASCII names and UTF8 preserves ASCII bit-wise.  wm-spec
 326.966 -     * mandates UTF8_STRING for _NET_WM_NAME but at least sawfish-1.0
 326.967 -     * still uses STRING.  (mmm, moving targets...).
 326.968 -     */
 326.969 -    net_wm_name = awt_getProperty8(anchor, _XA_NET_WM_NAME, XA_UTF8_STRING);
 326.970 -    if (net_wm_name == NULL) {
 326.971 -        net_wm_name = awt_getProperty8(anchor, _XA_NET_WM_NAME, XA_STRING);
 326.972 -    }
 326.973 -
 326.974 -    if (net_wm_name == NULL) {
 326.975 -        DTRACE_PRINTLN("no (missing _NET_WM_NAME)");
 326.976 -        return False;
 326.977 -    }
 326.978 -
 326.979 -    matched = (strcmp((char *)net_wm_name, name) == 0);
 326.980 -    if (matched) {
 326.981 -        DTRACE_PRINTLN("yes");
 326.982 -    } else {
 326.983 -        DTRACE_PRINTLN1("no (_NET_WM_NAME = \"%s\")", net_wm_name);
 326.984 -    }
 326.985 -    XFree(net_wm_name);
 326.986 -    return matched;
 326.987 -}
 326.988 -
 326.989 -/*
 326.990 - * Is Sawfish running?
 326.991 - */
 326.992 -static Boolean
 326.993 -awt_wm_isSawfish(void)
 326.994 -{
 326.995 -    return awt_wm_isNetWMName("Sawfish");
 326.996 -}
 326.997 -
 326.998 -/*
 326.999 - * Is KDE2 (KWin) running?
326.1000 - */
326.1001 -static Boolean
326.1002 -awt_wm_isKDE2(void)
326.1003 -{
326.1004 -    return awt_wm_isNetWMName("KWin");
326.1005 -}
326.1006 -
326.1007 -
326.1008 -/*
326.1009 - * Is Metacity running?
326.1010 - */
326.1011 -static Boolean
326.1012 -awt_wm_isMetacity(void)
326.1013 -{
326.1014 -    return awt_wm_isNetWMName("Metacity");
326.1015 -}
326.1016 -
326.1017 -
326.1018 -/*
326.1019 - * Temporary error handler that ensures that we know if
326.1020 - * XChangeProperty succeeded or not.
326.1021 - */
326.1022 -static int /* but ignored */
326.1023 -xerror_verify_change_property(Display *dpy, XErrorEvent *err)
326.1024 -{
326.1025 -    XERROR_SAVE(err);
326.1026 -    if (err->request_code == X_ChangeProperty) {
326.1027 -        return 0;
326.1028 -    }
326.1029 -    else {
326.1030 -        return (*xerror_saved_handler)(dpy, err);
326.1031 -    }
326.1032 -}
326.1033 -
326.1034 -
326.1035 -/*
326.1036 - * Prepare IceWM check.
326.1037 - *
326.1038 - * The only way to detect IceWM, seems to be by setting
326.1039 - * _ICEWM_WINOPTHINT(_ICEWM_WINOPTHINT/8) on root and checking if it
326.1040 - * was immediately deleted by IceWM.
326.1041 - *
326.1042 - * But messing with PropertyNotify here is way too much trouble, so
326.1043 - * approximate the check by setting the property in this function and
326.1044 - * checking if it still exists later on.
326.1045 - *
326.1046 - * Gaa, dirty dances...
326.1047 - */
326.1048 -static Boolean
326.1049 -awt_wm_prepareIsIceWM(void)
326.1050 -{
326.1051 -    static Atom _XA_ICEWM_WINOPTHINT = None;
326.1052 -
326.1053 -    /*
326.1054 -     * Choose something innocuous: "AWT_ICEWM_TEST allWorkspaces 0".
326.1055 -     * IceWM expects "class\0option\0arg\0" with zero bytes as delimiters.
326.1056 -     */
326.1057 -    static unsigned char opt[] = {
326.1058 -        'A','W','T','_','I','C','E','W','M','_','T','E','S','T','\0',
326.1059 -        'a','l','l','W','o','r','k','s','p','a','c','e','s','\0',
326.1060 -        '0','\0'
326.1061 -    };
326.1062 -
326.1063 -    DTRACE_PRINT("WM: scheduling check for IceWM ...  ");
326.1064 -
326.1065 -    if (!awt_wm_atomInterned(&_XA_ICEWM_WINOPTHINT, "_ICEWM_WINOPTHINT")) {
326.1066 -        return False;
326.1067 -    }
326.1068 -
326.1069 -    WITH_XERROR_HANDLER(xerror_verify_change_property);
326.1070 -    {
326.1071 -        XChangeProperty(awt_display, DefaultRootWindow(awt_display),
326.1072 -                        _XA_ICEWM_WINOPTHINT, _XA_ICEWM_WINOPTHINT, 8,
326.1073 -                        PropModeReplace, opt, sizeof(opt));
326.1074 -    }
326.1075 -    RESTORE_XERROR_HANDLER;
326.1076 -
326.1077 -    if (xerror_code != Success) {
326.1078 -        DTRACE_PRINTLN1("can't set _ICEWM_WINOPTHINT, error = %d",
326.1079 -                        xerror_code);
326.1080 -        return False;
326.1081 -    }
326.1082 -    else {
326.1083 -        DTRACE_PRINTLN("scheduled");
326.1084 -        return True;
326.1085 -    }
326.1086 -}
326.1087 -
326.1088 -/*
326.1089 - * Is IceWM running?
326.1090 - *
326.1091 - * Note well: Only call this if awt_wm_prepareIsIceWM succeeded, or a
326.1092 - * false positive will be reported.
326.1093 - */
326.1094 -static Boolean
326.1095 -awt_wm_isIceWM(void)
326.1096 -{
326.1097 -    static Atom _XA_ICEWM_WINOPTHINT = None;
326.1098 -
326.1099 -    /* Request status */
326.1100 -    int status;
326.1101 -
326.1102 -    /* Returns of XGetWindowProperty */
326.1103 -    Atom actual_type;
326.1104 -    int actual_format;
326.1105 -    unsigned long nitems;
326.1106 -    unsigned long bytes_after;
326.1107 -    unsigned char *data;
326.1108 -
326.1109 -    DTRACE_PRINT("WM: checking for IceWM ...  ");
326.1110 -
326.1111 -    if (!awt_wm_atomInterned(&_XA_ICEWM_WINOPTHINT, "_ICEWM_WINOPTHINT")) {
326.1112 -        return False;
326.1113 -    }
326.1114 -
326.1115 -    XGetWindowProperty(awt_display, DefaultRootWindow(awt_display),
326.1116 -                 _XA_ICEWM_WINOPTHINT, 0, 0xFFFF, True, /* NB: deleting! */
326.1117 -                 _XA_ICEWM_WINOPTHINT, &actual_type,
326.1118 -                 &actual_format, &nitems, &bytes_after,
326.1119 -                 &data);
326.1120 -
326.1121 -    if (data != NULL) {
326.1122 -        XFree(data);
326.1123 -    }
326.1124 -
326.1125 -    if (actual_type == None) {
326.1126 -        DTRACE_PRINTLN("yes");
326.1127 -        return True;
326.1128 -    }
326.1129 -    else {
326.1130 -        DTRACE_PRINTLN("no");
326.1131 -        return False;
326.1132 -    }
326.1133 -}
326.1134 -
326.1135 -/*
326.1136 - * Is OpenLook WM running?
326.1137 - *
326.1138 - * This one is pretty lame, but the only property peculiar to OLWM is
326.1139 - * _SUN_WM_PROTOCOLS(ATOM[]).  Fortunately, olwm deletes it on exit.
326.1140 - */
326.1141 -static Boolean
326.1142 -awt_wm_isOpenLook(void)
326.1143 -{
326.1144 -    static Atom _XA_SUN_WM_PROTOCOLS = None;
326.1145 -    Atom *list;
326.1146 -
326.1147 -    DTRACE_PRINT("WM: checking for OpenLook WM ...  ");
326.1148 -
326.1149 -    if (!awt_wm_atomInterned(&_XA_SUN_WM_PROTOCOLS, "_SUN_WM_PROTOCOLS")) {
326.1150 -        return False;
326.1151 -    }
326.1152 -
326.1153 -    list = awt_getAtomListProperty(DefaultRootWindow(awt_display),
326.1154 -                                   _XA_SUN_WM_PROTOCOLS, NULL);
326.1155 -    if (list == NULL) {
326.1156 -        DTRACE_PRINTLN("no _SUN_WM_PROTOCOLS on root");
326.1157 -        return False;
326.1158 -    }
326.1159 -
326.1160 -    DTRACE_PRINTLN("yes");
326.1161 -    XFree(list);
326.1162 -    return True;
326.1163 -}
326.1164 -
326.1165 -
326.1166 -
326.1167 -static Boolean winmgr_running = False;
326.1168 -
326.1169 -/*
326.1170 - * Temporary error handler that checks if selecting for
326.1171 - * SubstructureRedirect failed.
326.1172 - */
326.1173 -static int /* but ignored */
326.1174 -xerror_detect_wm(Display *dpy, XErrorEvent *err)
326.1175 -{
326.1176 -    XERROR_SAVE(err);
326.1177 -    if (err->request_code == X_ChangeWindowAttributes
326.1178 -        && err->error_code == BadAccess)
326.1179 -    {
326.1180 -        DTRACE_PRINTLN("some WM is running (hmm, we'll see)");
326.1181 -        winmgr_running = True;
326.1182 -        return 0;
326.1183 -    }
326.1184 -    else {
326.1185 -        return (*xerror_saved_handler)(dpy, err);
326.1186 -    }
326.1187 -}
326.1188 -
326.1189 -
326.1190 -/*
326.1191 - * Make an educated guess about running window manager.
326.1192 - * XXX: ideally, we should detect wm restart.
326.1193 - */
326.1194 -enum wmgr_t
326.1195 -awt_wm_getRunningWM(void)
326.1196 -{
326.1197 -    /*
326.1198 -     * Ideally, we should support cases when a different WM is started
326.1199 -     * during a Java app lifetime.
326.1200 -     */
326.1201 -    static enum wmgr_t awt_wmgr = UNDETERMINED_WM;
326.1202 -
326.1203 -    XSetWindowAttributes substruct;
326.1204 -    const char *vendor_string;
326.1205 -    Boolean doIsIceWM;
326.1206 -
326.1207 -    if (awt_wmgr != UNDETERMINED_WM) {
326.1208 -        return awt_wmgr;
326.1209 -    }
326.1210 -
326.1211 -    /*
326.1212 -     * Quick checks for specific servers.
326.1213 -     */
326.1214 -    vendor_string = ServerVendor(awt_display);
326.1215 -    if (strstr(vendor_string, "eXcursion") != NULL) {
326.1216 -        /*
326.1217 -         * Use NO_WM since in all other aspects eXcursion is like not
326.1218 -         * having a window manager running. I.e. it does not reparent
326.1219 -         * top level shells.
326.1220 -         */
326.1221 -        DTRACE_PRINTLN("WM: eXcursion detected - treating as NO_WM");
326.1222 -        awt_wmgr = NO_WM;
326.1223 -        return awt_wmgr;
326.1224 -    }
326.1225 -
326.1226 -    /*
326.1227 -     * If *any* window manager is running?
326.1228 -     *
326.1229 -     * Try selecting for SubstructureRedirect, that only one client
326.1230 -     * can select for, and if the request fails, than some other WM is
326.1231 -     * already running.
326.1232 -     */
326.1233 -    winmgr_running = 0;
326.1234 -    substruct.event_mask = SubstructureRedirectMask;
326.1235 -
326.1236 -    DTRACE_PRINT("WM: trying SubstructureRedirect ...  ");
326.1237 -    WITH_XERROR_HANDLER(xerror_detect_wm);
326.1238 -    {
326.1239 -        XChangeWindowAttributes(awt_display, DefaultRootWindow(awt_display),
326.1240 -                                CWEventMask, &substruct);
326.1241 -    }
326.1242 -    RESTORE_XERROR_HANDLER;
326.1243 -
326.1244 -    /*
326.1245 -     * If no WM is running than our selection for SubstructureRedirect
326.1246 -     * succeeded and needs to be undone (hey we are *not* a WM ;-).
326.1247 -     */
326.1248 -    if (!winmgr_running) {
326.1249 -        DTRACE_PRINTLN("no WM is running");
326.1250 -        awt_wmgr = NO_WM;
326.1251 -        substruct.event_mask = 0;
326.1252 -        XChangeWindowAttributes(awt_display, DefaultRootWindow(awt_display),
326.1253 -                                CWEventMask, &substruct);
326.1254 -        return NO_WM;
326.1255 -    }
326.1256 -
326.1257 -    /* actual check for IceWM to follow below */
326.1258 -    doIsIceWM = awt_wm_prepareIsIceWM(); /* and let IceWM to act */
326.1259 -
326.1260 -    if (awt_wm_isNetSupporting()) {
326.1261 -        awt_wm_doStateProtocolNet();
326.1262 -    }
326.1263 -    if (awt_wm_isWinSupporting()) {
326.1264 -        awt_wm_doStateProtocolWin();
326.1265 -    }
326.1266 -
326.1267 -    /*
326.1268 -     * Ok, some WM is out there.  Check which one by testing for
326.1269 -     * "distinguishing" atoms.
326.1270 -     */
326.1271 -    if (doIsIceWM && awt_wm_isIceWM()) {
326.1272 -        awt_wmgr = ICE_WM;
326.1273 -    }
326.1274 -    else if (awt_wm_isEnlightenment()) {
326.1275 -        awt_wmgr = ENLIGHTEN_WM;
326.1276 -    }
326.1277 -    else if (awt_wm_isMetacity()) {
326.1278 -        awt_wmgr = METACITY_WM;
326.1279 -    }
326.1280 -    else if (awt_wm_isSawfish()) {
326.1281 -        awt_wmgr = SAWFISH_WM;
326.1282 -    }
326.1283 -    else if (awt_wm_isKDE2()) {
326.1284 -        awt_wmgr = KDE2_WM;
326.1285 -    }
326.1286 -    /*
326.1287 -     * We don't check for legacy WM when we already know that WM
326.1288 -     * supports WIN or _NET wm spec.
326.1289 -     */
326.1290 -    else if (awt_wm_isNetSupporting()) {
326.1291 -        DTRACE_PRINTLN("WM: other WM (supports _NET)");
326.1292 -        awt_wmgr = OTHER_WM;
326.1293 -    }
326.1294 -    else if (awt_wm_isWinSupporting()) {
326.1295 -        DTRACE_PRINTLN("WM: other WM (supports _WIN)");
326.1296 -        awt_wmgr = OTHER_WM;
326.1297 -    }
326.1298 -    /*
326.1299 -     * Check for legacy WMs.
326.1300 -     */
326.1301 -    else if (awt_wm_isCDE()) {  /* XXX: must come before isMotif */
326.1302 -        awt_wmgr = CDE_WM;
326.1303 -    }
326.1304 -    else if (awt_wm_isMotif()) {
326.1305 -        awt_wmgr = MOTIF_WM;
326.1306 -    }
326.1307 -    else if (awt_wm_isOpenLook()) {
326.1308 -        awt_wmgr = OPENLOOK_WM;
326.1309 -    }
326.1310 -    else {
326.1311 -        DTRACE_PRINTLN("WM: some other legacy WM");
326.1312 -        awt_wmgr = OTHER_WM;
326.1313 -    }
326.1314 -
326.1315 -    return awt_wmgr;
326.1316 -}
326.1317 -
326.1318 -
326.1319 -/*
326.1320 - * Some buggy WMs ignore window gravity when processing
326.1321 - * ConfigureRequest and position window as if the gravity is Static.
326.1322 - * We work around this in MWindowPeer.pReshape().
326.1323 - */
326.1324 -Boolean
326.1325 -awt_wm_configureGravityBuggy(void)
326.1326 -{
326.1327 -    static int env_not_checked = 1;
326.1328 -    static int env_buggy = 0;
326.1329 -
326.1330 -    if (env_not_checked) {
326.1331 -        DTRACE_PRINT("WM: checking for _JAVA_AWT_WM_STATIC_GRAVITY in environment ...  ");
326.1332 -        if (getenv("_JAVA_AWT_WM_STATIC_GRAVITY") != NULL) {
326.1333 -            DTRACE_PRINTLN("set");
326.1334 -            env_buggy = 1;
326.1335 -        } else {
326.1336 -            DTRACE_PRINTLN("no");
326.1337 -        }
326.1338 -        env_not_checked = 0;
326.1339 -    }
326.1340 -
326.1341 -    if (env_buggy) {
326.1342 -        return True;
326.1343 -    }
326.1344 -
326.1345 -    switch (awt_wm_getRunningWM()) {
326.1346 -      case ICE_WM:
326.1347 -          /*
326.1348 -           * See bug #228981 at IceWM's SourceForge pages.
326.1349 -           * Latest stable version 1.0.8-6 still has this problem.
326.1350 -           */
326.1351 -          return True;
326.1352 -
326.1353 -      case ENLIGHTEN_WM:
326.1354 -          /* At least E16 is buggy. */
326.1355 -          return True;
326.1356 -
326.1357 -      default:
326.1358 -          return False;
326.1359 -    }
326.1360 -}
326.1361 -
326.1362 -/**
326.1363 - * Check if state is supported.
326.1364 - * Note that a compound state is always reported as not supported.
326.1365 - * Note also that MAXIMIZED_BOTH is considered not a compound state.
326.1366 - * Therefore, a compound state is just ICONIFIED | anything else.
326.1367 - *
326.1368 - */
326.1369 -Boolean
326.1370 -awt_wm_supportsExtendedState(jint state)
326.1371 -{
326.1372 -    switch (state) {
326.1373 -      case java_awt_Frame_MAXIMIZED_VERT:
326.1374 -      case java_awt_Frame_MAXIMIZED_HORIZ:
326.1375 -          /*
326.1376 -           * WMs that talk NET/WIN protocol, but do not support
326.1377 -           * unidirectional maximization.
326.1378 -           */
326.1379 -          if (awt_wm_getRunningWM() == METACITY_WM) {
326.1380 -              /* "This is a deliberate policy decision." -hp */
326.1381 -              return JNI_FALSE;
326.1382 -          }
326.1383 -          /* FALLTROUGH */
326.1384 -      case java_awt_Frame_MAXIMIZED_BOTH:
326.1385 -          return (awt_wm_doStateProtocolNet() || awt_wm_doStateProtocolWin());
326.1386 -      default:
326.1387 -          return JNI_FALSE;
326.1388 -    }
326.1389 -}
326.1390 -
326.1391 -
326.1392 -
326.1393 -
326.1394 -/*****************************************************************************\
326.1395 - *
326.1396 - * Size and decoration hints ...
326.1397 - *
326.1398 -\*****************************************************************************/
326.1399 -
326.1400 -
326.1401 -/*
326.1402 - * Remove size hints specified by the mask.
326.1403 - * XXX: Why do we need this in the first place???
326.1404 - */
326.1405 -void
326.1406 -awt_wm_removeSizeHints(Widget shell, long mask)
326.1407 -{
326.1408 -    Display *dpy = XtDisplay(shell);
326.1409 -    Window shell_win = XtWindow(shell);
326.1410 -    XSizeHints *hints = XAllocSizeHints();
326.1411 -    long ignore = 0;
326.1412 -
326.1413 -    if (hints == NULL) {
326.1414 -        DTRACE_PRINTLN("WM: removeSizeHints FAILED to allocate XSizeHints");
326.1415 -        return;
326.1416 -    }
326.1417 -
326.1418 -    /* sanitize the mask, only do these hints */
326.1419 -    mask &= (PMaxSize|PMinSize|USPosition|PPosition);
326.1420 -
326.1421 -    XGetWMNormalHints(dpy, shell_win, hints, &ignore);
326.1422 -    if ((hints->flags & mask) == 0) {
326.1423 -        XFree(hints);
326.1424 -        return;
326.1425 -    }
326.1426 -
326.1427 -#ifdef DEBUG
326.1428 -    DTRACE_PRINT("WM: removing hints");
326.1429 -
326.1430 -    if (mask & PMaxSize) {
326.1431 -        DTRACE_PRINT(" Max = ");
326.1432 -        if (hints->flags & PMaxSize) {
326.1433 -            DTRACE_PRINT2("%d x %d;", hints->max_width, hints->max_height);
326.1434 -        } else {
326.1435 -            DTRACE_PRINT("none;");
326.1436 -        }
326.1437 -    }
326.1438 -
326.1439 -    if (mask & PMinSize) {
326.1440 -        DTRACE_PRINT(" Min = ");
326.1441 -        if (hints->flags & PMinSize) {
326.1442 -            DTRACE_PRINT2("%d x %d;", hints->min_width, hints->min_height);
326.1443 -        } else {
326.1444 -            DTRACE_PRINT("none;");
326.1445 -        }
326.1446 -    }
326.1447 -
326.1448 -    DTRACE_PRINTLN("");
326.1449 -#endif
326.1450 -
326.1451 -    hints->flags &= ~mask;
326.1452 -    XSetWMNormalHints(dpy, shell_win, hints);
326.1453 -    XFree(hints);
326.1454 -}
326.1455 -
326.1456 -/*
326.1457 - *
326.1458 - *
326.1459 - */
326.1460 -static void
326.1461 -awt_wm_proclaimUrgency(struct FrameData *wdata)
326.1462 -{
326.1463 -    Display *dpy = XtDisplay(wdata->winData.shell);
326.1464 -    Window shell_win = XtWindow(wdata->winData.shell);
326.1465 -
326.1466 -    XWMHints *hints = XGetWMHints(dpy, shell_win);
326.1467 -    if( hints == NULL ) {
326.1468 -       /* For now just */ return;
326.1469 -    }
326.1470 -    if ((hints->flags & URGENCY_HINT) != 0) {
326.1471 -        /* it's here already */
326.1472 -        XFree(hints);
326.1473 -        return;
326.1474 -    }
326.1475 -    hints->flags |= URGENCY_HINT;
326.1476 -    XSetWMHints(dpy, shell_win, hints);
326.1477 -    XFree(hints);
326.1478 -}
326.1479 -
326.1480 -/*
326.1481 - * If MWM_DECOR_ALL bit is set, then the rest of the bit-mask is taken
326.1482 - * to be subtracted from the decorations.  Normalize decoration spec
326.1483 - * so that we can map motif decor to something else bit-by-bit in the
326.1484 - * rest of the code.
326.1485 - */
326.1486 -static int
326.1487 -awt_wm_normalizeMotifDecor(int decorations)
326.1488 -{
326.1489 -    int d;
326.1490 -
326.1491 -    if (!(decorations & MWM_DECOR_ALL))
326.1492 -        return decorations;     /* already normalized */
326.1493 -
326.1494 -    d = MWM_DECOR_BORDER |MWM_DECOR_RESIZEH | MWM_DECOR_TITLE
326.1495 -        | MWM_DECOR_MENU | MWM_DECOR_MINIMIZE | MWM_DECOR_MAXIMIZE;
326.1496 -    d &= ~decorations;
326.1497 -    return d;
326.1498 -}
326.1499 -
326.1500 -
326.1501 -/*
326.1502 - * Infer OL properties from MWM decorations.
326.1503 - * Use _OL_DECOR_DEL(ATOM[]) to remove unwanted ones.
326.1504 - */
326.1505 -static void
326.1506 -awt_wm_setOLDecor(struct FrameData *wdata, Boolean resizable, int decorations)
326.1507 -{
326.1508 -    Window shell_win = XtWindow(wdata->winData.shell);
326.1509 -    Atom decorDel[3];
326.1510 -    int nitems;
326.1511 -
326.1512 -    if (shell_win == None) {
326.1513 -        DTRACE_PRINTLN("WM: setOLDecor - no window, returning");
326.1514 -        return;
326.1515 -    }
326.1516 -
326.1517 -    decorations = awt_wm_normalizeMotifDecor(decorations);
326.1518 -    DTRACE_PRINT("WM: _OL_DECOR_DEL = {");
326.1519 -
326.1520 -    nitems = 0;
326.1521 -    if (!(decorations & MWM_DECOR_TITLE)) {
326.1522 -        DTRACE_PRINT(" _OL_DECOR_HEADER");
326.1523 -        decorDel[nitems++] = _XA_OL_DECOR_HEADER;
326.1524 -    }
326.1525 -    if (!(decorations & (MWM_DECOR_RESIZEH | MWM_DECOR_MAXIMIZE))) {
326.1526 -        DTRACE_PRINT(" _OL_DECOR_RESIZE");
326.1527 -        decorDel[nitems++] = _XA_OL_DECOR_RESIZE;
326.1528 -    }
326.1529 -    if (!(decorations & (MWM_DECOR_MENU | MWM_DECOR_MAXIMIZE
326.1530 -                         | MWM_DECOR_MINIMIZE)))
326.1531 -    {
326.1532 -        DTRACE_PRINT(" _OL_DECOR_CLOSE");
326.1533 -        decorDel[nitems++] = _XA_OL_DECOR_CLOSE;
326.1534 -    }
326.1535 -    DTRACE_PRINT(" }");
326.1536 -
326.1537 -    if (nitems == 0) {
326.1538 -        DTRACE_PRINTLN(" ...  removing");
326.1539 -        XDeleteProperty(awt_display, shell_win, _XA_OL_DECOR_DEL);
326.1540 -    }
326.1541 -    else {
326.1542 -        DTRACE_PRINTLN(" ...  setting");
326.1543 -        XChangeProperty(awt_display, shell_win,
326.1544 -                        _XA_OL_DECOR_DEL, XA_ATOM, 32,
326.1545 -                        PropModeReplace, (unsigned char *)decorDel, nitems);
326.1546 -    }
326.1547 -}
326.1548 -
326.1549 -/*
326.1550 - * Set MWM decorations.  Infer MWM functions from decorations.
326.1551 - */
326.1552 -static void
326.1553 -awt_wm_setMotifDecor(struct FrameData *wdata, Boolean resizable, int decorations)
326.1554 -{
326.1555 -    int functions;
326.1556 -
326.1557 -    /* Apparently some WMs don't implement MWM_*_ALL semantic correctly */
326.1558 -    if ((decorations & MWM_DECOR_ALL) && (decorations != MWM_DECOR_ALL)) {
326.1559 -        decorations = awt_wm_normalizeMotifDecor(decorations);
326.1560 -        DTRACE_PRINTLN1("WM: setMotifDecor normalize exclusions, decor = 0x%X",
326.1561 -                        decorations);
326.1562 -    }
326.1563 -
326.1564 -    DTRACE_PRINT("WM: setMotifDecor functions = {");
326.1565 -    functions = 0;
326.1566 -
326.1567 -    if (decorations & MWM_DECOR_ALL) {
326.1568 -        DTRACE_PRINT(" ALL");
326.1569 -        functions |= MWM_FUNC_ALL;
326.1570 -    }
326.1571 -    else {
326.1572 -        /*
326.1573 -         * Functions we always want to be enabled as mwm(1) and
326.1574 -         * descendants not only hide disabled functions away from
326.1575 -         * user, but also ignore corresponding requests from the
326.1576 -         * program itself (e.g. 4442047).
326.1577 -         */
326.1578 -        DTRACE_PRINT(" CLOSE MOVE MINIMIZE");
326.1579 -        functions |= (MWM_FUNC_CLOSE | MWM_FUNC_MOVE | MWM_FUNC_MINIMIZE);
326.1580 -
326.1581 -        if (resizable) {
326.1582 -            DTRACE_PRINT(" RESIZE MAXIMIZE");
326.1583 -            functions |= MWM_FUNC_RESIZE | MWM_FUNC_MAXIMIZE;
326.1584 -        }
326.1585 -    }
326.1586 -
326.1587 -    DTRACE_PRINTLN(" }");
326.1588 -
326.1589 -    XtVaSetValues(wdata->winData.shell,
326.1590 -                  XmNmwmDecorations, decorations,
326.1591 -                  XmNmwmFunctions, functions,
326.1592 -                  NULL);
326.1593 -}
326.1594 -
326.1595 -
326.1596 -/*
326.1597 - * Under some window managers if shell is already mapped, we MUST
326.1598 - * unmap and later remap in order to effect the changes we make in the
326.1599 - * window manager decorations.
326.1600 - *
326.1601 - * N.B.  This unmapping / remapping of the shell exposes a bug in
326.1602 - * X/Motif or the Motif Window Manager.  When you attempt to map a
326.1603 - * widget which is positioned (partially) off-screen, the window is
326.1604 - * relocated to be entirely on screen. Good idea.  But if both the x
326.1605 - * and the y coordinates are less than the origin (0,0), the first
326.1606 - * (re)map will move the window to the origin, and any subsequent
326.1607 - * (re)map will relocate the window at some other point on the screen.
326.1608 - * I have written a short Motif test program to discover this bug.
326.1609 - * This should occur infrequently and it does not cause any real
326.1610 - * problem.  So for now we'll let it be.
326.1611 - */
326.1612 -static Boolean
326.1613 -awt_wm_needRemap()
326.1614 -{
326.1615 -    switch (awt_wm_getRunningWM()) {
326.1616 -#if 0 /* XXX */
326.1617 -      case OPENLOOK_WM:
326.1618 -      case MOTIF_WM:
326.1619 -      case CDE_WM:
326.1620 -      case ICE_WM:
326.1621 -      case ENLIGHTEN_WM:
326.1622 -          return True;
326.1623 -#endif
326.1624 -      default:
326.1625 -          return True;
326.1626 -    }
326.1627 -}
326.1628 -
326.1629 -/*
326.1630 - * Set decoration hints on the shell to wdata->decor adjusted
326.1631 - * appropriately if not resizable.
326.1632 - */
326.1633 -void
326.1634 -awt_wm_setShellDecor(struct FrameData *wdata, Boolean resizable)
326.1635 -{
326.1636 -    int decorations = wdata->decor;
326.1637 -
326.1638 -    DTRACE_PRINTLN3("WM: setShellDecor(0x%x/0x%x, %s)",
326.1639 -                    wdata->winData.shell, XtWindow(wdata->winData.shell),
326.1640 -                    resizable ? "resizable" : "not resizable");
326.1641 -
326.1642 -    if (!resizable) {
326.1643 -        if (decorations & MWM_DECOR_ALL) {
326.1644 -            decorations |= (MWM_DECOR_RESIZEH | MWM_DECOR_MAXIMIZE);
326.1645 -        }
326.1646 -        else {
326.1647 -            decorations &= ~(MWM_DECOR_RESIZEH | MWM_DECOR_MAXIMIZE);
326.1648 -        }
326.1649 -    }
326.1650 -
326.1651 -    DTRACE_PRINTLN1("WM:     decorations = 0x%X", decorations);
326.1652 -    awt_wm_setMotifDecor(wdata, resizable, decorations);
326.1653 -    awt_wm_setOLDecor(wdata, resizable, decorations);
326.1654 -
326.1655 -    /* Some WMs need remap to redecorate the window */
326.1656 -    if (wdata->isShowing && awt_wm_needRemap()) {
326.1657 -        /*
326.1658 -         * Do the re/mapping at the Xlib level.  Since we essentially
326.1659 -         * work around a WM bug we don't want this hack to be exposed
326.1660 -         * to Intrinsics (i.e. don't mess with grabs, callbacks etc).
326.1661 -         */
326.1662 -        Display *dpy = XtDisplay(wdata->winData.shell);
326.1663 -        Window shell_win = XtWindow(wdata->winData.shell);
326.1664 -
326.1665 -        DTRACE_PRINT("WM: setShellDecor REMAPPING ...  ");
326.1666 -        XUnmapWindow(dpy, shell_win);
326.1667 -        XSync(dpy, False);      /* give WM a chance to catch up */
326.1668 -        XMapWindow(dpy, shell_win);
326.1669 -        DTRACE_PRINTLN("done");
326.1670 -    }
326.1671 -}
326.1672 -
326.1673 -
326.1674 -/*
326.1675 - * Make specified shell resizable.
326.1676 - */
326.1677 -void
326.1678 -awt_wm_setShellResizable(struct FrameData *wdata)
326.1679 -{
326.1680 -    DTRACE_PRINTLN2("WM: setShellResizable(0x%x/0x%x)",
326.1681 -                    wdata->winData.shell, XtWindow(wdata->winData.shell));
326.1682 -
326.1683 -    XtVaSetValues(wdata->winData.shell,
326.1684 -                  XmNallowShellResize, True,
326.1685 -                  XmNminWidth,  XtUnspecifiedShellInt,
326.1686 -                  XmNminHeight, XtUnspecifiedShellInt,
326.1687 -                  XmNmaxWidth,  XtUnspecifiedShellInt,
326.1688 -                  XmNmaxHeight, XtUnspecifiedShellInt,
326.1689 -                  NULL);
326.1690 -
326.1691 -    /* REMINDER: will need to revisit when setExtendedStateBounds is added */
326.1692 -    awt_wm_removeSizeHints(wdata->winData.shell, PMinSize|PMaxSize);
326.1693 -
326.1694 -    /* Restore decorations */
326.1695 -    awt_wm_setShellDecor(wdata, True);
326.1696 -}
326.1697 -
326.1698 -
326.1699 -/*
326.1700 - * Make specified shell non-resizable.
326.1701 - * If justChangeSize is false, update decorations as well.
326.1702 - */
326.1703 -void
326.1704 -awt_wm_setShellNotResizable(struct FrameData *wdata,
326.1705 -                            int32_t width, int32_t height,
326.1706 -                            Boolean justChangeSize)
326.1707 -{
326.1708 -    DTRACE_PRINTLN5("WM: setShellNotResizable(0x%x/0x%x, %d, %d, %s)",
326.1709 -                    wdata->winData.shell, XtWindow(wdata->winData.shell),
326.1710 -                    width, height,
326.1711 -                    justChangeSize ? "size only" : "redecorate");
326.1712 -
326.1713 -    /* Fix min/max size hints at the specified values */
326.1714 -    if ((width > 0) && (height > 0)) {
326.1715 -        XtVaSetValues(wdata->winData.shell,
326.1716 -                      XmNwidth,     (XtArgVal)width,
326.1717 -                      XmNheight,    (XtArgVal)height,
326.1718 -                      XmNminWidth,  (XtArgVal)width,
326.1719 -                      XmNminHeight, (XtArgVal)height,
326.1720 -                      XmNmaxWidth,  (XtArgVal)width,
326.1721 -                      XmNmaxHeight, (XtArgVal)height,
326.1722 -                      NULL);
326.1723 -    }
326.1724 -
326.1725 -    if (!justChangeSize) {      /* update decorations */
326.1726 -        awt_wm_setShellDecor(wdata, False);
326.1727 -    }
326.1728 -}
326.1729 -
326.1730 -
326.1731 -/*
326.1732 - * Helper function for awt_wm_getInsetsFromProp.
326.1733 - * Read property of type CARDINAL[4] = { left, right, top, bottom }
326.1734 - */
326.1735 -static Boolean
326.1736 -awt_wm_readInsetsArray(Window shell_win, Atom insets_property,
326.1737 -    int32_t *top, int32_t *left, int32_t *bottom, int32_t *right)
326.1738 -{
326.1739 -    /* Request status */
326.1740 -    int status;
326.1741 -
326.1742 -    /* Returns of XGetWindowProperty */
326.1743 -    Atom actual_type;
326.1744 -    int actual_format;
326.1745 -    unsigned long nitems;
326.1746 -    unsigned long bytes_after;
326.1747 -    long *insets = NULL;        /* NB: 64 bit: Format 32 props are 'long' */
326.1748 -
326.1749 -    status = XGetWindowProperty (awt_display, shell_win,
326.1750 -                 insets_property, 0, 4, False, XA_CARDINAL,
326.1751 -                 &actual_type, &actual_format, &nitems, &bytes_after,
326.1752 -                 (unsigned char **)&insets);
326.1753 -
326.1754 -    if (status != Success || insets == NULL) {
326.1755 -        DTRACE_PRINTLN("failed");
326.1756 -        return False;
326.1757 -    }
326.1758 -
326.1759 -    if (actual_type != XA_CARDINAL || actual_format != 32) {
326.1760 -        DTRACE_PRINTLN("type/format mismatch");
326.1761 -        XFree(insets);
326.1762 -        return False;
326.1763 -    }
326.1764 -
326.1765 -    *left   = (int32_t)insets[0];
326.1766 -    *right  = (int32_t)insets[1];
326.1767 -    *top    = (int32_t)insets[2];
326.1768 -    *bottom = (int32_t)insets[3];
326.1769 -    XFree(insets);
326.1770 -
326.1771 -    /* Order is that of java.awt.Insets.toString */
326.1772 -    DTRACE_PRINTLN4("[top=%d,left=%d,bottom=%d,right=%d]",
326.1773 -                    *top, *left, *bottom, *right);
326.1774 -    return True;
326.1775 -}
326.1776 -
326.1777 -/*
326.1778 - * If WM implements the insets property - fill insets with values
326.1779 - * specified in that property.
326.1780 - */
326.1781 -Boolean
326.1782 -awt_wm_getInsetsFromProp(Window shell_win,
326.1783 -    int32_t *top, int32_t *left, int32_t *bottom, int32_t *right)
326.1784 -{
326.1785 -    switch (awt_wm_getRunningWM()) {
326.1786 -
326.1787 -      case ENLIGHTEN_WM:
326.1788 -          DTRACE_PRINT("WM: reading _E_FRAME_SIZE ...  ");
326.1789 -          return awt_wm_readInsetsArray(shell_win, _XA_E_FRAME_SIZE,
326.1790 -                                        top, left, bottom, right);
326.1791 -
326.1792 -#if 0
326.1793 -     /*
326.1794 -      * uwe: disabled for now, as KDE seems to supply bogus values
326.1795 -      * when we maximize iconified frame.  Need to verify with KDE2.1.
326.1796 -      * NB: Also note, that "external" handles (e.g. in laptop decor)
326.1797 -      * are also included in the frame strut, which is probably not
326.1798 -      * what we want.
326.1799 -      */
326.1800 -      case KDE2_WM:
326.1801 -          DTRACE_PRINT("WM: reading _KDE_NET_WM_FRAME_STRUT ...  ");
326.1802 -          return awt_wm_readInsetsArray(shell_win, _XA_KDE_NET_WM_FRAME_STRUT,
326.1803 -                                        top, left, bottom, right);
326.1804 -#endif
326.1805 -
326.1806 -      default:
326.1807 -          return False;
326.1808 -    }
326.1809 -}
326.1810 -
326.1811 -/*
326.1812 - * XmNiconic and Map/UnmapNotify (that XmNiconic relies on) are
326.1813 - * unreliable, since mapping changes can happen for a virtual desktop
326.1814 - * switch or MacOS style shading that became quite popular under X as
326.1815 - * well.  Yes, it probably should not be this way, as it violates
326.1816 - * ICCCM, but reality is that quite a lot of window managers abuse
326.1817 - * mapping state.
326.1818 - */
326.1819 -int
326.1820 -awt_wm_getWMState(Window shell_win)
326.1821 -{
326.1822 -    /* Request status */
326.1823 -    int status;
326.1824 -
326.1825 -    /* Returns of XGetWindowProperty */
326.1826 -    Atom actual_type;
326.1827 -    int actual_format;
326.1828 -    unsigned long nitems;
326.1829 -    unsigned long bytes_after;
326.1830 -    long *data;                 /* NB: 64 bit: Format 32 props are 'long' */
326.1831 -
326.1832 -    int wm_state;
326.1833 -
326.1834 -    status = XGetWindowProperty(awt_display, shell_win,
326.1835 -                 XA_WM_STATE, 0, 1, False, XA_WM_STATE,
326.1836 -                 &actual_type, &actual_format, &nitems, &bytes_after,
326.1837 -                 (unsigned char **)&data);
326.1838 -
326.1839 -    if (status != Success || data == NULL) {
326.1840 -        return WithdrawnState;
326.1841 -    }
326.1842 -
326.1843 -    if (actual_type != XA_WM_STATE) {
326.1844 -        DTRACE_PRINTLN1("WM:     WM_STATE(0x%x) - wrong type", shell_win);
326.1845 -        XFree(data);
326.1846 -        return WithdrawnState;
326.1847 -    }
326.1848 -
326.1849 -    wm_state = (int)*data;
326.1850 -    XFree(data);
326.1851 -    return wm_state;
326.1852 -}
326.1853 -
326.1854 -
326.1855 -
326.1856 -/*****************************************************************************\
326.1857 - *
326.1858 - * Reading state from properties WM puts on our window ...
326.1859 - *
326.1860 -\*****************************************************************************/
326.1861 -
326.1862 -/*
326.1863 - * New "NET" WM spec: _NET_WM_STATE/Atom[]
326.1864 - */
326.1865 -static jint
326.1866 -awt_wm_getStateNet(Window shell_win)
326.1867 -{
326.1868 -    Atom *net_wm_state;
326.1869 -    jint java_state;
326.1870 -    unsigned long nitems;
326.1871 -    unsigned long i;
326.1872 -
326.1873 -    net_wm_state = awt_getAtomListProperty(shell_win, _XA_NET_WM_STATE, &nitems);
326.1874 -    if (nitems == 0) {
326.1875 -        DTRACE_PRINTLN("WM:     _NET_WM_STATE = { }");
326.1876 -        if (net_wm_state) {
326.1877 -            XFree(net_wm_state);
326.1878 -        }
326.1879 -        return java_awt_Frame_NORMAL;
326.1880 -    }
326.1881 -#ifdef DEBUG
326.1882 -    DTRACE_PRINT("WM:     ");
326.1883 -    awt_wm_dtraceStateNet(net_wm_state, nitems);
326.1884 -#endif
326.1885 -
326.1886 -    java_state = java_awt_Frame_NORMAL;
326.1887 -    for (i = 0; i < nitems; ++i) {
326.1888 -        if (net_wm_state[i] == _XA_NET_WM_STATE_MAXIMIZED_VERT) {
326.1889 -            java_state |= java_awt_Frame_MAXIMIZED_VERT;
326.1890 -        }
326.1891 -        else if (net_wm_state[i] == _XA_NET_WM_STATE_MAXIMIZED_HORZ) {
326.1892 -            java_state |= java_awt_Frame_MAXIMIZED_HORIZ;
326.1893 -        }
326.1894 -    }
326.1895 -    XFree(net_wm_state);
326.1896 -    return java_state;
326.1897 -}
326.1898 -
326.1899 -Boolean
326.1900 -awt_wm_isStateNetHidden(Window shell_win)
326.1901 -{
326.1902 -    Atom *net_wm_state;
326.1903 -    Boolean result = False;
326.1904 -    unsigned long nitems;
326.1905 -    unsigned long i;
326.1906 -
326.1907 -    net_wm_state = awt_getAtomListProperty(shell_win, _XA_NET_WM_STATE, &nitems);
326.1908 -    if (nitems == 0) {
326.1909 -        DTRACE_PRINTLN("WM:     _NET_WM_STATE = { }");
326.1910 -        if (net_wm_state) {
326.1911 -            XFree(net_wm_state);
326.1912 -        }
326.1913 -        return False;
326.1914 -    }
326.1915 -#ifdef DEBUG
326.1916 -    DTRACE_PRINT("WM:     ");
326.1917 -    awt_wm_dtraceStateNet(net_wm_state, nitems);
326.1918 -#endif
326.1919 -
326.1920 -    for (i = 0; i < nitems; ++i) {
326.1921 -        if (net_wm_state[i] == _XA_NET_WM_STATE_HIDDEN) {
326.1922 -            result = True;
326.1923 -        }
326.1924 -    }
326.1925 -    XFree(net_wm_state);
326.1926 -    return result;
326.1927 -}
326.1928 -
326.1929 -/*
326.1930 - * Similar code to getStateNet, to get layer state.
326.1931 - */
326.1932 -static int
326.1933 -awt_wm_getLayerNet(Window shell_win)
326.1934 -{
326.1935 -    Atom *net_wm_state;
326.1936 -    int java_state;
326.1937 -    unsigned long nitems;
326.1938 -    unsigned long i;
326.1939 -
326.1940 -    net_wm_state = awt_getAtomListProperty(shell_win, _XA_NET_WM_STATE, &nitems);
326.1941 -    if (nitems == 0) {
326.1942 -        DTRACE_PRINTLN("WM:     _NET_WM_STATE = { }");
326.1943 -        if (net_wm_state) {
326.1944 -            XFree(net_wm_state);
326.1945 -        }
326.1946 -        return LAYER_NORMAL;
326.1947 -    }
326.1948 -#ifdef DEBUG
326.1949 -    DTRACE_PRINT("WM:     ");
326.1950 -    awt_wm_dtraceStateNet(net_wm_state, nitems);
326.1951 -#endif
326.1952 -
326.1953 -    java_state = LAYER_NORMAL;
326.1954 -    for (i = 0; i < nitems; ++i) {
326.1955 -        if (net_wm_state[i] == _XA_NET_WM_STATE_ABOVE) {
326.1956 -            java_state = LAYER_ALWAYS_ON_TOP;
326.1957 -        }
326.1958 -    }
326.1959 -    XFree(net_wm_state);
326.1960 -    return java_state;
326.1961 -}
326.1962 -
326.1963 -/*
326.1964 - * Old Gnome spec: _WIN_STATE/CARDINAL
326.1965 - */
326.1966 -static jint
326.1967 -awt_wm_getStateWin(Window shell_win)
326.1968 -{
326.1969 -    long win_state;
326.1970 -    jint java_state;
326.1971 -
326.1972 -    win_state = awt_getProperty32(shell_win, _XA_WIN_STATE, XA_CARDINAL);
326.1973 -#ifdef DEBUG
326.1974 -    DTRACE_PRINT("WM:     ");
326.1975 -    awt_wm_dtraceStateWin(win_state);
326.1976 -#endif
326.1977 -
326.1978 -    java_state = java_awt_Frame_NORMAL;
326.1979 -    if (win_state & WIN_STATE_MAXIMIZED_VERT) {
326.1980 -        java_state |= java_awt_Frame_MAXIMIZED_VERT;
326.1981 -    }
326.1982 -    if (win_state & WIN_STATE_MAXIMIZED_HORIZ) {
326.1983 -        java_state |= java_awt_Frame_MAXIMIZED_HORIZ;
326.1984 -    }
326.1985 -    return java_state;
326.1986 -}
326.1987 -
326.1988 -/*
326.1989 - * Code similar to getStateWin, to get layer state.
326.1990 - */
326.1991 -static int
326.1992 -awt_wm_getLayerWin(Window shell_win)
326.1993 -{
326.1994 -    long win_state;
326.1995 -    jint java_state;
326.1996 -
326.1997 -    win_state = awt_getProperty32(shell_win, _XA_WIN_LAYER, XA_CARDINAL);
326.1998 -#ifdef DEBUG
326.1999 -    DTRACE_PRINT("WM:     ");
326.2000 -    awt_wm_dtraceStateWin(win_state);
326.2001 -#endif
326.2002 -
326.2003 -    java_state = LAYER_NORMAL;
326.2004 -    if (win_state == WIN_LAYER_ONTOP) {
326.2005 -        java_state = LAYER_ALWAYS_ON_TOP;
326.2006 -    }
326.2007 -    return java_state;
326.2008 -}
326.2009 -
326.2010 -
326.2011 -static jint
326.2012 -awt_wm_getExtendedState(Window shell_win)
326.2013 -{
326.2014 -    if (awt_wm_doStateProtocolNet()) {
326.2015 -        return awt_wm_getStateNet(shell_win);
326.2016 -    }
326.2017 -    else if (awt_wm_doStateProtocolWin()) {
326.2018 -        return awt_wm_getStateWin(shell_win);
326.2019 -    }
326.2020 -    else {
326.2021 -        return java_awt_Frame_NORMAL;
326.2022 -    }
326.2023 -}
326.2024 -
326.2025 -jint
326.2026 -awt_wm_getState(struct FrameData *wdata)
326.2027 -{
326.2028 -    Window shell_win = XtWindow(wdata->winData.shell);
326.2029 -    jint java_state;
326.2030 -
326.2031 -    DTRACE_PRINTLN2("WM: getState(0x%x/0x%x)",
326.2032 -                    wdata->winData.shell, shell_win);
326.2033 -
326.2034 -    if (shell_win == None) {
326.2035 -        DTRACE_PRINTLN("WM:     no window, use wdata");
326.2036 -        java_state = wdata->state;
326.2037 -    }
326.2038 -    else {
326.2039 -        int wm_state = awt_wm_getWMState(shell_win);
326.2040 -        if (wm_state == WithdrawnState) {
326.2041 -            DTRACE_PRINTLN("WM:     window withdrawn, use wdata");
326.2042 -            java_state = wdata->state;
326.2043 -        }
326.2044 -        else {
326.2045 -#ifdef DEBUG
326.2046 -            DTRACE_PRINT("WM:     ");
326.2047 -            awt_wm_dtraceWMState(wm_state);
326.2048 -#endif
326.2049 -            if (wm_state == IconicState) {
326.2050 -                java_state = java_awt_Frame_ICONIFIED;
326.2051 -            } else {
326.2052 -                java_state = java_awt_Frame_NORMAL;
326.2053 -            }
326.2054 -            java_state |= awt_wm_getExtendedState(shell_win);
326.2055 -        }
326.2056 -    }
326.2057 -
326.2058 -#ifdef DEBUG
326.2059 -    DTRACE_PRINT("WM: ");
326.2060 -    awt_wm_dtraceStateJava(java_state);
326.2061 -#endif
326.2062 -
326.2063 -    return java_state;
326.2064 -}
326.2065 -
326.2066 -
326.2067 -
326.2068 -/*****************************************************************************\
326.2069 - *
326.2070 - * Notice window state change when WM changes a property on the window ...
326.2071 - *
326.2072 -\*****************************************************************************/
326.2073 -
326.2074 -
326.2075 -/*
326.2076 - * Check if property change is a window state protocol message.
326.2077 - * If it is - return True and return the new state in *pstate.
326.2078 - */
326.2079 -Boolean
326.2080 -awt_wm_isStateChange(struct FrameData *wdata, XPropertyEvent *e, jint *pstate)
326.2081 -{
326.2082 -    Window shell_win = XtWindow(wdata->winData.shell);
326.2083 -    Boolean is_state_change = False;
326.2084 -    int wm_state;
326.2085 -
326.2086 -    if (!wdata->isShowing) {
326.2087 -        return False;
326.2088 -    }
326.2089 -
326.2090 -    wm_state = awt_wm_getWMState(shell_win);
326.2091 -    if (wm_state == WithdrawnState) {
326.2092 -        return False;
326.2093 -    }
326.2094 -
326.2095 -    if (e->atom == XA_WM_STATE) {
326.2096 -        is_state_change = True;
326.2097 -    }
326.2098 -    else if (e->atom == _XA_NET_WM_STATE) {
326.2099 -        is_state_change = awt_wm_doStateProtocolNet();
326.2100 -    }
326.2101 -    else if (e->atom == _XA_WIN_STATE) {
326.2102 -        is_state_change = awt_wm_doStateProtocolWin();
326.2103 -    }
326.2104 -
326.2105 -    if (is_state_change) {
326.2106 -#ifdef DEBUG
326.2107 -        Widget shell = wdata->winData.shell;
326.2108 -        char *name = XGetAtomName(XtDisplay(shell), e->atom);
326.2109 -        DTRACE_PRINTLN4("WM: PropertyNotify(0x%x/0x%x) %s %s",
326.2110 -                        shell, XtWindow(shell),
326.2111 -                        name != NULL ? name : "???",
326.2112 -                        e->state == PropertyNewValue ? "changed" : "deleted");
326.2113 -        if (name != NULL) {
326.2114 -            XFree(name);
326.2115 -        }
326.2116 -        DTRACE_PRINT("WM:     ");
326.2117 -        awt_wm_dtraceWMState(wm_state);
326.2118 -#endif
326.2119 -        if (wm_state == IconicState) {
326.2120 -            *pstate = java_awt_Frame_ICONIFIED;
326.2121 -        } else {
326.2122 -            *pstate = java_awt_Frame_NORMAL;
326.2123 -        }
326.2124 -        *pstate |= awt_wm_getExtendedState(shell_win);
326.2125 -
326.2126 -#ifdef DEBUG
326.2127 -        DTRACE_PRINT("WM: ");
326.2128 -        awt_wm_dtraceStateJava(*pstate);
326.2129 -#endif
326.2130 -    }
326.2131 -
326.2132 -    return is_state_change;
326.2133 -}
326.2134 -
326.2135 -
326.2136 -
326.2137 -
326.2138 -/*****************************************************************************\
326.2139 - *
326.2140 - * Setting/changing window state ...
326.2141 - *
326.2142 -\*****************************************************************************/
326.2143 -
326.2144 -/*
326.2145 - * Request a state transition from a _NET supporting WM by sending
326.2146 - * _NET_WM_STATE ClientMessage to root window.
326.2147 - */
326.2148 -static void
326.2149 -awt_wm_requestStateNet(struct FrameData *wdata, jint state)
326.2150 -{
326.2151 -    Widget shell = wdata->winData.shell;
326.2152 -    Window shell_win = XtWindow(shell);
326.2153 -    XClientMessageEvent req;
326.2154 -    jint old_net_state;
326.2155 -    jint max_changed;
326.2156 -
326.2157 -    /* must use awt_wm_setInitialStateNet for withdrawn windows */
326.2158 -    DASSERT(wdata->isShowing);
326.2159 -
326.2160 -    /*
326.2161 -     * We have to use toggle for maximization because of transitions
326.2162 -     * from maximization in one direction only to maximization in the
326.2163 -     * other direction only.
326.2164 -     */
326.2165 -    old_net_state = awt_wm_getStateNet(shell_win);
326.2166 -    max_changed = (state ^ old_net_state) & java_awt_Frame_MAXIMIZED_BOTH;
326.2167 -
326.2168 -    switch (max_changed) {
326.2169 -      case 0:
326.2170 -          DTRACE_PRINTLN("WM: requestStateNet - maximization unchanged");
326.2171 -          return;
326.2172 -
326.2173 -      case java_awt_Frame_MAXIMIZED_HORIZ:
326.2174 -          DTRACE_PRINTLN("WM: requestStateNet - toggling MAX_HORZ");
326.2175 -          req.data.l[1] = _XA_NET_WM_STATE_MAXIMIZED_HORZ;
326.2176 -          req.data.l[2] = 0;
326.2177 -          break;
326.2178 -
326.2179 -      case java_awt_Frame_MAXIMIZED_VERT:
326.2180 -          DTRACE_PRINTLN("WM: requestStateNet - toggling MAX_VERT");
326.2181 -          req.data.l[1] = _XA_NET_WM_STATE_MAXIMIZED_VERT;
326.2182 -          req.data.l[2] = 0;
326.2183 -          break;
326.2184 -
326.2185 -      default: /* both */
326.2186 -          DTRACE_PRINTLN("WM: requestStateNet - toggling HORZ + VERT");
326.2187 -          req.data.l[1] = _XA_NET_WM_STATE_MAXIMIZED_HORZ;
326.2188 -          req.data.l[2] = _XA_NET_WM_STATE_MAXIMIZED_VERT;
326.2189 -          break;
326.2190 -    }
326.2191 -
326.2192 -    req.type         = ClientMessage;
326.2193 -    req.window       = XtWindow(shell);
326.2194 -    req.message_type = _XA_NET_WM_STATE;
326.2195 -    req.format       = 32;
326.2196 -    req.data.l[0]    = _NET_WM_STATE_TOGGLE;
326.2197 -
326.2198 -    XSendEvent(XtDisplay(shell), RootWindowOfScreen(XtScreen(shell)), False,
326.2199 -               (SubstructureRedirectMask | SubstructureNotifyMask),
326.2200 -               (XEvent *)&req);
326.2201 -}
326.2202 -
326.2203 -
326.2204 -/*
326.2205 - * Request state transition from a Gnome WM (_WIN protocol) by sending
326.2206 - * _WIN_STATE ClientMessage to root window.
326.2207 - */
326.2208 -static void
326.2209 -awt_wm_requestStateWin(struct FrameData *wdata, jint state)
326.2210 -{
326.2211 -    Widget shell = wdata->winData.shell;
326.2212 -    XClientMessageEvent req;
326.2213 -    long win_state;             /* typeof(XClientMessageEvent.data.l) */
326.2214 -
326.2215 -    /* must use awt_wm_setInitialStateWin for withdrawn windows */
326.2216 -    DASSERT(wdata->isShowing);
326.2217 -
326.2218 -    win_state = 0;
326.2219 -    if (state & java_awt_Frame_MAXIMIZED_VERT) {
326.2220 -        win_state |= WIN_STATE_MAXIMIZED_VERT;
326.2221 -    }
326.2222 -    if (state & java_awt_Frame_MAXIMIZED_HORIZ) {
326.2223 -        win_state |= WIN_STATE_MAXIMIZED_HORIZ;
326.2224 -    }
326.2225 -
326.2226 -    req.type         = ClientMessage;
326.2227 -    req.window       = XtWindow(shell);
326.2228 -    req.message_type = _XA_WIN_STATE;
326.2229 -    req.format       = 32;
326.2230 -    req.data.l[0]    = (WIN_STATE_MAXIMIZED_HORIZ | WIN_STATE_MAXIMIZED_VERT);
326.2231 -    req.data.l[1]    = win_state;
326.2232 -
326.2233 -    XSendEvent(XtDisplay(shell), RootWindowOfScreen(XtScreen(shell)), False,
326.2234 -               (SubstructureRedirectMask | SubstructureNotifyMask),
326.2235 -               (XEvent *)&req);
326.2236 -}
326.2237 -
326.2238 -
326.2239 -/*
326.2240 - * Specify initial state for _NET supporting WM by setting
326.2241 - * _NET_WM_STATE property on the window to the desired state before
326.2242 - * mapping it.
326.2243 - */
326.2244 -static void
326.2245 -awt_wm_setInitialStateNet(struct FrameData *wdata, jint state)
326.2246 -{
326.2247 -    Widget shell = wdata->winData.shell;
326.2248 -    Window shell_win = XtWindow(shell);
326.2249 -    Display *dpy = XtDisplay(shell);
326.2250 -
326.2251 -    Atom *old_state;
326.2252 -    unsigned long nitems;
326.2253 -
326.2254 -    /* must use awt_wm_requestStateNet for managed windows */
326.2255 -    DASSERT(!wdata->isShowing);
326.2256 -
326.2257 -    /* Be careful to not wipe out state bits we don't understand */
326.2258 -    old_state = awt_getAtomListProperty(shell_win, _XA_NET_WM_STATE, &nitems);
326.2259 -
326.2260 -    if (nitems == 0) {
326.2261 -        /*
326.2262 -         * Empty or absent _NET_WM_STATE - set a new one if necessary.
326.2263 -         */
326.2264 -        Atom net_wm_state[AWT_NET_N_KNOWN_STATES];
326.2265 -
326.2266 -        if (old_state != NULL) {
326.2267 -            XFree(old_state);
326.2268 -        }
326.2269 -
326.2270 -        if (state & java_awt_Frame_MAXIMIZED_VERT) {
326.2271 -            net_wm_state[nitems++] = _XA_NET_WM_STATE_MAXIMIZED_VERT;
326.2272 -        }
326.2273 -        if (state & java_awt_Frame_MAXIMIZED_HORIZ) {
326.2274 -            net_wm_state[nitems++] = _XA_NET_WM_STATE_MAXIMIZED_HORZ;
326.2275 -        }
326.2276 -        DASSERT(nitems <= AWT_NET_N_KNOWN_STATES);
326.2277 -
326.2278 -        if (nitems == 0) {
326.2279 -            DTRACE_PRINTLN("WM:     initial _NET_WM_STATE not necessary");
326.2280 -            return;
326.2281 -        }
326.2282 -
326.2283 -#ifdef DEBUG
326.2284 -        DTRACE_PRINT("WM:     setting initial ");
326.2285 -        awt_wm_dtraceStateNet(net_wm_state, nitems);
326.2286 -#endif
326.2287 -        XChangeProperty(dpy, shell_win,
326.2288 -                        _XA_NET_WM_STATE, XA_ATOM, 32, PropModeReplace,
326.2289 -                        (unsigned char *)net_wm_state, nitems);
326.2290 -    }
326.2291 -    else {
326.2292 -        /*
326.2293 -         * Tweak existing _NET_WM_STATE, preserving bits we don't use.
326.2294 -         */
326.2295 -        jint want= state        /* which flags we want */
326.2296 -            & (java_awt_Frame_MAXIMIZED_HORIZ | java_awt_Frame_MAXIMIZED_VERT);
326.2297 -
326.2298 -        jint has = 0;           /* which flags the window already has */
326.2299 -        int mode;               /* property mode: replace/append */
326.2300 -
326.2301 -        Atom *new_state;        /* new _net_wm_state value */
326.2302 -        int new_nitems;
326.2303 -        unsigned long i;
326.2304 -
326.2305 -#ifdef DEBUG
326.2306 -        DTRACE_PRINT("WM:     already has ");
326.2307 -        awt_wm_dtraceStateNet(old_state, nitems);
326.2308 -#endif
326.2309 -
326.2310 -        for (i = 0; i < nitems; ++i) {
326.2311 -            if (old_state[i] == _XA_NET_WM_STATE_MAXIMIZED_HORZ) {
326.2312 -                has |= java_awt_Frame_MAXIMIZED_HORIZ;
326.2313 -            }
326.2314 -            else if (old_state[i] == _XA_NET_WM_STATE_MAXIMIZED_VERT) {
326.2315 -                has |= java_awt_Frame_MAXIMIZED_VERT;
326.2316 -            }
326.2317 -        }
326.2318 -
326.2319 -        if ((has ^ want) == 0) {
326.2320 -            DTRACE_PRINTLN("WM:     no changes to _NET_WM_STATE necessary");
326.2321 -            XFree(old_state);
326.2322 -            return;
326.2323 -        }
326.2324 -
326.2325 -        new_nitems = 0;
326.2326 -        if (has == 0) {         /* only adding flags */
326.2327 -            new_state = calloc(AWT_NET_N_KNOWN_STATES, sizeof(Atom));
326.2328 -            mode = PropModeAppend;
326.2329 -        }
326.2330 -        else {
326.2331 -            new_state = calloc(nitems + AWT_NET_N_KNOWN_STATES, sizeof(Atom));
326.2332 -            mode = PropModeReplace;
326.2333 -        }
326.2334 -
326.2335 -        if (has != 0) {         /* copy existing flags */
326.2336 -            DTRACE_PRINT("WM:    ");
326.2337 -            for (i = 0; i < nitems; ++i) {
326.2338 -                if (old_state[i] == _XA_NET_WM_STATE_MAXIMIZED_HORZ) {
326.2339 -                    if (want & java_awt_Frame_MAXIMIZED_HORIZ) {
326.2340 -                        DTRACE_PRINT(" keep _HORZ");
326.2341 -                    } else {
326.2342 -                        DTRACE_PRINT(" drop _HORZ");
326.2343 -                        continue;
326.2344 -                    }
326.2345 -                }
326.2346 -                else if (old_state[i] == _XA_NET_WM_STATE_MAXIMIZED_VERT) {
326.2347 -                    if (want & java_awt_Frame_MAXIMIZED_VERT) {
326.2348 -                        DTRACE_PRINT(" keep _VERT");
326.2349 -                    } else {
326.2350 -                        DTRACE_PRINT(" drop _VERT");
326.2351 -                        continue;
326.2352 -                    }
326.2353 -                }
326.2354 -                new_state[new_nitems++] = old_state[i];
326.2355 -            }
326.2356 -        }
326.2357 -
326.2358 -        /* Add missing flags */
326.2359 -        if ((want & java_awt_Frame_MAXIMIZED_HORIZ)
326.2360 -             && !(has & java_awt_Frame_MAXIMIZED_HORIZ))
326.2361 -        {
326.2362 -            DTRACE_PRINT(" add _HORZ");
326.2363 -            new_state[new_nitems] = _XA_NET_WM_STATE_MAXIMIZED_HORZ;
326.2364 -            ++new_nitems;
326.2365 -        }
326.2366 -        if ((want & java_awt_Frame_MAXIMIZED_VERT)
326.2367 -             && !(has & java_awt_Frame_MAXIMIZED_VERT))
326.2368 -        {
326.2369 -            DTRACE_PRINT(" add _VERT");
326.2370 -            new_state[new_nitems] = _XA_NET_WM_STATE_MAXIMIZED_VERT;
326.2371 -            ++new_nitems;
326.2372 -        }
326.2373 -
326.2374 -        DTRACE_PRINTLN(mode == PropModeReplace ?
326.2375 -                       " ...  replacing" : " ...  appending");
326.2376 -        XChangeProperty(dpy, shell_win,
326.2377 -                        _XA_NET_WM_STATE, XA_ATOM, 32, mode,
326.2378 -                        (unsigned char *)new_state, new_nitems);
326.2379 -        XFree(old_state);
326.2380 -        XFree(new_state);
326.2381 -    }
326.2382 -}
326.2383 -
326.2384 -
326.2385 -/*
326.2386 - * Specify initial state for a Gnome WM (_WIN protocol) by setting
326.2387 - * WIN_STATE property on the window to the desired state before
326.2388 - * mapping it.
326.2389 - */
326.2390 -static void
326.2391 -awt_wm_setInitialStateWin(struct FrameData *wdata, jint state)
326.2392 -{
326.2393 -    Display *dpy = XtDisplay(wdata->winData.shell);
326.2394 -    Window shell_win = XtWindow(wdata->winData.shell);
326.2395 -    long win_state, old_win_state;
326.2396 -
326.2397 -    /* must use awt_wm_requestStateWin for managed windows */
326.2398 -    DASSERT(!wdata->isShowing);
326.2399 -
326.2400 -    /* Be careful to not wipe out state bits we don't understand */
326.2401 -    win_state = awt_getProperty32(shell_win, _XA_WIN_STATE, XA_CARDINAL);
326.2402 -    old_win_state = win_state;
326.2403 -#ifdef DEBUG
326.2404 -    if (win_state != 0) {
326.2405 -        DTRACE_PRINT("WM:     already has ");
326.2406 -        awt_wm_dtraceStateWin(win_state);
326.2407 -    }
326.2408 -#endif
326.2409 -
326.2410 -    /*
326.2411 -     * In their stupid quest of reinventing every wheel, Gnome WM spec
326.2412 -     * have its own "minimized" hint (instead of using initial state
326.2413 -     * and WM_STATE hints).  This is bogus, but, apparently, some WMs
326.2414 -     * pay attention.
326.2415 -     */
326.2416 -    if (state & java_awt_Frame_ICONIFIED) {
326.2417 -        win_state |= WIN_STATE_MINIMIZED;
326.2418 -    } else {
326.2419 -        win_state &= ~WIN_STATE_MINIMIZED;
326.2420 -    }
326.2421 -
326.2422 -    if (state & java_awt_Frame_MAXIMIZED_VERT) {
326.2423 -        win_state |= WIN_STATE_MAXIMIZED_VERT;
326.2424 -    } else {
326.2425 -        win_state &= ~WIN_STATE_MAXIMIZED_VERT;
326.2426 -    }
326.2427 -
326.2428 -    if (state & java_awt_Frame_MAXIMIZED_HORIZ) {
326.2429 -        win_state |= WIN_STATE_MAXIMIZED_HORIZ;
326.2430 -    } else {
326.2431 -        win_state &= ~WIN_STATE_MAXIMIZED_HORIZ;
326.2432 -    }
326.2433 -
326.2434 -    if (old_win_state ^ win_state) {
326.2435 -#ifdef DEBUG
326.2436 -        DTRACE_PRINT("WM:     setting initial ");
326.2437 -        awt_wm_dtraceStateWin(win_state);
326.2438 -#endif
326.2439 -        XChangeProperty(dpy, shell_win,
326.2440 -          _XA_WIN_STATE, XA_CARDINAL, 32, PropModeReplace,
326.2441 -          (unsigned char *)&win_state, 1);
326.2442 -    }
326.2443 -#ifdef DEBUG
326.2444 -    else {
326.2445 -        DTRACE_PRINTLN("WM:     no changes to _WIN_STATE necessary");
326.2446 -    }
326.2447 -#endif
326.2448 -}
326.2449 -
326.2450 -/*
326.2451 - * Request a layer change from a _NET supporting WM by sending
326.2452 - * _NET_WM_STATE ClientMessage to root window.
326.2453 - */
326.2454 -static void
326.2455 -awt_wm_requestLayerNet(struct FrameData *wdata, int state)
326.2456 -{
326.2457 -    Widget shell = wdata->winData.shell;
326.2458 -    Window shell_win = XtWindow(shell);
326.2459 -    XClientMessageEvent req;
326.2460 -    int currentLayer;
326.2461 -    long cmd;
326.2462 -
326.2463 -    /* must use awt_wm_setInitialLayerNet for withdrawn windows */
326.2464 -    DASSERT(wdata->isShowing);
326.2465 -
326.2466 -    currentLayer = awt_wm_getLayerNet(shell_win);
326.2467 -    if(state == currentLayer) {
326.2468 -       return;
326.2469 -    }
326.2470 -    cmd = currentLayer == LAYER_ALWAYS_ON_TOP && state == LAYER_NORMAL ?
326.2471 -                                                  _NET_WM_STATE_REMOVE :
326.2472 -          currentLayer == LAYER_NORMAL && state == LAYER_ALWAYS_ON_TOP  ?
326.2473 -                                                  _NET_WM_STATE_ADD :
326.2474 -                                                  _NET_WM_STATE_ADD;
326.2475 -    req.type          = ClientMessage;
326.2476 -    req.window          = XtWindow(shell);
326.2477 -    req.message_type = _XA_NET_WM_STATE;
326.2478 -    req.format          = 32;
326.2479 -    req.data.l[0]    = cmd;
326.2480 -    req.data.l[1]    = _XA_NET_WM_STATE_ABOVE;
326.2481 -    req.data.l[2]    = 0L;
326.2482 -
326.2483 -    XSendEvent(XtDisplay(shell), RootWindowOfScreen(XtScreen(shell)), False,
326.2484 -           (SubstructureRedirectMask | SubstructureNotifyMask),
326.2485 -           (XEvent *)&req);
326.2486 -}
326.2487 -
326.2488 -/*
326.2489 - * Request a layer change from a Gnome WM (_WIN protocol) by sending
326.2490 - * _WIN_LAYER ClientMessage to root window.
326.2491 - */
326.2492 -static void
326.2493 -awt_wm_requestLayerWin(struct FrameData *wdata, int state)
326.2494 -{
326.2495 -    Widget shell = wdata->winData.shell;
326.2496 -    XClientMessageEvent req;
326.2497 -    Display *dpy = XtDisplay(shell);
326.2498 -
326.2499 -    /* must use awt_wm_setInitialLayerWin for withdrawn windows */
326.2500 -    DASSERT(wdata->isShowing);
326.2501 -
326.2502 -    req.type          = ClientMessage;
326.2503 -    req.window          = XtWindow(shell);
326.2504 -    req.message_type = _XA_WIN_LAYER;
326.2505 -    req.format          = 32;
326.2506 -    req.data.l[0]    = state == LAYER_NORMAL ? WIN_LAYER_NORMAL : WIN_LAYER_ONTOP;
326.2507 -    req.data.l[1]    = 0L;
326.2508 -    req.data.l[2]    = 0L;
326.2509 -
326.2510 -    XSendEvent(XtDisplay(shell), RootWindowOfScreen(XtScreen(shell)), False,
326.2511 -           /*(SubstructureRedirectMask |*/
326.2512 -               SubstructureNotifyMask,
326.2513 -           (XEvent *)&req);
326.2514 -}
326.2515 -/*
326.2516 - * Specify initial layer for _NET supporting WM by setting
326.2517 - * _NET_WM_STATE property on the window to the desired state before
326.2518 - * mapping it.
326.2519 - * NB: looks like it doesn't have any effect.
326.2520 - */
326.2521 -static void
326.2522 -awt_wm_setInitialLayerNet(struct FrameData *wdata, int state)
326.2523 -{
326.2524 -    Widget shell = wdata->winData.shell;
326.2525 -    Window shell_win = XtWindow(shell);
326.2526 -    Display *dpy = XtDisplay(shell);
326.2527 -
326.2528 -    Atom *old_state;
326.2529 -    unsigned long nitems;
326.2530 -    Atom new_state = _XA_NET_WM_STATE_ABOVE;
326.2531 -
326.2532 -    /* must use awt_wm_requestLayerNet for managed windows */
326.2533 -    DASSERT(!wdata->isShowing);
326.2534 -
326.2535 -    /* Be careful to not wipe out state bits we don't understand */
326.2536 -    old_state = awt_getAtomListProperty(shell_win, _XA_NET_WM_STATE, &nitems);
326.2537 -
326.2538 -    if (nitems == 0 && state != LAYER_ALWAYS_ON_TOP) {
326.2539 -        if (old_state != NULL) {
326.2540 -            XFree(old_state);
326.2541 -        }
326.2542 -        return;
326.2543 -    }else if( nitems == 0 && state == LAYER_ALWAYS_ON_TOP) {
326.2544 -        unsigned long data[2];
326.2545 -        /* create new state */
326.2546 -        if (old_state != NULL) {
326.2547 -            XFree(old_state);
326.2548 -        }
326.2549 -        nitems = 1;
326.2550 -        data[0] = new_state;
326.2551 -        data[1] = 0;
326.2552 -        XChangeProperty(dpy, shell_win,
326.2553 -                _XA_NET_WM_STATE, XA_ATOM, 32, PropModeReplace,
326.2554 -                (unsigned char *)data, nitems);
326.2555 -            XSync(dpy, False);
326.2556 -    }else { /* nitems > 0 */
326.2557 -        unsigned long i;
326.2558 -        Boolean bShift = False;
326.2559 -        int mode;
326.2560 -        for(i = 0; i < nitems; i++) {
326.2561 -            if( bShift ) {
326.2562 -                old_state[i-1] = old_state[i];
326.2563 -            }else if( old_state[i] == _XA_NET_WM_STATE_ABOVE ) {
326.2564 -                if(state == LAYER_ALWAYS_ON_TOP) {
326.2565 -                    /* no change necessary */
326.2566 -                    XFree(old_state);
326.2567 -                    return;
326.2568 -                }else{
326.2569 -                    /* wipe off this atom */
326.2570 -                    bShift = True;
326.2571 -                }
326.2572 -            }
326.2573 -        }
326.2574 -
326.2575 -        if( bShift ) {
326.2576 -            /* atom was found and removed: change property */
326.2577 -            mode = PropModeReplace;
326.2578 -            nitems--;
326.2579 -        }else if( state != LAYER_ALWAYS_ON_TOP ) {
326.2580 -            /* atom was not found and not needed */
326.2581 -            XFree( old_state);
326.2582 -            return;
326.2583 -        }else {
326.2584 -            /* must add new atom */
326.2585 -            mode = PropModeAppend;
326.2586 -            nitems = 1;
326.2587 -        }
326.2588 -
326.2589 -        XChangeProperty(dpy, shell_win,
326.2590 -                _XA_NET_WM_STATE, XA_ATOM, 32, mode,
326.2591 -                mode == PropModeAppend ?
326.2592 -                            (unsigned char *)(&new_state) :
326.2593 -                            (unsigned char *)old_state, nitems);
326.2594 -        XFree(old_state);
326.2595 -            XSync(dpy, False);
326.2596 -    }
326.2597 -}
326.2598 -
326.2599 -/*
326.2600 - * Specify initial layer for a Gnome WM (_WIN protocol) by setting
326.2601 - * WIN_LAYER property on the window to the desired state before
326.2602 - * mapping it.
326.2603 - */
326.2604 -static void
326.2605 -awt_wm_setInitialLayerWin(struct FrameData *wdata, int state)
326.2606 -{
326.2607 -    Display *dpy = XtDisplay(wdata->winData.shell);
326.2608 -    Window shell_win = XtWindow(wdata->winData.shell);
326.2609 -    long win_state, old_win_state;
326.2610 -    int currentLayer;
326.2611 -
326.2612 -    /* must use awt_wm_requestLayerWin for managed windows */
326.2613 -    DASSERT(!wdata->isShowing);
326.2614 -
326.2615 -    currentLayer = awt_wm_getLayerWin(shell_win);
326.2616 -    if( currentLayer == state ) {
326.2617 -        /* no change necessary */
326.2618 -        return;
326.2619 -    }
326.2620 -    if( state == LAYER_ALWAYS_ON_TOP ) {
326.2621 -        win_state = WIN_LAYER_ONTOP;
326.2622 -    }else {
326.2623 -        win_state = WIN_LAYER_NORMAL;
326.2624 -    }
326.2625 -
326.2626 -    XChangeProperty(dpy, shell_win,
326.2627 -            _XA_WIN_LAYER, XA_CARDINAL, 32, PropModeReplace,
326.2628 -            (unsigned char *)&win_state, 1);
326.2629 -}
326.2630 -
326.2631 -void
326.2632 -awt_wm_setExtendedState(struct FrameData *wdata, jint state)
326.2633 -{
326.2634 -    Display *dpy = XtDisplay(wdata->winData.shell);
326.2635 -    Window shell_win = XtWindow(wdata->winData.shell);
326.2636 -
326.2637 -#ifdef DEBUG
326.2638 -    DTRACE_PRINT2("WM: setExtendedState(0x%x/0x%x) ",
326.2639 -                  wdata->winData.shell, shell_win);
326.2640 -    awt_wm_dtraceStateJava(state);
326.2641 -#endif
326.2642 -
326.2643 -    if (wdata->isShowing) {
326.2644 -        /*
326.2645 -         * If the window is managed by WM, we should send
326.2646 -         * ClientMessage requests.
326.2647 -         */
326.2648 -        if (awt_wm_doStateProtocolNet()) {
326.2649 -            awt_wm_requestStateNet(wdata, state);
326.2650 -        }
326.2651 -        else if (awt_wm_doStateProtocolWin()) {
326.2652 -            awt_wm_requestStateWin(wdata, state);
326.2653 -        }
326.2654 -        XSync(dpy, False);
326.2655 -    }
326.2656 -    else {
326.2657 -        /*
326.2658 -         * If the window is withdrawn we should set necessary
326.2659 -         * properties directly to the window before mapping it.
326.2660 -         */
326.2661 -        if (awt_wm_doStateProtocolNet()) {
326.2662 -            awt_wm_setInitialStateNet(wdata, state);
326.2663 -        }
326.2664 -        else if (awt_wm_doStateProtocolWin()) {
326.2665 -            awt_wm_setInitialStateWin(wdata, state);
326.2666 -        }
326.2667 -#if 1
326.2668 -        /*
326.2669 -         * Purge KWM bits.
326.2670 -         * Not really tested with KWM, only with WindowMaker.
326.2671 -         */
326.2672 -        XDeleteProperty(dpy, shell_win, XA_KWM_WIN_ICONIFIED);
326.2673 -        XDeleteProperty(dpy, shell_win, XA_KWM_WIN_MAXIMIZED);
326.2674 -#endif /* 1 */
326.2675 -    }
326.2676 -}
326.2677 -
326.2678 -static Boolean
326.2679 -awt_wm_supportsLayersNet() {
326.2680 -    Boolean supported = awt_wm_doStateProtocolNet();
326.2681 -
326.2682 -    /*
326.2683 -       In fact, WM may report this not supported but do support.
326.2684 -     */
326.2685 -    supported &= awt_wm_checkProtocol(_XA_NET_SUPPORTED, _XA_NET_WM_STATE_ABOVE);
326.2686 -    return supported;
326.2687 -}
326.2688 -
326.2689 -static Boolean
326.2690 -awt_wm_supportsLayersWin() {
326.2691 -    Boolean supported = awt_wm_doStateProtocolWin();
326.2692 -    /*
326.2693 -     * In fact, WM may report this supported but do not support.
326.2694 -     */
326.2695 -    supported &= awt_wm_checkProtocol(_XA_WIN_PROTOCOLS, _XA_WIN_LAYER);
326.2696 -    return supported;
326.2697 -}
326.2698 -
326.2699 -void
326.2700 -awt_wm_updateAlwaysOnTop(struct FrameData *wdata, jboolean bLayerState) {
326.2701 -    Display *dpy = XtDisplay(wdata->winData.shell);
326.2702 -    Window shell_win = XtWindow(wdata->winData.shell);
326.2703 -    int layerState = bLayerState ? LAYER_ALWAYS_ON_TOP : LAYER_NORMAL;
326.2704 -
326.2705 -    if (wdata->isShowing) {
326.2706 -        /**
326.2707 -           We don't believe anyone, and now send both ClientMessage requests.
326.2708 -           And eg Metacity under RH 6.1 required both to work.
326.2709 -         **/
326.2710 -        awt_wm_requestLayerNet(wdata, layerState);
326.2711 -        awt_wm_requestLayerWin(wdata, layerState);
326.2712 -    } else {
326.2713 -        /**
326.2714 -           We don't believe anyone, and now set both atoms.
326.2715 -           And eg Metacity under RH 6.1 required both to work.
326.2716 -         **/
326.2717 -        awt_wm_setInitialLayerNet(wdata, layerState);
326.2718 -        awt_wm_setInitialLayerWin(wdata, layerState);
326.2719 -    }
326.2720 -    XSync(dpy, False);
326.2721 -}
326.2722 -
326.2723 -/*
326.2724 - * Work around for 4775545.  _NET version.
326.2725 - */
326.2726 -static void
326.2727 -awt_wm_unshadeKludgeNet(struct FrameData *wdata)
326.2728 -{
326.2729 -    Display *dpy = XtDisplay(wdata->winData.shell);
326.2730 -    Window shell_win = XtWindow(wdata->winData.shell);
326.2731 -    Atom *net_wm_state;
326.2732 -    Boolean shaded;
326.2733 -    unsigned long nitems;
326.2734 -    unsigned long i;
326.2735 -
326.2736 -    net_wm_state = awt_getAtomListProperty(shell_win,
326.2737 -                                           _XA_NET_WM_STATE, &nitems);
326.2738 -    if (nitems == 0) {
326.2739 -        DTRACE_PRINTLN("WM:     _NET_WM_STATE = { }");
326.2740 -        if (net_wm_state) {
326.2741 -            XFree(net_wm_state);
326.2742 -        }
326.2743 -        return;
326.2744 -    }
326.2745 -#ifdef DEBUG
326.2746 -    DTRACE_PRINT("WM:     ");
326.2747 -    awt_wm_dtraceStateNet(net_wm_state, nitems);
326.2748 -#endif
326.2749 -
326.2750 -    shaded = False;
326.2751 -    for (i = 0; i < nitems; ++i) {
326.2752 -        if (net_wm_state[i] == _XA_NET_WM_STATE_SHADED) {
326.2753 -            shaded = True;
326.2754 -            break;
326.2755 -        }
326.2756 -    }
326.2757 -
326.2758 -    if (!shaded) {
326.2759 -        DTRACE_PRINTLN("WM:     not _SHADED, no workaround necessary");
326.2760 -        return;
326.2761 -    }
326.2762 -
326.2763 -    DTRACE_PRINTLN("WM:     removing _SHADED");
326.2764 -    ++i;                        /* skip _SHADED  */
326.2765 -    while (i < nitems) {        /* copy the rest */
326.2766 -        net_wm_state[i-1] = net_wm_state[i];
326.2767 -        ++i;
326.2768 -    }
326.2769 -    --nitems;                   /* _SHADED has been removed */
326.2770 -
326.2771 -#ifdef DEBUG
326.2772 -    DTRACE_PRINT("WM:     ");
326.2773 -    awt_wm_dtraceStateNet(net_wm_state, nitems);
326.2774 -#endif
326.2775 -
326.2776 -    WITH_XERROR_HANDLER(xerror_verify_change_property);
326.2777 -    {
326.2778 -        XChangeProperty(dpy, shell_win,
326.2779 -                        _XA_NET_WM_STATE, XA_ATOM, 32, PropModeReplace,
326.2780 -                        (unsigned char *)net_wm_state, nitems);
326.2781 -    }
326.2782 -    RESTORE_XERROR_HANDLER;
326.2783 -
326.2784 -    if (xerror_code != Success) {
326.2785 -        DTRACE_PRINTLN1("WM:     XChangeProperty failed, error = %d",
326.2786 -                        xerror_code);
326.2787 -    }
326.2788 -
326.2789 -    XFree(net_wm_state);
326.2790 -}
326.2791 -
326.2792 -
326.2793 -/*
326.2794 - * Work around for 4775545.  _WIN version.
326.2795 - */
326.2796 -static void
326.2797 -awt_wm_unshadeKludgeWin(struct FrameData *wdata)
326.2798 -{
326.2799 -    Display *dpy = XtDisplay(wdata->winData.shell);
326.2800 -    Window shell_win = XtWindow(wdata->winData.shell);
326.2801 -    long win_state;
326.2802 -
326.2803 -    win_state = awt_getProperty32(shell_win, _XA_WIN_STATE, XA_CARDINAL);
326.2804 -#ifdef DEBUG
326.2805 -    DTRACE_PRINT("WM:     ");
326.2806 -    awt_wm_dtraceStateWin(win_state);
326.2807 -#endif
326.2808 -
326.2809 -    if ((win_state & WIN_STATE_SHADED) == 0) {
326.2810 -        DTRACE_PRINTLN("WM:     not _SHADED, no workaround necessary");
326.2811 -        return;
326.2812 -    }
326.2813 -
326.2814 -    win_state &= ~WIN_STATE_SHADED;
326.2815 -    XChangeProperty(dpy, shell_win,
326.2816 -                    _XA_WIN_STATE, XA_CARDINAL, 32, PropModeReplace,
326.2817 -                    (unsigned char *)&win_state, 1);
326.2818 -}
326.2819 -
326.2820 -
326.2821 -/*
326.2822 - * Work around for 4775545.
326.2823 - *
326.2824 - * If WM exits while the top-level is shaded, the shaded hint remains
326.2825 - * on the top-level properties.  When WM restarts and sees the shaded
326.2826 - * window it can reparent it into a "pre-shaded" decoration frame
326.2827 - * (Metacity does), and our insets logic will go crazy, b/c it will
326.2828 - * see a huge nagative bottom inset.  There's no clean solution for
326.2829 - * this, so let's just be weasels and drop the shaded hint if we
326.2830 - * detect that WM exited.  NB: we are in for a race condition with WM
326.2831 - * restart here.  NB2: e.g. WindowMaker saves the state in a private
326.2832 - * property that this code knows nothing about, so this workaround is
326.2833 - * not effective; other WMs might play similar tricks.
326.2834 - */
326.2835 -void
326.2836 -awt_wm_unshadeKludge(struct FrameData *wdata)
326.2837 -{
326.2838 -    DTRACE_PRINTLN("WM: unshade kludge");
326.2839 -    DASSERT(wdata->isShowing);
326.2840 -
326.2841 -    if (awt_wm_doStateProtocolNet()) {
326.2842 -        awt_wm_unshadeKludgeNet(wdata);
326.2843 -    }
326.2844 -    else if (awt_wm_doStateProtocolWin()) {
326.2845 -        awt_wm_unshadeKludgeWin(wdata);
326.2846 -    }
326.2847 -#ifdef DEBUG
326.2848 -    else {
326.2849 -        DTRACE_PRINTLN("WM:     not a _NET or _WIN supporting WM");
326.2850 -    }
326.2851 -#endif
326.2852 -
326.2853 -    XSync(XtDisplay(wdata->winData.shell), False);
326.2854 -}
326.2855 -
326.2856 -
326.2857 -void
326.2858 -awt_wm_init(void)
326.2859 -{
326.2860 -    static Boolean inited = False;
326.2861 -    if (inited) {
326.2862 -        return;
326.2863 -    }
326.2864 -
326.2865 -    awt_wm_initAtoms();
326.2866 -    awt_wm_getRunningWM();
326.2867 -    inited = True;
326.2868 -}
326.2869 -
326.2870 -Boolean awt_wm_supportsAlwaysOnTop() {
326.2871 -    return awt_wm_supportsLayersNet() || awt_wm_supportsLayersWin();
326.2872 -}
   327.1 --- a/src/solaris/native/sun/awt/awt_wm.h	Tue Dec 06 16:31:58 2011 -0800
   327.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   327.3 @@ -1,84 +0,0 @@
   327.4 -/*
   327.5 - * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
   327.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   327.7 - *
   327.8 - * This code is free software; you can redistribute it and/or modify it
   327.9 - * under the terms of the GNU General Public License version 2 only, as
  327.10 - * published by the Free Software Foundation.  Oracle designates this
  327.11 - * particular file as subject to the "Classpath" exception as provided
  327.12 - * by Oracle in the LICENSE file that accompanied this code.
  327.13 - *
  327.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
  327.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  327.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  327.17 - * version 2 for more details (a copy is included in the LICENSE file that
  327.18 - * accompanied this code).
  327.19 - *
  327.20 - * You should have received a copy of the GNU General Public License version
  327.21 - * 2 along with this work; if not, write to the Free Software Foundation,
  327.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  327.23 - *
  327.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  327.25 - * or visit www.oracle.com if you need additional information or have any
  327.26 - * questions.
  327.27 - */
  327.28 -
  327.29 -#ifndef _AWT_WM_H_
  327.30 -#define _AWT_WM_H_
  327.31 -
  327.32 -#ifndef HEADLESS
  327.33 -
  327.34 -#include "awt_p.h"
  327.35 -
  327.36 -/*
  327.37 - * Window Managers we care to distinguish.
  327.38 - * See awt_wm_getRunningWM()
  327.39 - */
  327.40 -enum wmgr_t {
  327.41 -    UNDETERMINED_WM,
  327.42 -    NO_WM,
  327.43 -    OTHER_WM,
  327.44 -    OPENLOOK_WM,
  327.45 -    MOTIF_WM,
  327.46 -    CDE_WM,
  327.47 -    ENLIGHTEN_WM,
  327.48 -    KDE2_WM,
  327.49 -    SAWFISH_WM,
  327.50 -    ICE_WM,
  327.51 -    METACITY_WM
  327.52 -};
  327.53 -
  327.54 -extern void awt_wm_init(void);
  327.55 -
  327.56 -extern enum wmgr_t awt_wm_getRunningWM(void);
  327.57 -extern Boolean awt_wm_configureGravityBuggy(void);
  327.58 -extern Boolean awt_wm_supportsExtendedState(jint state);
  327.59 -
  327.60 -/* XWMHints.flags is declared long, so 'mask' argument is declared long too */
  327.61 -extern void awt_wm_removeSizeHints(Widget shell, long mask);
  327.62 -
  327.63 -extern void awt_wm_setShellDecor(struct FrameData *wdata, Boolean resizable);
  327.64 -extern void awt_wm_setShellResizable(struct FrameData *wdata);
  327.65 -extern void awt_wm_setShellNotResizable(struct FrameData *wdata,
  327.66 -                                        int32_t width, int32_t height,
  327.67 -                                        Boolean justChangeSize);
  327.68 -
  327.69 -extern Boolean awt_wm_getInsetsFromProp(Window w,
  327.70 -                 int32_t *top, int32_t *left, int32_t *bottom, int32_t *right);
  327.71 -
  327.72 -/*
  327.73 - * WM_STATE: WithdrawnState, NormalState, IconicState.
  327.74 - * Absence of WM_STATE is treated as WithdrawnState.
  327.75 - */
  327.76 -extern int awt_wm_getWMState(Window w);
  327.77 -
  327.78 -extern void awt_wm_setExtendedState(struct FrameData *wdata, jint state);
  327.79 -extern Boolean awt_wm_isStateChange(struct FrameData *wdata, XPropertyEvent *e,
  327.80 -                                    jint *pstate);
  327.81 -
  327.82 -extern void awt_wm_unshadeKludge(struct FrameData *wdata);
  327.83 -extern void awt_wm_updateAlwaysOnTop(struct FrameData *wdata, jboolean bLayerState);
  327.84 -extern Boolean awt_wm_supportsAlwaysOnTop();
  327.85 -
  327.86 -#endif /* !HEADLESS */
  327.87 -#endif /* _AWT_WM_H_ */
   328.1 --- a/src/solaris/native/sun/awt/awt_xembed.h	Tue Dec 06 16:31:58 2011 -0800
   328.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   328.3 @@ -1,80 +0,0 @@
   328.4 -/*
   328.5 - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
   328.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   328.7 - *
   328.8 - * This code is free software; you can redistribute it and/or modify it
   328.9 - * under the terms of the GNU General Public License version 2 only, as
  328.10 - * published by the Free Software Foundation.  Oracle designates this
  328.11 - * particular file as subject to the "Classpath" exception as provided
  328.12 - * by Oracle in the LICENSE file that accompanied this code.
  328.13 - *
  328.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
  328.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  328.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  328.17 - * version 2 for more details (a copy is included in the LICENSE file that
  328.18 - * accompanied this code).
  328.19 - *
  328.20 - * You should have received a copy of the GNU General Public License version
  328.21 - * 2 along with this work; if not, write to the Free Software Foundation,
  328.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  328.23 - *
  328.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  328.25 - * or visit www.oracle.com if you need additional information or have any
  328.26 - * questions.
  328.27 - */
  328.28 -
  328.29 -#ifndef _AWT_XEMBED_H_
  328.30 -#define _AWT_XEMBED_H_
  328.31 -
  328.32 -#ifndef HEADLESS
  328.33 -
  328.34 -#include "awt_p.h"
  328.35 -
  328.36 -#define XEMBED_VERSION  0
  328.37 -#define XEMBED_MAPPED  (1 << 0)
  328.38 -/* XEMBED messages */
  328.39 -#define XEMBED_EMBEDDED_NOTIFY              0
  328.40 -#define XEMBED_WINDOW_ACTIVATE      1
  328.41 -#define XEMBED_WINDOW_DEACTIVATE    2
  328.42 -#define XEMBED_REQUEST_FOCUS         3
  328.43 -#define XEMBED_FOCUS_IN             4
  328.44 -#define XEMBED_FOCUS_OUT            5
  328.45 -#define XEMBED_FOCUS_NEXT           6
  328.46 -#define XEMBED_FOCUS_PREV           7
  328.47 -/* 8-9 were used for XEMBED_GRAB_KEY/XEMBED_UNGRAB_KEY */
  328.48 -#define XEMBED_MODALITY_ON          10
  328.49 -#define XEMBED_MODALITY_OFF         11
  328.50 -#define XEMBED_REGISTER_ACCELERATOR     12
  328.51 -#define XEMBED_UNREGISTER_ACCELERATOR   13
  328.52 -#define XEMBED_ACTIVATE_ACCELERATOR     14
  328.53 -
  328.54 -#define XEMBED_LAST_MSG XEMBED_ACTIVATE_ACCELERATOR
  328.55 -
  328.56 -#define  NON_STANDARD_XEMBED_GTK_GRAB_KEY  108
  328.57 -#define NON_STANDARD_XEMBED_GTK_UNGRAB_KEY  109
  328.58 -
  328.59 -// Sun internal special message, to resolve start race condition
  328.60 -#define _SUN_XEMBED_START  1119
  328.61 -
  328.62 -
  328.63 -//     A detail code is required for XEMBED_FOCUS_IN. The following values are valid:
  328.64 -/* Details for  XEMBED_FOCUS_IN: */
  328.65 -#define XEMBED_FOCUS_CURRENT        0
  328.66 -#define XEMBED_FOCUS_FIRST          1
  328.67 -#define XEMBED_FOCUS_LAST           2
  328.68 -
  328.69 -
  328.70 -extern void init_xembed();
  328.71 -extern void xembed_eventHandler(XEvent *event);
  328.72 -extern void requestXEmbedFocus(struct FrameData * wdata);
  328.73 -extern void install_xembed(Widget client, struct FrameData* wdata);
  328.74 -extern void deinstall_xembed(struct FrameData* wdata);
  328.75 -extern Boolean isXEmbedActive(struct FrameData * wdata);
  328.76 -extern Boolean isXEmbedActiveByWindow(Window client);
  328.77 -extern Boolean isXEmbedApplicationActive(struct FrameData * wdata);
  328.78 -extern void sendMessageHelper(Window window, int message, long detail,
  328.79 -                              long data1, long data2);
  328.80 -extern void sendMessage(Window window, int message);
  328.81 -extern void xembed_traverse_out(struct FrameData * wdata, jboolean);
  328.82 -#endif
  328.83 -#endif
   329.1 --- a/src/solaris/native/sun/awt/awt_xembed_server.c	Tue Dec 06 16:31:58 2011 -0800
   329.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   329.3 @@ -1,969 +0,0 @@
   329.4 -/*
   329.5 - * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
   329.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   329.7 - *
   329.8 - * This code is free software; you can redistribute it and/or modify it
   329.9 - * under the terms of the GNU General Public License version 2 only, as
  329.10 - * published by the Free Software Foundation.  Oracle designates this
  329.11 - * particular file as subject to the "Classpath" exception as provided
  329.12 - * by Oracle in the LICENSE file that accompanied this code.
  329.13 - *
  329.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
  329.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  329.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  329.17 - * version 2 for more details (a copy is included in the LICENSE file that
  329.18 - * accompanied this code).
  329.19 - *
  329.20 - * You should have received a copy of the GNU General Public License version
  329.21 - * 2 along with this work; if not, write to the Free Software Foundation,
  329.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  329.23 - *
  329.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  329.25 - * or visit www.oracle.com if you need additional information or have any
  329.26 - * questions.
  329.27 - */
  329.28 -
  329.29 -// TODO: Propogate applicationActive from Java
  329.30 -
  329.31 -#ifdef HEADLESS
  329.32 -    #error This file should not be included in headless library
  329.33 -#endif
  329.34 -
  329.35 -#include "awt_p.h"
  329.36 -
  329.37 -#include <X11/Xproto.h>
  329.38 -#include <X11/Xlib.h>
  329.39 -#include <X11/Xatom.h>
  329.40 -#include <Xm/MwmUtil.h>
  329.41 -#ifdef __linux__
  329.42 -#include <execinfo.h>
  329.43 -#endif
  329.44 -#include <stdio.h>
  329.45 -#include <stdlib.h>
  329.46 -
  329.47 -/* JNI headers */
  329.48 -#include "java_awt_Frame.h"     /* for frame state constants */
  329.49 -#include "java_awt_event_KeyEvent.h"
  329.50 -#include "awt_wm.h"
  329.51 -#include "awt_util.h"           /* for X11 error handling macros */
  329.52 -#include "awt_xembed.h"
  329.53 -#include "awt_Component.h"
  329.54 -#include "awt_AWTEvent.h"
  329.55 -#include "canvas.h"
  329.56 -#include "sun_awt_motif_MEmbedCanvasPeer.h"
  329.57 -
  329.58 -#ifdef DOTRACE
  329.59 -#define MTRACE(param) fprintf(stderr, param)
  329.60 -#define MTRACEP1(format, p1) fprintf(stderr, format, p1)
  329.61 -#define MTRACEP2(format, p1, p2) fprintf(stderr, format, p1, p2)
  329.62 -#define MTRACEP3(format, p1, p2, p3) fprintf(stderr, format, p1, p2, p3)
  329.63 -#define MTRACEP4(format, p1, p2, p3, p4) fprintf(stderr, format, p1, p2, p3, p4)
  329.64 -#define MTRACEP5(format, p1, p2, p3, p4, p5) fprintf(stderr, format, p1, p2, p3, p4, p5)
  329.65 -#define MTRACEP6(format, p1, p2, p3, p4, p5, p6) fprintf(stderr, format, p1, p2, p3, p4, p5, p6)
  329.66 -#define MTRACEP7(format, p1, p2, p3, p4, p5, p6, p7) fprintf(stderr, format, p1, p2, p3, p4, p5, p6, p7)
  329.67 -#else
  329.68 -#define MTRACE(param)
  329.69 -#define MTRACEP1(format, p1)
  329.70 -#define MTRACEP2(format, p1, p2)
  329.71 -#define MTRACEP3(format, p1, p2, p3)
  329.72 -#define MTRACEP4(format, p1, p2, p3, p4)
  329.73 -#define MTRACEP5(format, p1, p2, p3, p4, p5)
  329.74 -#define MTRACEP6(format, p1, p2, p3, p4, p5, p6)
  329.75 -#define MTRACEP7(format, p1, p2, p3, p4, p5, p6, p7)
  329.76 -#endif
  329.77 -
  329.78 -/**************************** XEmbed server DnD support ***********************/
  329.79 -extern Atom XA_XdndAware;
  329.80 -extern Boolean
  329.81 -register_xembed_drop_site(JNIEnv* env, Display* dpy, jobject server,
  329.82 -                          Window serverHandle, Window clientHandle);
  329.83 -extern Boolean
  329.84 -unregister_xembed_drop_site(JNIEnv* env, Display* dpy, jobject server,
  329.85 -                            Window serverHandle, Window clientHandle);
  329.86 -extern void
  329.87 -forward_event_to_embedded(Window embedded, jlong ctxt, jint eventID);
  329.88 -
  329.89 -extern const char * msg_to_str(int msg);
  329.90 -
  329.91 -void
  329.92 -set_xembed_drop_target(JNIEnv* env, jobject server);
  329.93 -void
  329.94 -remove_xembed_drop_target(JNIEnv* env, jobject server);
  329.95 -Boolean
  329.96 -is_xembed_client(Window window);
  329.97 -/******************************************************************************/
  329.98 -extern struct MComponentPeerIDs mComponentPeerIDs;
  329.99 -static jobject createRectangle(JNIEnv* env, int x, int y, int width, int height);
 329.100 -static jobject createDimension(JNIEnv* env, int width, int height);
 329.101 -static void processXEmbedInfo(JNIEnv* env, jobject this);
 329.102 -static Atom XA_XEmbedInfo;
 329.103 -static Atom XA_XEmbed;
 329.104 -static jmethodID requestXEmbedFocusMID, focusNextMID, focusPrevMID,
 329.105 -    registerAcceleratorMID, unregisterAcceleratorMID,
 329.106 -    grabKeyMID, ungrabKeyMID, childResizedMID,
 329.107 -    setXEmbedDropTargetMID, removeXEmbedDropTargetMID;
 329.108 -static jfieldID keysymFID, modifiersFID, applicationActiveFID;
 329.109 -
 329.110 -typedef struct _xembed_server_data {
 329.111 -    Window handle; // pointer to plugin intermediate widget, XEmbed client
 329.112 -    Window serverHandle;
 329.113 -    Widget serverWidget;
 329.114 -    Boolean dispatching; // whether we dispatch messages for handle
 329.115 -    int version;
 329.116 -    jobject server;
 329.117 -    struct _xembed_server_data * next;
 329.118 -} xembed_server_data, * pxembed_server_data;
 329.119 -
 329.120 -static pxembed_server_data xembed_list = NULL;
 329.121 -
 329.122 -static pxembed_server_data
 329.123 -getData(Window handle) {
 329.124 -    pxembed_server_data temp = xembed_list;
 329.125 -    while (temp != NULL) {
 329.126 -        if (temp->handle == handle) {
 329.127 -            return temp;
 329.128 -        }
 329.129 -        temp = temp->next;
 329.130 -    }
 329.131 -    return NULL;
 329.132 -}
 329.133 -
 329.134 -static pxembed_server_data
 329.135 -getDataByEmbedder(jobject server) {
 329.136 -    JNIEnv      *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 329.137 -    pxembed_server_data temp = xembed_list;
 329.138 -    DASSERT(server != NULL);
 329.139 -    while (temp != NULL) {
 329.140 -        if ((*env)->IsSameObject(env, temp->server, server)) {
 329.141 -            return temp;
 329.142 -        }
 329.143 -        temp = temp->next;
 329.144 -    }
 329.145 -    return NULL;
 329.146 -}
 329.147 -
 329.148 -static pxembed_server_data
 329.149 -getDataByServerHandle(Window serverHandle) {
 329.150 -    JNIEnv      *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 329.151 -    pxembed_server_data temp = xembed_list;
 329.152 -    Widget serverWidget = NULL;
 329.153 -    if (serverHandle == None) {
 329.154 -        return NULL;
 329.155 -    }
 329.156 -    serverWidget = XtWindowToWidget(awt_display, serverHandle);
 329.157 -    while (temp != NULL) {
 329.158 -        if (temp->serverHandle == serverHandle || temp->serverWidget == serverWidget) {
 329.159 -            temp->serverHandle = serverWidget;
 329.160 -            return temp;
 329.161 -        }
 329.162 -        temp = temp->next;
 329.163 -    }
 329.164 -    return NULL;
 329.165 -}
 329.166 -
 329.167 -static pxembed_server_data
 329.168 -addData(jobject server) {
 329.169 -    JNIEnv      *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 329.170 -    struct ComponentData *cdata;
 329.171 -    xembed_server_data * data = malloc(sizeof(xembed_server_data));
 329.172 -    DASSERT(server != NULL);
 329.173 -    memset(data, 0, sizeof(xembed_server_data));
 329.174 -    data->server = server;
 329.175 -    cdata = (struct ComponentData *)
 329.176 -        JNU_GetLongFieldAsPtr(env, server, mComponentPeerIDs.pData);
 329.177 -    DASSERT(cdata != NULL);
 329.178 -    data->serverHandle = XtWindow(cdata->widget);
 329.179 -    data->serverWidget = cdata->widget;
 329.180 -    data->next = xembed_list;
 329.181 -    xembed_list = data;
 329.182 -    return data;
 329.183 -}
 329.184 -
 329.185 -static void
 329.186 -removeData(jobject server) {
 329.187 -    JNIEnv      *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 329.188 -    pxembed_server_data * temp = &xembed_list;
 329.189 -    DASSERT(server != NULL);
 329.190 -    while (*temp != NULL) {
 329.191 -        if ((*env)->IsSameObject(env, (*temp)->server, server)) {
 329.192 -            xembed_server_data * data = *temp;
 329.193 -            *temp = (*temp)->next;
 329.194 -            DASSERT(data->server != NULL);
 329.195 -            (*env)->DeleteGlobalRef(env, data->server);
 329.196 -            free(data);
 329.197 -            return;
 329.198 -        }
 329.199 -        temp = &(*temp)->next;
 329.200 -    }
 329.201 -}
 329.202 -
 329.203 -void
 329.204 -initXEmbedServerData() {
 329.205 -    JNIEnv      *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 329.206 -    jclass clazz;
 329.207 -    MTRACE("initXEmbedServerData\n");
 329.208 -    XA_XEmbedInfo = XInternAtom(awt_display, "_XEMBED_INFO", False);
 329.209 -    XA_XEmbed = XInternAtom(awt_display, "_XEMBED", False);
 329.210 -
 329.211 -    clazz = (*env)->FindClass(env, "sun/awt/motif/MEmbedCanvasPeer");
 329.212 -    DASSERT(clazz != NULL);
 329.213 -    requestXEmbedFocusMID = (*env)->GetMethodID(env, clazz, "requestXEmbedFocus", "()V");
 329.214 -    DASSERT(requestXEmbedFocusMID != NULL);
 329.215 -    focusNextMID = (*env)->GetMethodID(env, clazz, "focusNext", "()V");
 329.216 -    DASSERT(focusNextMID != NULL);
 329.217 -    focusPrevMID = (*env)->GetMethodID(env, clazz, "focusPrev", "()V");
 329.218 -    DASSERT(focusPrevMID != NULL);
 329.219 -    registerAcceleratorMID = (*env)->GetMethodID(env, clazz, "registerAccelerator", "(JJJ)V");
 329.220 -    DASSERT(registerAcceleratorMID != NULL);
 329.221 -    unregisterAcceleratorMID = (*env)->GetMethodID(env, clazz, "unregisterAccelerator", "(J)V");
 329.222 -    DASSERT(unregisterAcceleratorMID != NULL);
 329.223 -    grabKeyMID = (*env)->GetMethodID(env, clazz, "grabKey", "(JJ)V");
 329.224 -    DASSERT(grabKeyMID != NULL);
 329.225 -    ungrabKeyMID = (*env)->GetMethodID(env, clazz, "ungrabKey", "(JJ)V");
 329.226 -    DASSERT(ungrabKeyMID != NULL);
 329.227 -    childResizedMID = (*env)->GetMethodID(env, clazz, "childResized", "()V");
 329.228 -    DASSERT(childResizedMID != NULL);
 329.229 -    setXEmbedDropTargetMID =
 329.230 -        (*env)->GetMethodID(env, clazz, "setXEmbedDropTarget", "()V");
 329.231 -    DASSERT(setXEmbedDropTargetMID != NULL);
 329.232 -    removeXEmbedDropTargetMID =
 329.233 -        (*env)->GetMethodID(env, clazz, "removeXEmbedDropTarget", "()V");
 329.234 -    DASSERT(removeXEmbedDropTargetMID != NULL);
 329.235 -
 329.236 -    applicationActiveFID = (*env)->GetFieldID(env, clazz, "applicationActive", "Z");
 329.237 -    DASSERT(applicationActiveFID != NULL);
 329.238 -    (*env)->DeleteLocalRef(env, clazz);
 329.239 -
 329.240 -    clazz = (*env)->FindClass(env, "sun/awt/motif/GrabbedKey");
 329.241 -    DASSERT(clazz != NULL);
 329.242 -    keysymFID = (*env)->GetFieldID(env, clazz, "keysym", "J");
 329.243 -    DASSERT(keysymFID != NULL);
 329.244 -    modifiersFID = (*env)->GetFieldID(env, clazz, "modifiers", "J");
 329.245 -    DASSERT(modifiersFID != NULL);
 329.246 -    (*env)->DeleteLocalRef(env, clazz);
 329.247 -}
 329.248 -
 329.249 -/*
 329.250 - * Class:     sun_awt_motif_MEmbedCanvasPeer
 329.251 - * Method:    initXEmbedServer
 329.252 - * Signature: ()V
 329.253 - */
 329.254 -JNIEXPORT void JNICALL
 329.255 -Java_sun_awt_motif_MEmbedCanvasPeer_initXEmbedServer(JNIEnv *env, jobject this) {
 329.256 -    struct ComponentData *cdata;
 329.257 -    AWT_LOCK();
 329.258 -    MTRACE("initXEmbedServer\n");
 329.259 -    addData((*env)->NewGlobalRef(env, this));
 329.260 -    if (XA_XEmbedInfo == None) {
 329.261 -        initXEmbedServerData();
 329.262 -    }
 329.263 -    cdata = (struct ComponentData *)
 329.264 -        JNU_GetLongFieldAsPtr(env, this, mComponentPeerIDs.pData);
 329.265 -/*     XSelectInput(awt_display, XtWindow(cdata->widget), SubstructureNotifyMask); */
 329.266 -    XtAddEventHandler(cdata->widget,
 329.267 -                      SubstructureNotifyMask,
 329.268 -                      False, null_event_handler, NULL);
 329.269 -    AWT_UNLOCK();
 329.270 -}
 329.271 -
 329.272 -/*
 329.273 - * Class:     sun_awt_motif_MEmbedCanvasPeer
 329.274 - * Method:    destroyXEmbedServer
 329.275 - * Signature: ()V
 329.276 - */
 329.277 -JNIEXPORT void JNICALL
 329.278 -Java_sun_awt_motif_MEmbedCanvasPeer_destroyXEmbedServer(JNIEnv *env, jobject this) {
 329.279 -    AWT_LOCK();
 329.280 -    MTRACE("destroyXEmbedServer\n");
 329.281 -    removeData(this);
 329.282 -    AWT_UNLOCK();
 329.283 -}
 329.284 -
 329.285 -/*
 329.286 - * Class:     sun_awt_motif_MEmbedCanvasPeer
 329.287 - * Method:    isXEmbedActive
 329.288 - * Signature: ()Z
 329.289 - */
 329.290 -JNIEXPORT jboolean JNICALL
 329.291 -Java_sun_awt_motif_MEmbedCanvasPeer_isXEmbedActive(JNIEnv *env, jobject this) {
 329.292 -    pxembed_server_data sdata;
 329.293 -    jboolean res = JNI_FALSE;
 329.294 -    AWT_LOCK();
 329.295 -    sdata = getDataByEmbedder(this);
 329.296 -    if (sdata != NULL) {
 329.297 -        res = (sdata->handle != None)?JNI_TRUE:JNI_FALSE;
 329.298 -    }
 329.299 -    AWT_UNLOCK();
 329.300 -    return res;
 329.301 -}
 329.302 -
 329.303 -/*
 329.304 - * Class:     sun_awt_motif_MEmbedCanvasPeer
 329.305 - * Method:    initDispatching
 329.306 - * Signature: ()V
 329.307 - */
 329.308 -JNIEXPORT void JNICALL
 329.309 -Java_sun_awt_motif_MEmbedCanvasPeer_initDispatching (JNIEnv *env, jobject this) {
 329.310 -    pxembed_server_data sdata;
 329.311 -    AWT_LOCK();
 329.312 -    MTRACE("initDispatching\n");
 329.313 -    sdata = getDataByEmbedder(this);
 329.314 -    if (sdata != NULL) {
 329.315 -        XSelectInput(awt_display, sdata->handle, StructureNotifyMask | PropertyChangeMask);
 329.316 -        sdata->dispatching = True;
 329.317 -        register_xembed_drop_site(env, awt_display, sdata->server,
 329.318 -                                  sdata->serverHandle, sdata->handle);
 329.319 -    }
 329.320 -    processXEmbedInfo(env, this);
 329.321 -    Java_sun_awt_motif_MEmbedCanvasPeer_notifyChildEmbedded(env, this);
 329.322 -    AWT_UNLOCK();
 329.323 -}
 329.324 -
 329.325 -/*
 329.326 - * Class:     sun_awt_motif_MEmbedCanvasPeer
 329.327 - * Method:    endDispatching
 329.328 - * Signature: ()V
 329.329 - */
 329.330 -JNIEXPORT void JNICALL
 329.331 -Java_sun_awt_motif_MEmbedCanvasPeer_endDispatching (JNIEnv *env, jobject this) {
 329.332 -    pxembed_server_data sdata;
 329.333 -    AWT_LOCK();
 329.334 -    MTRACE("endDispatching\n");
 329.335 -    sdata = getDataByEmbedder(this);
 329.336 -    if (sdata != NULL) {
 329.337 -        unregister_xembed_drop_site(env, awt_display, sdata->server,
 329.338 -                                    sdata->serverHandle, sdata->handle);
 329.339 -        sdata->dispatching = False;
 329.340 -    }
 329.341 -    AWT_UNLOCK();
 329.342 -}
 329.343 -
 329.344 -/*
 329.345 - * Class:     sun_awt_motif_MEmbedCanvasPeer
 329.346 - * Method:    embedChild
 329.347 - * Signature: (J)V
 329.348 - */
 329.349 -JNIEXPORT void JNICALL
 329.350 -Java_sun_awt_motif_MEmbedCanvasPeer_embedChild (JNIEnv * env, jobject this, jlong handle) {
 329.351 -    pxembed_server_data sdata;
 329.352 -    AWT_LOCK();
 329.353 -    MTRACE("embedChild\n");
 329.354 -    sdata = getDataByEmbedder(this);
 329.355 -    if (sdata != NULL) {
 329.356 -        if (sdata->handle != None) {
 329.357 -            Java_sun_awt_motif_MEmbedCanvasPeer_detachChild(env, this);
 329.358 -        }
 329.359 -        sdata->handle = (Window)handle;
 329.360 -        Java_sun_awt_motif_MEmbedCanvasPeer_initDispatching(env, this);
 329.361 -    }
 329.362 -    AWT_UNLOCK();
 329.363 -}
 329.364 -
 329.365 -/*
 329.366 - * Class:     sun_awt_motif_MEmbedCanvasPeer
 329.367 - * Method:    childDestroyed
 329.368 - * Signature: ()V
 329.369 - */
 329.370 -JNIEXPORT void JNICALL
 329.371 -Java_sun_awt_motif_MEmbedCanvasPeer_childDestroyed (JNIEnv *env, jobject this) {
 329.372 -    pxembed_server_data sdata;
 329.373 -    AWT_LOCK();
 329.374 -    MTRACE("childDestroyed\n");
 329.375 -    Java_sun_awt_motif_MEmbedCanvasPeer_endDispatching(env, this);
 329.376 -    sdata = getDataByEmbedder(this);
 329.377 -    if (sdata != NULL) {
 329.378 -        sdata->handle = None;
 329.379 -    }
 329.380 -    AWT_UNLOCK();
 329.381 -}
 329.382 -
 329.383 -/*
 329.384 - * Class:     sun_awt_motif_MEmbedCanvasPeer
 329.385 - * Method:    getEmbedPreferredSize
 329.386 - * Signature: ()Ljava/awt/Dimension;
 329.387 - */
 329.388 -JNIEXPORT jobject JNICALL
 329.389 -Java_sun_awt_motif_MEmbedCanvasPeer_getEmbedPreferredSize (JNIEnv *env, jobject this) {
 329.390 -    pxembed_server_data sdata;
 329.391 -    jobject res = NULL;
 329.392 -    XSizeHints * hints;
 329.393 -    long dummy;
 329.394 -    AWT_LOCK();
 329.395 -    MTRACE("getPreferredSize\n");
 329.396 -    sdata = getDataByEmbedder(this);
 329.397 -    if (sdata != NULL) {
 329.398 -        hints = XAllocSizeHints();
 329.399 -        DASSERT(hints != NULL);
 329.400 -        DASSERT(sdata->handle != None);
 329.401 -        if (XGetWMNormalHints(awt_display, sdata->handle, hints, &dummy) == Success) {
 329.402 -            res = createDimension(env, hints->width, hints->height);
 329.403 -        }
 329.404 -        XFree(hints);
 329.405 -    }
 329.406 -    AWT_UNLOCK();
 329.407 -    return res;
 329.408 -}
 329.409 -
 329.410 -/*
 329.411 - * Class:     sun_awt_motif_MEmbedCanvasPeer
 329.412 - * Method:    getEmbedMinimumSize
 329.413 - * Signature: ()Ljava/awt/Dimension;
 329.414 - */
 329.415 -JNIEXPORT jobject JNICALL
 329.416 -Java_sun_awt_motif_MEmbedCanvasPeer_getEmbedMinimumSize (JNIEnv *env, jobject this) {
 329.417 -    pxembed_server_data sdata;
 329.418 -    jobject res = NULL;
 329.419 -    XSizeHints * hints;
 329.420 -    long dummy;
 329.421 -    AWT_LOCK();
 329.422 -    MTRACE("getMinimumSize\n");
 329.423 -    sdata = getDataByEmbedder(this);
 329.424 -    if (sdata != NULL) {
 329.425 -        hints = XAllocSizeHints();
 329.426 -        DASSERT(hints != NULL);
 329.427 -        DASSERT(sdata->handle != None);
 329.428 -        if (XGetWMNormalHints(awt_display, sdata->handle, hints, &dummy) == Success) {
 329.429 -            res = createDimension(env, hints->min_width, hints->min_height);
 329.430 -        }
 329.431 -        XFree(hints);
 329.432 -    }
 329.433 -    AWT_UNLOCK();
 329.434 -    return res;
 329.435 -}
 329.436 -
 329.437 -/*
 329.438 - * Class:     sun_awt_motif_MEmbedCanvasPeer
 329.439 - * Method:    getClientBounds
 329.440 - * Signature: ()Ljava/awt/Rectangle;
 329.441 - */
 329.442 -JNIEXPORT jobject JNICALL
 329.443 -Java_sun_awt_motif_MEmbedCanvasPeer_getClientBounds (JNIEnv *env, jobject this) {
 329.444 -    pxembed_server_data sdata;
 329.445 -    jobject res = NULL;
 329.446 -    AWT_LOCK();
 329.447 -    MTRACE("getClientBounds\n");
 329.448 -    sdata = getDataByEmbedder(this);
 329.449 -    if (sdata != NULL) {
 329.450 -        XWindowAttributes attrs;
 329.451 -        DASSERT(sdata->handle != None);
 329.452 -        if (XGetWindowAttributes(awt_display, sdata->handle, &attrs) == Success) {
 329.453 -            res = createRectangle(env, attrs.x, attrs.y, attrs.width, attrs.height);
 329.454 -        }
 329.455 -    }
 329.456 -    AWT_UNLOCK();
 329.457 -    return res;
 329.458 -}
 329.459 -
 329.460 -Boolean
 329.461 -isApplicationActive(JNIEnv * env, jobject this) {
 329.462 -    return (*env)->GetBooleanField(env, this, applicationActiveFID);
 329.463 -}
 329.464 -
 329.465 -/*
 329.466 - * Class:     sun_awt_motif_MEmbedCanvasPeer
 329.467 - * Method:    notifyChildEmbedded
 329.468 - * Signature: ()V
 329.469 - */
 329.470 -JNIEXPORT void JNICALL
 329.471 -Java_sun_awt_motif_MEmbedCanvasPeer_notifyChildEmbedded (JNIEnv *env, jobject this) {
 329.472 -    struct ComponentData *cdata;
 329.473 -    pxembed_server_data sdata;
 329.474 -    AWT_LOCK();
 329.475 -    MTRACE("notifyChildEmbedded\n");
 329.476 -    cdata = (struct ComponentData *)
 329.477 -        JNU_GetLongFieldAsPtr(env, this, mComponentPeerIDs.pData);
 329.478 -    sdata = getDataByEmbedder(this);
 329.479 -    if (sdata != NULL) {
 329.480 -        DASSERT(sdata->handle != None);
 329.481 -        DASSERT(cdata != NULL);
 329.482 -        DASSERT(XtWindow(cdata->widget) != None);
 329.483 -        sendMessageHelper(sdata->handle, XEMBED_EMBEDDED_NOTIFY, XtWindow(cdata->widget), min(sdata->version, XEMBED_VERSION), 0);
 329.484 -        if (isApplicationActive(env, this)) {
 329.485 -            sendMessage(sdata->handle, XEMBED_WINDOW_ACTIVATE);
 329.486 -        }
 329.487 -    }
 329.488 -    AWT_UNLOCK();
 329.489 -}
 329.490 -
 329.491 -/*
 329.492 - * Class:     sun_awt_motif_MEmbedCanvasPeer
 329.493 - * Method:    detachChild
 329.494 - * Signature: ()V
 329.495 - */
 329.496 -JNIEXPORT void JNICALL
 329.497 -Java_sun_awt_motif_MEmbedCanvasPeer_detachChild (JNIEnv *env, jobject this) {
 329.498 -    pxembed_server_data sdata;
 329.499 -    AWT_LOCK();
 329.500 -    MTRACE("detachChild\n");
 329.501 -    sdata = getDataByEmbedder(this);
 329.502 -    if (sdata != NULL) {
 329.503 -        /**
 329.504 -         *  XEmbed specification:
 329.505 -         *  "The embedder can unmap the client and reparent the client window to the root window. If the
 329.506 -         *  client receives an ReparentNotify event, it should check the parent field of the XReparentEvent
 329.507 -         *  structure. If this is the root window of the window's screen, then the protocol is finished and
 329.508 -         *  there is no further interaction. If it is a window other than the root window, then the protocol
 329.509 -         *  continues with the new parent acting as the embedder window."
 329.510 -         */
 329.511 -        DASSERT(sdata->handle != None);
 329.512 -        XUnmapWindow(awt_display, sdata->handle);
 329.513 -        XReparentWindow(awt_display, sdata->handle, DefaultRootWindow(awt_display), 0, 0);
 329.514 -        Java_sun_awt_motif_MEmbedCanvasPeer_endDispatching(env, this);
 329.515 -        sdata->handle = None;
 329.516 -    }
 329.517 -    AWT_UNLOCK();
 329.518 -}
 329.519 -
 329.520 -/*
 329.521 - * Class:     sun_awt_motif_MEmbedCanvasPeer
 329.522 - * Method:    forwardKeyEvent
 329.523 - * Signature: (Ljava/awt/event/KeyEvent;)V
 329.524 - */
 329.525 -JNIEXPORT void JNICALL
 329.526 -Java_sun_awt_motif_MEmbedCanvasPeer_forwardKeyEvent (JNIEnv *env, jobject this, jobject event) {
 329.527 -    pxembed_server_data sdata;
 329.528 -    jbyteArray array;
 329.529 -    XEvent *xevent;
 329.530 -    AWT_LOCK();
 329.531 -    MTRACE("forwardKeyEvent\n");
 329.532 -    sdata = getDataByEmbedder(this);
 329.533 -    if (sdata != NULL) {
 329.534 -        DASSERT(sdata->handle != None);
 329.535 -        array = (jbyteArray)(*env)->GetObjectField(env, event, awtEventIDs.bdata);
 329.536 -        if (array == NULL) {
 329.537 -            MTRACE("array is null\n");
 329.538 -            AWT_UNLOCK();
 329.539 -            return;
 329.540 -        }
 329.541 -
 329.542 -        xevent = (XEvent *)(*env)->GetByteArrayElements(env, array, NULL);
 329.543 -        if (xevent == NULL) {
 329.544 -            (*env)->DeleteLocalRef(env, array);
 329.545 -            MTRACE("xevent is null\n");
 329.546 -            AWT_UNLOCK();
 329.547 -            return;
 329.548 -        }
 329.549 -        xevent->xany.window = sdata->handle;
 329.550 -        XSendEvent(awt_display, sdata->handle, False, NoEventMask, xevent);
 329.551 -        (*env)->DeleteLocalRef(env, array);
 329.552 -    }
 329.553 -    AWT_UNLOCK();
 329.554 -}
 329.555 -
 329.556 -/*
 329.557 - * Class:     sun_awt_motif_MEmbedCanvasPeer
 329.558 - * Method:    getAWTKeyCodeForKeySym
 329.559 - * Signature: (I)I
 329.560 - */
 329.561 -JNIEXPORT jint JNICALL
 329.562 -Java_sun_awt_motif_MEmbedCanvasPeer_getAWTKeyCodeForKeySym (JNIEnv *env, jobject this, jint keysym) {
 329.563 -    jint keycode = java_awt_event_KeyEvent_VK_UNDEFINED;
 329.564 -    Boolean mapsToUnicodeChar;
 329.565 -    jint keyLocation;
 329.566 -    keysymToAWTKeyCode(keysym, &keycode, &mapsToUnicodeChar, &keyLocation);
 329.567 -    return keycode;
 329.568 -}
 329.569 -
 329.570 -/*
 329.571 - * Class:     sun_awt_motif_MEmbedCanvasPeer
 329.572 - * Method:    sendMessage
 329.573 - * Signature: (I)V
 329.574 - */
 329.575 -JNIEXPORT void JNICALL
 329.576 -Java_sun_awt_motif_MEmbedCanvasPeer_sendMessage__I (JNIEnv *env, jobject this, jint msg) {
 329.577 -    pxembed_server_data sdata;
 329.578 -    AWT_LOCK();
 329.579 -    MTRACEP2("sendMessage %d(%s)\n", msg, msg_to_str(msg));
 329.580 -    sdata = getDataByEmbedder(this);
 329.581 -    if (sdata != NULL) {
 329.582 -        DASSERT(sdata->handle != None);
 329.583 -        sendMessage(sdata->handle, msg);
 329.584 -    }
 329.585 -    AWT_UNLOCK();
 329.586 -}
 329.587 -
 329.588 -/*
 329.589 - * Class:     sun_awt_motif_MEmbedCanvasPeer
 329.590 - * Method:    sendMessage
 329.591 - * Signature: (IJJJ)V
 329.592 - */
 329.593 -JNIEXPORT void JNICALL
 329.594 -Java_sun_awt_motif_MEmbedCanvasPeer_sendMessage__IJJJ (JNIEnv *env, jobject this, jint msg, jlong detail, jlong data1, jlong data2) {
 329.595 -    pxembed_server_data sdata;
 329.596 -    AWT_LOCK();
 329.597 -    MTRACEP5("sendMessage2 msg %d(%s) detail %d data: %d %d\n", msg, msg_to_str(msg), detail, data1, data2);
 329.598 -    sdata = getDataByEmbedder(this);
 329.599 -    if (sdata != NULL) {
 329.600 -        DASSERT(sdata->handle != None);
 329.601 -        sendMessageHelper(sdata->handle, msg, detail, data1, data2);
 329.602 -    }
 329.603 -    AWT_UNLOCK();
 329.604 -}
 329.605 -
 329.606 -static jobject
 329.607 -createRectangle(JNIEnv* env, int x, int y, int width, int height) {
 329.608 -    static jclass clazz;
 329.609 -    static jmethodID mid;
 329.610 -    jobject rect = NULL;
 329.611 -    if (mid == 0) {
 329.612 -        jclass l_clazz = (*env)->FindClass(env, "java/awt/Rectangle");
 329.613 -        DASSERT(l_clazz != NULL);
 329.614 -        mid = (*env)->GetMethodID(env, clazz, "<init>", "(IIII)V");
 329.615 -        DASSERT(mid != NULL);
 329.616 -        clazz = (*env)->NewGlobalRef(env, l_clazz);
 329.617 -        (*env)->DeleteLocalRef(env, l_clazz);
 329.618 -    }
 329.619 -    if (mid != NULL) {
 329.620 -        rect = (*env)->NewObject(env, clazz, mid, x, y, width, height);
 329.621 -        if ((*env)->ExceptionOccurred(env)) {
 329.622 -            return NULL;
 329.623 -        }
 329.624 -    }
 329.625 -    return rect;
 329.626 -}
 329.627 -
 329.628 -static jobject
 329.629 -createDimension(JNIEnv* env, int width, int height) {
 329.630 -    static jclass clazz;
 329.631 -    static jmethodID mid;
 329.632 -    jobject dim = NULL;
 329.633 -    if (mid == 0) {
 329.634 -        jclass l_clazz = (*env)->FindClass(env, "java/awt/Dimension");
 329.635 -        DASSERT(l_clazz != NULL);
 329.636 -        mid = (*env)->GetMethodID(env, clazz, "<init>", "(II)V");
 329.637 -        DASSERT(mid != NULL);
 329.638 -        clazz = (*env)->NewGlobalRef(env, l_clazz);
 329.639 -        (*env)->DeleteLocalRef(env, l_clazz);
 329.640 -    }
 329.641 -    if (mid != NULL) {
 329.642 -        dim = (*env)->NewObject(env, clazz, mid, width, height);
 329.643 -        if ((*env)->ExceptionOccurred(env)) {
 329.644 -            return NULL;
 329.645 -        }
 329.646 -    }
 329.647 -    return dim;
 329.648 -}
 329.649 -
 329.650 -Boolean isMapped(Window w) {
 329.651 -    XWindowAttributes attr;
 329.652 -    Status status = 0;
 329.653 -    WITH_XERROR_HANDLER(xerror_ignore_bad_window);
 329.654 -    status = XGetWindowAttributes(awt_display, w, &attr);
 329.655 -    RESTORE_XERROR_HANDLER;
 329.656 -    if (status == 0 || xerror_code != Success) {
 329.657 -        return False;
 329.658 -    }
 329.659 -    return !(attr.map_state == IsUnmapped);
 329.660 -}
 329.661 -
 329.662 -static void
 329.663 -processXEmbedInfo(JNIEnv * env, jobject this) {
 329.664 -    pxembed_server_data sdata;
 329.665 -    AWT_LOCK();
 329.666 -    MTRACE("processXEmbedInfo\n");
 329.667 -    sdata = getDataByEmbedder(this);
 329.668 -    if (Java_sun_awt_motif_MEmbedCanvasPeer_isXEmbedActive(env, this)) {
 329.669 -        Atom actual_type;
 329.670 -        int actual_format;
 329.671 -        unsigned long nitems;
 329.672 -        unsigned long bytes_after;
 329.673 -        CARD32 * data = NULL;
 329.674 -        DASSERT(sdata->handle != None);
 329.675 -        if (XGetWindowProperty(awt_display, sdata->handle, XA_XEmbedInfo,
 329.676 -                           0, 2, False, XA_XEmbedInfo, &actual_type,
 329.677 -                           &actual_format, &nitems, &bytes_after,
 329.678 -                               (unsigned char**)&data) != Success)
 329.679 -        {
 329.680 -            AWT_UNLOCK();
 329.681 -            return;
 329.682 -        }
 329.683 -        if (actual_type == XA_XEmbedInfo && actual_format == 32
 329.684 -            && nitems == 2)
 329.685 -        {
 329.686 -            CARD32 flags;
 329.687 -            Boolean new_mapped, currently_mapped;
 329.688 -            sdata->version = *data;
 329.689 -            flags = *(data+1);
 329.690 -            new_mapped = (flags & XEMBED_MAPPED) != 0;
 329.691 -            currently_mapped = isMapped(sdata->handle);
 329.692 -            if (new_mapped != currently_mapped) {
 329.693 -                if (new_mapped) {
 329.694 -                    XMapWindow(awt_display, sdata->handle);
 329.695 -                } else {
 329.696 -                    XUnmapWindow(awt_display, sdata->handle);
 329.697 -                }
 329.698 -            }
 329.699 -        }
 329.700 -        if (data != NULL) {
 329.701 -            XFree(data);
 329.702 -        }
 329.703 -    }
 329.704 -    AWT_UNLOCK();
 329.705 -}
 329.706 -
 329.707 -/**
 329.708 - * Handles client message on embedder
 329.709 - */
 329.710 -static void
 329.711 -handleClientMessage(JNIEnv* env, jobject this, XClientMessageEvent * ev) {
 329.712 -    pxembed_server_data sdata;
 329.713 -    AWT_LOCK();
 329.714 -    MTRACEP5("handleClientMessage: 0=%ld 1=%ld 2=%ld 3=%ld 4=%ld\n",
 329.715 -            ev->data.l[0], ev->data.l[1], ev->data.l[2], ev->data.l[3], ev->data.l[4]);
 329.716 -    sdata = getDataByEmbedder(this);
 329.717 -    if (sdata != NULL && sdata->handle != None) {
 329.718 -        switch ((int)ev->data.l[1]) {
 329.719 -          case XEMBED_REQUEST_FOCUS:
 329.720 -              MTRACE("REQUEST_FOCUS\n");
 329.721 -              (*env)->CallVoidMethod(env, this, requestXEmbedFocusMID);
 329.722 -              break;
 329.723 -          case XEMBED_FOCUS_NEXT:
 329.724 -              MTRACE("FOCUS_NEXT\n");
 329.725 -              (*env)->CallVoidMethod(env, this, focusNextMID);
 329.726 -              break;
 329.727 -          case XEMBED_FOCUS_PREV:
 329.728 -              MTRACE("FOCUS_PREV\n");
 329.729 -              (*env)->CallVoidMethod(env, this, focusPrevMID);
 329.730 -              break;
 329.731 -          case XEMBED_REGISTER_ACCELERATOR:
 329.732 -              MTRACE("REGISTER_ACCEL\n");
 329.733 -              (*env)->CallVoidMethod(env, this, registerAcceleratorMID,
 329.734 -                                     (jlong)ev->data.l[2],
 329.735 -                                     (jlong)ev->data.l[3],
 329.736 -                                     (jlong)ev->data.l[4]);
 329.737 -              break;
 329.738 -          case XEMBED_UNREGISTER_ACCELERATOR:
 329.739 -              MTRACE("UNREGISTER_ACCEL\n");
 329.740 -              (*env)->CallVoidMethod(env, this, unregisterAcceleratorMID,
 329.741 -                                     (jlong)ev->data.l[2]);
 329.742 -              break;
 329.743 -          case NON_STANDARD_XEMBED_GTK_GRAB_KEY:
 329.744 -              MTRACE("GRAB_KEY\n");
 329.745 -              (*env)->CallVoidMethod(env, this, grabKeyMID,
 329.746 -                                     (jlong)ev->data.l[3],
 329.747 -                                     (jlong)ev->data.l[4]);
 329.748 -              break;
 329.749 -          case NON_STANDARD_XEMBED_GTK_UNGRAB_KEY:
 329.750 -              MTRACE("UNGRAB_KEY\n");
 329.751 -              (*env)->CallVoidMethod(env, this, ungrabKeyMID,
 329.752 -                                     (jlong)ev->data.l[3],
 329.753 -                                     (jlong)ev->data.l[4]);
 329.754 -          case _SUN_XEMBED_START:
 329.755 -              MTRACE("XEMBED_START\n");
 329.756 -              processXEmbedInfo(env, this);
 329.757 -              Java_sun_awt_motif_MEmbedCanvasPeer_notifyChildEmbedded(env, this);
 329.758 -              break;
 329.759 -        }
 329.760 -    }
 329.761 -    AWT_UNLOCK();
 329.762 -}
 329.763 -
 329.764 -/**
 329.765 - * Handles property changes on xembed client
 329.766 - */
 329.767 -static void
 329.768 -handlePropertyNotify(XPropertyEvent * ev) {
 329.769 -    JNIEnv      *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 329.770 -    pxembed_server_data sdata;
 329.771 -    AWT_LOCK();
 329.772 -    MTRACE("handlePropertyNotify\n");
 329.773 -    sdata = getData(ev->window);
 329.774 -    if (sdata != NULL) {
 329.775 -        if (ev->atom == XA_WM_NORMAL_HINTS) {
 329.776 -            DASSERT(sdata->server != NULL);
 329.777 -            (*env)->CallVoidMethod(env, sdata->server, childResizedMID);
 329.778 -            MTRACE("NORMAL_HINTS have changed\n");
 329.779 -        } else if (ev->atom == XA_XdndAware) {
 329.780 -            unregister_xembed_drop_site(env, awt_display, sdata->server,
 329.781 -                                        sdata->serverHandle, sdata->handle);
 329.782 -            if (ev->state == PropertyNewValue) {
 329.783 -                register_xembed_drop_site(env, awt_display, sdata->server,
 329.784 -                                          sdata->serverHandle, sdata->handle);
 329.785 -            }
 329.786 -        } else if (ev->atom == XA_XEmbedInfo) {
 329.787 -            DASSERT(sdata->server != NULL);
 329.788 -            MTRACE("XEMBED_INFO has changed\n");
 329.789 -            processXEmbedInfo(env, sdata->server);
 329.790 -        }
 329.791 -    }
 329.792 -    AWT_UNLOCK();
 329.793 -}
 329.794 -
 329.795 -static void
 329.796 -handleConfigureNotify(XConfigureEvent * ev) {
 329.797 -    JNIEnv      *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 329.798 -    pxembed_server_data sdata;
 329.799 -    AWT_LOCK();
 329.800 -    MTRACE("handleConfigureNotify\n");
 329.801 -    sdata = getData(ev->window);
 329.802 -    if (sdata != NULL) {
 329.803 -        DASSERT(sdata->server != NULL);
 329.804 -        (*env)->CallVoidMethod(env, sdata->server, childResizedMID);
 329.805 -    }
 329.806 -    AWT_UNLOCK();
 329.807 -}
 329.808 -
 329.809 -/*
 329.810 - * Class:     sun_awt_motif_MEmbedCanvasPeer
 329.811 - * Method:    sendMessage
 329.812 - * Signature: (IJJJ)V
 329.813 - */
 329.814 -JNIEXPORT void JNICALL
 329.815 -Java_sun_awt_motif_GrabbedKey_initKeySymAndModifiers (JNIEnv *env, jobject this, jobject keyevent) {
 329.816 -    jbyteArray array;
 329.817 -    XEvent *xevent;
 329.818 -    int keysym, modifiers;
 329.819 -    int keycode;
 329.820 -    AWT_LOCK();
 329.821 -    array = (jbyteArray)(*env)->GetObjectField(env, keyevent, awtEventIDs.bdata);
 329.822 -    if (array == NULL) {
 329.823 -        AWT_UNLOCK();
 329.824 -        return;
 329.825 -    }
 329.826 -    xevent = (XEvent *)(*env)->GetByteArrayElements(env, array, NULL);
 329.827 -    if (xevent == NULL) {
 329.828 -        (*env)->DeleteLocalRef(env, array);
 329.829 -        AWT_UNLOCK();
 329.830 -        return;
 329.831 -    }
 329.832 -    keycode = (*env)->GetIntField(env, keyevent, keyEventIDs.keyCode);
 329.833 -    keysym = awt_getX11KeySym(keycode);
 329.834 -    modifiers = xevent->xkey.state;
 329.835 -    (*env)->SetLongField(env, this, keysymFID, (jlong)keysym);
 329.836 -    (*env)->SetLongField(env, this, modifiersFID, (jlong)modifiers);
 329.837 -    (*env)->DeleteLocalRef(env, array);
 329.838 -    AWT_UNLOCK();
 329.839 -}
 329.840 -
 329.841 -#ifdef __linux__
 329.842 -void
 329.843 -print_stack (void)
 329.844 -{
 329.845 -  void *array[10];
 329.846 -  size_t size;
 329.847 -  char **strings;
 329.848 -  size_t i;
 329.849 -
 329.850 -  size = backtrace (array, 10);
 329.851 -  strings = backtrace_symbols (array, size);
 329.852 -
 329.853 -  fprintf (stderr, "Obtained %zd stack frames.\n", size);
 329.854 -
 329.855 -  for (i = 0; i < size; i++)
 329.856 -     fprintf (stderr, "%s\n", strings[i]);
 329.857 -
 329.858 -  free (strings);
 329.859 -}
 329.860 -#endif
 329.861 -
 329.862 -extern int32_t  numEventsHandled;
 329.863 -
 329.864 -XCreateWindowEvent cr;
 329.865 -
 329.866 -void
 329.867 -dispatchEmbedderEvent(jobject server, XEvent * ev) {
 329.868 -    JNIEnv      *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 329.869 -    DASSERT(server != NULL);
 329.870 -    DASSERT(ev != NULL);
 329.871 -    AWT_LOCK();
 329.872 -/*     MTRACE("dispatchEmebddedEvent\n"); */
 329.873 -    switch (ev->type) {
 329.874 -      case CreateNotify:
 329.875 -
 329.876 -          MTRACEP3("CreateNotify for %x, serial %d, num events %d\n", (ev->xcreatewindow.window), (ev->xany.serial), (numEventsHandled));
 329.877 -          Java_sun_awt_motif_MEmbedCanvasPeer_embedChild(env, server, ev->xcreatewindow.window);
 329.878 -          break;
 329.879 -      case DestroyNotify:
 329.880 -          MTRACE("DestroyNotify\n");
 329.881 -          Java_sun_awt_motif_MEmbedCanvasPeer_childDestroyed(env, server);
 329.882 -          break;
 329.883 -      case ReparentNotify:
 329.884 -          MTRACEP2("ReparentNotify for %x, parent %x\n", (ev->xreparent.window), (ev->xreparent.parent));
 329.885 -          Java_sun_awt_motif_MEmbedCanvasPeer_embedChild(env, server, ev->xreparent.window);
 329.886 -          break;
 329.887 -      case ClientMessage:
 329.888 -          MTRACE("ClientMessage\n");
 329.889 -          handleClientMessage(env, server, &ev->xclient);
 329.890 -          break;
 329.891 -    }
 329.892 -    AWT_UNLOCK();
 329.893 -}
 329.894 -
 329.895 -void
 329.896 -dispatchEmbeddingClientEvent(XEvent * ev) {
 329.897 -    DASSERT(ev != NULL);
 329.898 -    MTRACE("dispatchEmbeddingClientEvent\n");
 329.899 -    switch (ev->type) {
 329.900 -      case PropertyNotify:
 329.901 -          handlePropertyNotify(&ev->xproperty);
 329.902 -          break;
 329.903 -      case ConfigureNotify:
 329.904 -          handleConfigureNotify(&ev->xconfigure);
 329.905 -          break;
 329.906 -    }
 329.907 -}
 329.908 -
 329.909 -void
 329.910 -xembed_serverEventHandler(XEvent * ev) {
 329.911 -    pxembed_server_data sdata;
 329.912 -    sdata = getData(ev->xany.window);
 329.913 -    if (sdata != NULL) { // Event on client
 329.914 -        dispatchEmbeddingClientEvent(ev);
 329.915 -    } else {
 329.916 -        sdata = getDataByServerHandle(ev->xany.window);
 329.917 -        if (sdata != NULL) {
 329.918 -            DASSERT(sdata->server != NULL);
 329.919 -            dispatchEmbedderEvent(sdata->server, ev);
 329.920 -        }
 329.921 -    }
 329.922 -}
 329.923 -
 329.924 -/**************************** XEmbed server DnD support ***********************/
 329.925 -void
 329.926 -set_xembed_drop_target(JNIEnv* env, jobject server) {
 329.927 -
 329.928 -    (*env)->CallVoidMethod(env, server, setXEmbedDropTargetMID);
 329.929 -}
 329.930 -
 329.931 -void
 329.932 -remove_xembed_drop_target(JNIEnv* env, jobject server) {
 329.933 -    (*env)->CallVoidMethod(env, server, removeXEmbedDropTargetMID);
 329.934 -}
 329.935 -
 329.936 -Boolean
 329.937 -is_xembed_client(Window window) {
 329.938 -    return getData(window) != NULL;
 329.939 -}
 329.940 -/******************************************************************************/
 329.941 -
 329.942 -/*
 329.943 - * Class:     sun_awt_motif_MEmbedCanvasPeer
 329.944 - * Method:    getWindow
 329.945 - * Signature: ()V
 329.946 - */
 329.947 -JNIEXPORT jlong JNICALL
 329.948 -Java_sun_awt_motif_MEmbedCanvasPeer_getWindow(JNIEnv *env, jobject this) {
 329.949 -    struct ComponentData *cdata;
 329.950 -    Window res = None;
 329.951 -    AWT_LOCK();
 329.952 -    cdata = (struct ComponentData *)
 329.953 -        JNU_GetLongFieldAsPtr(env, this, mComponentPeerIDs.pData);
 329.954 -    DASSERT(cdata != NULL);
 329.955 -    res = XtWindow(cdata->widget);
 329.956 -    AWT_UNLOCK();
 329.957 -    return (jlong)res;
 329.958 -}
 329.959 -
 329.960 -JNIEXPORT void JNICALL
 329.961 -Java_sun_awt_motif_MEmbedCanvasPeer_forwardEventToEmbedded(JNIEnv *env,
 329.962 -                                                           jobject this,
 329.963 -                                                           jlong ctxt,
 329.964 -                                                           jint eventID){
 329.965 -    pxembed_server_data sdata;
 329.966 -    AWT_LOCK();
 329.967 -    sdata = getDataByEmbedder(this);
 329.968 -    if (sdata != NULL) {
 329.969 -        forward_event_to_embedded(sdata->handle, ctxt, eventID);
 329.970 -    }
 329.971 -    AWT_UNLOCK();
 329.972 -}
   330.1 --- a/src/solaris/native/sun/awt/awt_xembed_server.h	Tue Dec 06 16:31:58 2011 -0800
   330.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   330.3 @@ -1,36 +0,0 @@
   330.4 -/*
   330.5 - * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
   330.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   330.7 - *
   330.8 - * This code is free software; you can redistribute it and/or modify it
   330.9 - * under the terms of the GNU General Public License version 2 only, as
  330.10 - * published by the Free Software Foundation.  Oracle designates this
  330.11 - * particular file as subject to the "Classpath" exception as provided
  330.12 - * by Oracle in the LICENSE file that accompanied this code.
  330.13 - *
  330.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
  330.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  330.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  330.17 - * version 2 for more details (a copy is included in the LICENSE file that
  330.18 - * accompanied this code).
  330.19 - *
  330.20 - * You should have received a copy of the GNU General Public License version
  330.21 - * 2 along with this work; if not, write to the Free Software Foundation,
  330.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  330.23 - *
  330.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  330.25 - * or visit www.oracle.com if you need additional information or have any
  330.26 - * questions.
  330.27 - */
  330.28 -
  330.29 -#ifndef _AWT_XEMBED_SERVER_H_
  330.30 -#define _AWT_XEMBED_SERVER_H_
  330.31 -
  330.32 -#ifndef HEADLESS
  330.33 -
  330.34 -#include "awt_p.h"
  330.35 -
  330.36 -extern void xembed_serverEventHandler(XEvent *);
  330.37 -
  330.38 -#endif
  330.39 -#endif
   331.1 --- a/src/solaris/native/sun/awt/canvas.h	Tue Dec 06 16:31:58 2011 -0800
   331.2 +++ b/src/solaris/native/sun/awt/canvas.h	Mon Dec 19 10:06:23 2011 -0800
   331.3 @@ -26,44 +26,7 @@
   331.4  #define _CANVAS_H_
   331.5  #ifndef HEADLESS
   331.6  
   331.7 -void awt_canvas_reconfigure(struct FrameData *wdata);
   331.8 -Widget awt_canvas_create(XtPointer this,
   331.9 -                         Widget parent,
  331.10 -                         char *base,
  331.11 -                         int32_t width,
  331.12 -                         int32_t height,
  331.13 -                         Boolean parentIsFrame,
  331.14 -                         struct FrameData *wdata,
  331.15 -                         AwtGraphicsConfigDataPtr awtData);
  331.16 -void awt_canvas_scroll(XtPointer this, struct CanvasData *wdata, long dx, long dy);
  331.17 -void awt_canvas_event_handler(Widget w, XtPointer client_data,
  331.18 -                              XEvent *event, Boolean *cont);
  331.19 -void awt_canvas_handleEvent(Widget w, XtPointer client_data,
  331.20 -                            XEvent *event, struct WidgetInfo *winfo,
  331.21 -                            Boolean *cont, Boolean passEvent);
  331.22 -
  331.23 -void awt_copyXEventToAWTEvent(JNIEnv* env, XEvent * xevent, jobject jevent);
  331.24  KeySym awt_getX11KeySym(jint awtKey);
  331.25 -jobject awt_canvas_getFocusOwnerPeer();
  331.26 -jobject awt_canvas_getFocusedWindowPeer();
  331.27 -void awt_canvas_setFocusOwnerPeer(jobject peer);
  331.28 -void awt_canvas_setFocusedWindowPeer(jobject peer);
  331.29 -jobject awt_canvas_wrapInSequenced(jobject awtevent);
  331.30 -extern void keysymToAWTKeyCode(KeySym x11Key, jint *keycode, Boolean *mapsToUnicodeChar,
  331.31 -                        jint *keyLocation);
  331.32 -#define awt_canvas_addToFocusList awt_canvas_addToFocusListDefault
  331.33 -void awt_canvas_addToFocusListDefault(jobject target);
  331.34 -void awt_canvas_addToFocusListWithDuplicates(jobject target, jboolean acceptDuplicate);
  331.35 -extern void callFocusCallback(jobject focusPeer, int focus_type, jobject cause);
  331.36 -extern void callFocusHandler(Widget w, int eventType, jobject cause);
  331.37 -
  331.38 -typedef struct FocusListElt{
  331.39 -  jweak requestor;
  331.40 -  struct FocusListElt * next;
  331.41 -} FocusListElt;
  331.42 -extern FocusListElt *focusList;
  331.43 -extern FocusListElt *focusListEnd;
  331.44 -extern jweak forGained;
  331.45  
  331.46  #endif /* !HEADLESS */
  331.47  #endif           /* _CANVAS_H_ */
   332.1 --- a/src/solaris/native/sun/awt/multi_font.c	Tue Dec 06 16:31:58 2011 -0800
   332.2 +++ b/src/solaris/native/sun/awt/multi_font.c	Mon Dec 19 10:06:23 2011 -0800
   332.3 @@ -38,24 +38,15 @@
   332.4  #include <jni.h>
   332.5  #include <jni_util.h>
   332.6  #include <jvm.h>
   332.7 -#ifndef XAWT
   332.8 -#include <Xm/Display.h>
   332.9 -#endif
  332.10  #include "awt_Font.h"
  332.11 -#ifndef XAWT
  332.12 -#include "awt_Component.h"
  332.13 -#endif
  332.14 -#include "awt_MenuItem.h"
  332.15  #include "awt_p.h"
  332.16  #include "multi_font.h"
  332.17  
  332.18  extern XFontStruct *loadFont(Display *, char *, int32_t);
  332.19  
  332.20  extern struct FontIDs fontIDs;
  332.21 -//extern struct MComponentPeerIDs mComponentPeerIDs;
  332.22 -//extern struct MMenuItemPeerIDs mMenuItemPeerIDs;
  332.23  extern struct PlatformFontIDs platformFontIDs;
  332.24 -extern struct MFontPeerIDs mFontPeerIDs;
  332.25 +extern struct XFontPeerIDs xFontPeerIDs;
  332.26  
  332.27  /*
  332.28   * make string with str + string representation of num
  332.29 @@ -70,145 +61,7 @@
  332.30      buf[len] = '0' + num % 100;
  332.31      buf[len + 1] = '\0';
  332.32  }
  332.33 -#ifndef XAWT
  332.34 -jobject
  332.35 -awtJNI_CreateAndSetGlobalRef(JNIEnv * env, jobject this)
  332.36 -{
  332.37 -    jobject gRef;
  332.38  
  332.39 -    gRef = (*env)->NewGlobalRef(env, this);
  332.40 -
  332.41 -    JNU_SetLongFieldFromPtr(env, this, mComponentPeerIDs.jniGlobalRef, gRef);
  332.42 -
  332.43 -    return gRef;
  332.44 -}
  332.45 -
  332.46 -struct gRefStruct
  332.47 -{
  332.48 -    jobject gRef;
  332.49 -    struct gRefStruct *next;
  332.50 -};
  332.51 -
  332.52 -static struct gRefStruct *gRefHead = NULL;
  332.53 -static struct gRefStruct *gRefTail = NULL;
  332.54 -
  332.55 -/*
  332.56 - * This function is called by components that
  332.57 - * are being disposed. It used to invalidate
  332.58 - * the global ref immediately, but the awt is
  332.59 - * rather full of thread race conditions involving
  332.60 - * component disposal and outstanding events.
  332.61 - * Now we queue up 'to be deleted' global refs
  332.62 - * as they come in, and don't invalidate them
  332.63 - * until the X event queue is empty. Callers of
  332.64 - * either of these functions _must_ have AWT_LOCK'd
  332.65 - * before using them!
  332.66 - */
  332.67 -void
  332.68 -awtJNI_DeleteGlobalRef(JNIEnv * env, jobject this)
  332.69 -{
  332.70 -    jobject gRef;
  332.71 -    struct gRefStruct *newGRef;
  332.72 -    struct gRefStruct *temp;
  332.73 -
  332.74 -    gRef = (jobject)
  332.75 -        JNU_GetLongFieldAsPtr(env, this, mComponentPeerIDs.jniGlobalRef);
  332.76 -    JNU_SetLongFieldFromPtr(env, this, mComponentPeerIDs.jniGlobalRef, NULL);
  332.77 -
  332.78 -    /*
  332.79 -     * Verra handy for tracking down race conditions. If you
  332.80 -     * have a peer getting called after its been disposed...
  332.81 -     */
  332.82 -    /* jio_fprintf(stderr,"%p\n",(void *)gRef); */
  332.83 -
  332.84 -    newGRef = (struct gRefStruct *)malloc((size_t)sizeof(struct gRefStruct));
  332.85 -
  332.86 -    if(newGRef == NULL)
  332.87 -        (*env)->DeleteGlobalRef(env, gRef);
  332.88 -    else
  332.89 -    {
  332.90 -        newGRef->gRef = gRef;
  332.91 -        newGRef->next = NULL;
  332.92 -
  332.93 -        if(gRefHead == NULL)
  332.94 -        {
  332.95 -            gRefTail = newGRef;
  332.96 -            gRefHead = newGRef;
  332.97 -        }
  332.98 -        else
  332.99 -        {
 332.100 -            gRefTail->next = newGRef;
 332.101 -            gRefTail = newGRef;
 332.102 -        }
 332.103 -    }
 332.104 -}
 332.105 -
 332.106 -void
 332.107 -awtJNI_DeleteGlobalMenuRef(JNIEnv * env, jobject this)
 332.108 -{
 332.109 -    jobject gRef;
 332.110 -    struct gRefStruct *newGRef;
 332.111 -    struct gRefStruct *temp;
 332.112 -
 332.113 -    gRef = (jobject)
 332.114 -    //JNU_GetLongFieldAsPtr(env, this, mMenuItemPeerIDs.jniGlobalRef);
 332.115 -    //JNU_SetLongFieldFromPtr(env, this, mMenuItemPeerIDs.jniGlobalRef, NULL);
 332.116 -
 332.117 -    /*
 332.118 -     * Verra handy for tracking down race conditions. If you
 332.119 -     * have a peer getting called after its been disposed...
 332.120 -     */
 332.121 -    /* jio_fprintf(stderr,"%p\n",(void *)gRef); */
 332.122 -
 332.123 -    newGRef = (struct gRefStruct *)malloc((size_t)sizeof(struct gRefStruct));
 332.124 -
 332.125 -    if(newGRef == NULL)
 332.126 -        (*env)->DeleteGlobalRef(env, gRef);
 332.127 -    else
 332.128 -    {
 332.129 -        newGRef->gRef = gRef;
 332.130 -        newGRef->next = NULL;
 332.131 -
 332.132 -        if(gRefHead == NULL)
 332.133 -        {
 332.134 -            gRefTail = newGRef;
 332.135 -            gRefHead = newGRef;
 332.136 -        }
 332.137 -        else
 332.138 -        {
 332.139 -            gRefTail->next = newGRef;
 332.140 -            gRefTail = newGRef;
 332.141 -        }
 332.142 -    }
 332.143 -}
 332.144 -
 332.145 -void awtJNI_CleanupGlobalRefs()
 332.146 -{
 332.147 -    struct gRefStruct *working,*next;
 332.148 -    JNIEnv *env;
 332.149 -    int32_t count = 0;
 332.150 -
 332.151 -    if(gRefHead == NULL) {
 332.152 -        return;
 332.153 -    }
 332.154 -
 332.155 -    env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 332.156 -
 332.157 -    working = gRefHead;
 332.158 -    gRefHead = gRefTail = NULL;
 332.159 -
 332.160 -    while(working != NULL)
 332.161 -    {
 332.162 -        count++;
 332.163 -        next = working->next;
 332.164 -        (*env)->DeleteGlobalRef(env, working->gRef);
 332.165 -
 332.166 -        free((void *)working);
 332.167 -
 332.168 -        working = next;
 332.169 -    }
 332.170 -}
 332.171 -#endif
 332.172  static int32_t
 332.173  awtJNI_GetFontDescriptorNumber(JNIEnv * env
 332.174                                 ,jobject font
 332.175 @@ -255,25 +108,7 @@
 332.176  
 332.177      return 0;
 332.178  }
 332.179 -#ifndef XAWT
 332.180 -jobject
 332.181 -awtJNI_GetFont(JNIEnv * env, jobject this)
 332.182 -{
 332.183 -    jobject target = NULL;
 332.184 -    jobject font = NULL;
 332.185  
 332.186 -    target = (*env)->GetObjectField(env, this, mComponentPeerIDs.target);
 332.187 -    // SECURITY: Must call _NoClientCode() methods to ensure that we
 332.188 -    //           are not invoking client code on the privileged thread
 332.189 -    font = JNU_CallMethodByName(env,
 332.190 -                                NULL,
 332.191 -                                target,
 332.192 -                                "getFont_NoClientCode",
 332.193 -                                "()Ljava/awt/Font;").l;
 332.194 -    (*env)->DeleteLocalRef(env, target);
 332.195 -    return font;
 332.196 -}
 332.197 -#endif
 332.198  jobject
 332.199  awtJNI_GetFMFont(JNIEnv * env, jobject this)
 332.200  {
 332.201 @@ -347,258 +182,7 @@
 332.202  
 332.203      return JNI_TRUE;
 332.204  }
 332.205 -#ifndef XAWT
 332.206 -#ifdef __linux__
 332.207 -XmString
 332.208 -unicodeXmStringCreate(char* text, char* tag, int len) {
 332.209 -    XmString ret_val;
 332.210 -    XtProcessLock();
 332.211 -    ret_val = _XmStringNCreate (text, tag, len);
 332.212 -    XtProcessUnlock();
 332.213 -    return ret_val;
 332.214 -}
 332.215 -#endif
 332.216  
 332.217 -/*
 332.218 - * Unicode to Motif Multi Font Compound String converter
 332.219 - *
 332.220 - * ASSUMES: We are not running on a privileged thread
 332.221 - */
 332.222 -XmString
 332.223 -awtJNI_MakeMultiFontString(JNIEnv * env, jstring s, jobject font)
 332.224 -{
 332.225 -    XmString xmstr = NULL, xmtmp1, xmtmp2;
 332.226 -    jobjectArray dataArray = NULL;
 332.227 -    char *err = NULL;
 332.228 -    int32_t stringCount,i;
 332.229 -    int32_t fdnumber;
 332.230 -    struct FontData *fdata = awtJNI_GetFontData(env, font, &err);
 332.231 -    jobject fontDescriptor = NULL;
 332.232 -    jbyteArray data = NULL;
 332.233 -    char *stringData = NULL;
 332.234 -    char tag[BUFSIZ];
 332.235 -
 332.236 -    if ((*env)->PushLocalFrame(env, 16) < 0)
 332.237 -        return NULL;
 332.238 -
 332.239 -    if (!JNU_IsNull(env, s) && !JNU_IsNull(env, font)) {
 332.240 -        jobject peer;
 332.241 -
 332.242 -        peer = (*env)->CallObjectMethod(env,font,fontIDs.getPeer);
 332.243 -
 332.244 -        DASSERT(!awt_currentThreadIsPrivileged(env));
 332.245 -        dataArray =
 332.246 -            (*env)->CallObjectMethod(
 332.247 -                             env,
 332.248 -                             peer,
 332.249 -                             platformFontIDs.makeConvertedMultiFontString,
 332.250 -                             s);
 332.251 -
 332.252 -        if ((*env)->ExceptionOccurred(env)) {
 332.253 -            (*env)->ExceptionDescribe(env);
 332.254 -            (*env)->ExceptionClear(env);
 332.255 -
 332.256 -            (*env)->PopLocalFrame(env, NULL);
 332.257 -            return (XmString) NULL;
 332.258 -        }
 332.259 -
 332.260 -        if(dataArray == NULL) {
 332.261 -            (*env)->PopLocalFrame(env, NULL);
 332.262 -            return (XmString) NULL;
 332.263 -        }
 332.264 -    } else {
 332.265 -        (*env)->PopLocalFrame(env, NULL);
 332.266 -        return (XmString) NULL;
 332.267 -    }
 332.268 -
 332.269 -    stringCount = (*env)->GetArrayLength(env, dataArray);
 332.270 -
 332.271 -    for (i = 0; i < stringCount; i+=2) {
 332.272 -        fontDescriptor = (*env)->GetObjectArrayElement(env, dataArray, i);
 332.273 -        data = (*env)->GetObjectArrayElement(env, dataArray, i + 1);
 332.274 -
 332.275 -        /* Bail if we've finished */
 332.276 -        if(fontDescriptor == NULL || data == NULL)
 332.277 -            break;
 332.278 -
 332.279 -        fdnumber = awtJNI_GetFontDescriptorNumber(env, font, fontDescriptor);
 332.280 -        fdata = awtJNI_GetFontData(env, font, &err);
 332.281 -
 332.282 -        makeTag(fdata->flist[fdnumber].charset_name, fdnumber, tag);
 332.283 -
 332.284 -        stringData = (char *)(*env)->GetPrimitiveArrayCritical(env, data, NULL);
 332.285 -        if(stringData != NULL) {
 332.286 -            unsigned char* buf = stringData;
 332.287 -            int len;
 332.288 -            char *offsetStringData;
 332.289 -
 332.290 -            offsetStringData = stringData + (4 * sizeof(char));
 332.291 -#ifdef __linux__
 332.292 -            len = buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3];
 332.293 -            /* Motif XmStringCreate() API requests "text must be a NULL-terminated
 332.294 -               string" and its implementation uses "strlen()" to calculate the length
 332.295 -               of the text string. Unfortunately when we deal with iso10646 font
 332.296 -               on linux, the "text" is requested to be encoded in UTF16, which has the
 332.297 -               posibility of including code points like "0xYY00" ("0xYY" + "0x00") that
 332.298 -               causes problem when XmStringCreate() calls _XmStringNCreate() without
 332.299 -               specifying a specific text lenth (see Motif XmString.c). The workaround is
 332.300 -               to call _XmStringNCreate() directly with specific text length at this
 332.301 -               cirsumstance.
 332.302 -            */
 332.303 -            if (strstr(fdata->flist[fdnumber].charset_name, "UnicodeBigUnmarked"))
 332.304 -                xmtmp1 = unicodeXmStringCreate(offsetStringData, tag, len);
 332.305 -            else
 332.306 -                xmtmp1 = XmStringCreate(offsetStringData, tag);
 332.307 -            if (xmstr == NULL)
 332.308 -                xmstr = xmtmp1;
 332.309 -            else {
 332.310 -                xmtmp2 = XmStringConcat(xmstr, xmtmp1);
 332.311 -                XmStringFree(xmtmp1);
 332.312 -                XmStringFree(xmstr);
 332.313 -                xmstr = xmtmp2;
 332.314 -            }
 332.315 -#else
 332.316 -            if(xmstr == NULL) {
 332.317 -                xmstr = XmStringCreate(offsetStringData, tag);
 332.318 -            }
 332.319 -            else {
 332.320 -                xmtmp1 = XmStringCreate(offsetStringData, tag);
 332.321 -                xmtmp2 = XmStringConcat(xmstr, xmtmp1);
 332.322 -                XmStringFree(xmtmp1);
 332.323 -                XmStringFree(xmstr);
 332.324 -                xmstr = xmtmp2;
 332.325 -            }
 332.326 -#endif
 332.327 -        }
 332.328 -
 332.329 -        (*env)->ReleasePrimitiveArrayCritical(env, data, stringData, JNI_ABORT);
 332.330 -        (*env)->DeleteLocalRef(env, fontDescriptor);
 332.331 -        (*env)->DeleteLocalRef(env, data);
 332.332 -    }
 332.333 -    (*env)->PopLocalFrame(env, NULL);
 332.334 -    return xmstr;
 332.335 -}
 332.336 -
 332.337 -/*
 332.338 - * Find the character encoding for a given font and register that encoding
 332.339 - * with the given tag.  The encoding is the last two fields of the XLFD of
 332.340 - * the font (converted to uppercase).
 332.341 - */
 332.342 -static void registerEncoding(char *xlfd, char *tag)
 332.343 -{
 332.344 -    char *e = xlfd + strlen(xlfd);
 332.345 -    char *ret = NULL;
 332.346 -
 332.347 -    do { --e; } while (e != xlfd && *e != '-');
 332.348 -    do { --e; } while (e != xlfd && *e != '-');
 332.349 -    if (e != xlfd) {
 332.350 -        char *encoding = strdup(++e);
 332.351 -        char *u = NULL;
 332.352 -
 332.353 -        for (u = encoding; *u != '\0'; ++u) {
 332.354 -            if (islower(*u)) {
 332.355 -                *u = toupper(*u);
 332.356 -            }
 332.357 -        }
 332.358 -
 332.359 -        /*
 332.360 -         * Motif will core dump on or otherwise mishandle unknown (or
 332.361 -         * non-standard) character encodings (in conversion to compound
 332.362 -         * text, bug 4122785).  Register Sun private encodings for
 332.363 -         * Symbol or dingbat fonts as ISO8859-1, which is a lie,
 332.364 -         * but produces predictable results.
 332.365 -         */
 332.366 -        if (strncmp(encoding, "SUN-", 4) == 0) {
 332.367 -                free(encoding);
 332.368 -                encoding = strdup("ISO8859-1");
 332.369 -        }
 332.370 -        ret = XmRegisterSegmentEncoding(tag, encoding);
 332.371 -        if (ret != NULL)
 332.372 -                XtFree(ret);
 332.373 -        free(encoding);
 332.374 -    }
 332.375 -}
 332.376 -
 332.377 -
 332.378 -XmFontList
 332.379 -awtJNI_GetFontList(JNIEnv * env, jobject font)
 332.380 -{
 332.381 -    int32_t i;
 332.382 -    XmFontListEntry fle;
 332.383 -    XmFontList fontlist;
 332.384 -    XFontStruct *xf = NULL;
 332.385 -    int32_t size;
 332.386 -    struct FontData *fdata = NULL;
 332.387 -    char *err = NULL, tag[BUFSIZ];
 332.388 -
 332.389 -    fdata = awtJNI_GetFontData(env, font, &err);
 332.390 -
 332.391 -    makeTag(fdata->flist[0].charset_name, 0, tag);
 332.392 -
 332.393 -    size = (int32_t) (*env)->GetIntField(env, font, fontIDs.size);
 332.394 -
 332.395 -    if (fdata->flist[0].load == 0) {
 332.396 -        xf = loadFont(awt_display, fdata->flist[0].xlfd, size * 10);
 332.397 -
 332.398 -        if (xf == NULL) {
 332.399 -            /* printf("Cannot load font: %s\n", fdata->list[0].xlfd); */
 332.400 -        } else {
 332.401 -            fdata->flist[0].xfont = xf;
 332.402 -            fdata->flist[0].load = 1;
 332.403 -
 332.404 -            if (xf->min_byte1 == 0 && xf->max_byte1 == 0)
 332.405 -                fdata->flist[0].index_length = 1;
 332.406 -            else
 332.407 -                fdata->flist[0].index_length = 2;
 332.408 -        }
 332.409 -    }
 332.410 -    registerEncoding(fdata->flist[0].xlfd, tag);
 332.411 -    fle = XmFontListEntryCreate(tag, XmFONT_IS_FONT,
 332.412 -                                (XtPointer) fdata->flist[0].xfont);
 332.413 -
 332.414 -    fontlist = XmFontListAppendEntry(NULL, fle);
 332.415 -    /*
 332.416 -     * Some versions of motif have a bug in
 332.417 -     * XmFontListEntryFree() which causes it to free more than it
 332.418 -     * should.  Use XtFree() is used instead.  See O'Reilly's
 332.419 -     * Motif Reference Manual for more information.
 332.420 -     */
 332.421 -    XmFontListEntryFree(&fle);
 332.422 -
 332.423 -    for (i = 1; i < fdata->charset_num; i++) {
 332.424 -        makeTag(fdata->flist[i].charset_name, i, tag);
 332.425 -
 332.426 -        if (fdata->flist[i].load == 0) {
 332.427 -            xf = loadFont(awt_display, fdata->flist[i].xlfd, size * 10);
 332.428 -
 332.429 -            if (xf == NULL) {
 332.430 -                /* printf("Cannot load font: %s\n", fdata->flist[0].xlfd); */
 332.431 -                continue;
 332.432 -            }
 332.433 -            fdata->flist[i].xfont = xf;
 332.434 -            fdata->flist[i].load = 1;
 332.435 -            if (xf->min_byte1 == 0 && xf->max_byte1 == 0) {
 332.436 -                fdata->flist[i].index_length = 1;
 332.437 -            } else {
 332.438 -                fdata->flist[i].index_length = 2;
 332.439 -            }
 332.440 -        }
 332.441 -        registerEncoding(fdata->flist[i].xlfd, tag);
 332.442 -        fle = XmFontListEntryCreate(tag, XmFONT_IS_FONT,
 332.443 -                                    (XtPointer) fdata->flist[i].xfont);
 332.444 -        fontlist = XmFontListAppendEntry(fontlist, fle);
 332.445 -        /*
 332.446 -         * Some versions of motif have a bug in
 332.447 -         * XmFontListEntryFree() which causes it to free more than it
 332.448 -         * should.  Use XtFree() instead.  See O'Reilly's
 332.449 -         * Motif Reference Manual for more information.
 332.450 -         */
 332.451 -        XmFontListEntryFree(&fle);
 332.452 -    }
 332.453 -
 332.454 -    return fontlist;
 332.455 -}
 332.456 -#endif
 332.457  /* #define FONT_DEBUG 2 */
 332.458  
 332.459  XFontSet
 332.460 @@ -625,7 +209,7 @@
 332.461      size = (*env)->GetIntField(env, font, fontIDs.size) * 10;
 332.462  
 332.463      peer = (*env)->CallObjectMethod(env,font,fontIDs.getPeer);
 332.464 -    xfsname = (*env)->GetObjectField(env, peer, mFontPeerIDs.xfsname);
 332.465 +    xfsname = (*env)->GetObjectField(env, peer, xFontPeerIDs.xfsname);
 332.466  
 332.467      if (JNU_IsNull(env, xfsname))
 332.468          xfontset = "";
 332.469 @@ -703,9 +287,6 @@
 332.470      int32_t length;
 332.471      XFontStruct *xf = NULL;
 332.472      jobjectArray dataArray = NULL;
 332.473 -#ifndef XAWT
 332.474 -    DASSERT(!awt_currentThreadIsPrivileged(env));
 332.475 -#endif
 332.476      if ((*env)->EnsureLocalCapacity(env, 3) < 0)
 332.477          return 0;
 332.478  
   333.1 --- a/src/solaris/native/sun/awt/multi_font.h	Tue Dec 06 16:31:58 2011 -0800
   333.2 +++ b/src/solaris/native/sun/awt/multi_font.h	Mon Dec 19 10:06:23 2011 -0800
   333.3 @@ -29,13 +29,8 @@
   333.4  #define _MULTI_FONT_H_
   333.5  
   333.6  #ifndef HEADLESS
   333.7 -jobject awtJNI_GetFont(JNIEnv *env,jobject this);
   333.8  jboolean awtJNI_IsMultiFont(JNIEnv *env,jobject this);
   333.9  jboolean awtJNI_IsMultiFontMetrics(JNIEnv *env,jobject this);
  333.10 -#ifndef XAWT
  333.11 -XmString awtJNI_MakeMultiFontString(JNIEnv *env,jstring s,jobject font);
  333.12 -XmFontList awtJNI_GetFontList(JNIEnv *env,jobject font);
  333.13 -#endif
  333.14  XFontSet awtJNI_MakeFontSet(JNIEnv *env,jobject font);
  333.15  struct FontData *awtJNI_GetFontData(JNIEnv *env,jobject font, char **errmsg);
  333.16  int32_t awtJNI_GetMFStringWidth(JNIEnv * env, jcharArray s, int32_t offset,
   334.1 --- a/src/solaris/native/sun/java2d/opengl/GLXSurfaceData.c	Tue Dec 06 16:31:58 2011 -0800
   334.2 +++ b/src/solaris/native/sun/java2d/opengl/GLXSurfaceData.c	Mon Dec 19 10:06:23 2011 -0800
   334.3 @@ -45,8 +45,6 @@
   334.4  extern UnlockFunc     OGLSD_Unlock;
   334.5  extern DisposeFunc    OGLSD_Dispose;
   334.6  
   334.7 -extern struct MComponentPeerIDs mComponentPeerIDs;
   334.8 -
   334.9  extern void
  334.10      OGLSD_SetNativeDimensions(JNIEnv *env, OGLSDOps *oglsdo, jint w, jint h);
  334.11  
  334.12 @@ -86,34 +84,12 @@
  334.13      oglsdo->activeBuffer = GL_FRONT;
  334.14      oglsdo->needsInit = JNI_TRUE;
  334.15  
  334.16 -#ifdef XAWT
  334.17      if (peer != NULL) {
  334.18          glxsdo->window = JNU_CallMethodByName(env, NULL, peer,
  334.19                                                "getContentWindow", "()J").j;
  334.20      } else {
  334.21          glxsdo->window = 0;
  334.22      }
  334.23 -#else
  334.24 -    if (peer != NULL) {
  334.25 -        struct ComponentData *cdata;
  334.26 -        cdata = (struct ComponentData *)
  334.27 -            JNU_GetLongFieldAsPtr(env, peer, mComponentPeerIDs.pData);
  334.28 -        if (cdata == NULL) {
  334.29 -            free(glxsdo);
  334.30 -            JNU_ThrowNullPointerException(env, "Component data missing");
  334.31 -            return;
  334.32 -        }
  334.33 -        if (cdata->widget == NULL) {
  334.34 -            free(glxsdo);
  334.35 -            JNU_ThrowInternalError(env, "Widget is NULL in initOps");
  334.36 -            return;
  334.37 -        }
  334.38 -        glxsdo->widget = cdata->widget;
  334.39 -    } else {
  334.40 -        glxsdo->widget = NULL;
  334.41 -    }
  334.42 -#endif
  334.43 -
  334.44      glxsdo->configData = (AwtGraphicsConfigDataPtr)jlong_to_ptr(aData);
  334.45      if (glxsdo->configData == NULL) {
  334.46          free(glxsdo);
  334.47 @@ -331,11 +307,7 @@
  334.48  {
  334.49      GLXSDOps *glxsdo;
  334.50      Window window;
  334.51 -#ifdef XAWT
  334.52      XWindowAttributes attr;
  334.53 -#else
  334.54 -    Widget widget;
  334.55 -#endif
  334.56  
  334.57      J2dTraceLn(J2D_TRACE_INFO, "OGLSD_InitOGLWindow");
  334.58  
  334.59 @@ -352,7 +324,6 @@
  334.60          return JNI_FALSE;
  334.61      }
  334.62  
  334.63 -#ifdef XAWT
  334.64      window = glxsdo->window;
  334.65      if (window == 0) {
  334.66          J2dRlsTraceLn(J2D_TRACE_ERROR,
  334.67 @@ -363,22 +334,6 @@
  334.68      XGetWindowAttributes(awt_display, window, &attr);
  334.69      oglsdo->width = attr.width;
  334.70      oglsdo->height = attr.height;
  334.71 -#else
  334.72 -    widget = glxsdo->widget;
  334.73 -    if (widget == NULL) {
  334.74 -        J2dTraceLn(J2D_TRACE_WARNING, "OGLSD_InitOGLWindow: widget is null");
  334.75 -    }
  334.76 -
  334.77 -    if (!XtIsRealized(widget)) {
  334.78 -        J2dRlsTraceLn(J2D_TRACE_ERROR,
  334.79 -                      "OGLSD_InitOGLWindow: widget is unrealized");
  334.80 -        return JNI_FALSE;
  334.81 -    }
  334.82 -
  334.83 -    window = XtWindow(widget);
  334.84 -    oglsdo->width = widget->core.width;
  334.85 -    oglsdo->height = widget->core.height;
  334.86 -#endif
  334.87  
  334.88      oglsdo->drawableType = OGLSD_WINDOW;
  334.89      oglsdo->isOpaque = JNI_TRUE;
   335.1 --- a/src/solaris/native/sun/java2d/opengl/GLXSurfaceData.h	Tue Dec 06 16:31:58 2011 -0800
   335.2 +++ b/src/solaris/native/sun/java2d/opengl/GLXSurfaceData.h	Mon Dec 19 10:06:23 2011 -0800
   335.3 @@ -38,16 +38,11 @@
   335.4   * The GLXSDOps structure contains the GLX-specific information for a given
   335.5   * OGLSurfaceData.  It is referenced by the native OGLSDOps structure.
   335.6   *
   335.7 - *     Window window; (used in XAWT only)
   335.8 + *     Window window;
   335.9   * For onscreen windows, we maintain a reference to that window's associated
  335.10   * XWindow handle here.  Offscreen surfaces have no associated Window, so for
  335.11   * those surfaces, this value will simply be zero.
  335.12   *
  335.13 - *     Widget widget; (used in MAWT only)
  335.14 - * For onscreen windows, we maintain a reference to that window's associated
  335.15 - * Widget handle here.  Offscreen surfaces have no associated Widget, so for
  335.16 - * those surfaces, this value will simply be zero.
  335.17 - *
  335.18   *     Drawable xdrawable;
  335.19   * If a GLXDrawable has a corresponding X11 Drawable, it is stored here.  For
  335.20   * example, each GLXWindow has an associated Window and each GLXPixmap has an
  335.21 @@ -63,11 +58,7 @@
  335.22   * created.
  335.23   */
  335.24  typedef struct _GLXSDOps {
  335.25 -#ifdef XAWT
  335.26      Window      window;
  335.27 -#else
  335.28 -    Widget      widget;
  335.29 -#endif
  335.30      Drawable    xdrawable;
  335.31      GLXDrawable drawable;
  335.32      struct _AwtGraphicsConfigData *configData;
   336.1 --- a/src/solaris/native/sun/java2d/x11/X11SurfaceData.c	Tue Dec 06 16:31:58 2011 -0800
   336.2 +++ b/src/solaris/native/sun/java2d/x11/X11SurfaceData.c	Mon Dec 19 10:06:23 2011 -0800
   336.3 @@ -64,9 +64,6 @@
   336.4  static DisposeFunc X11SD_Dispose;
   336.5  static GetPixmapBgFunc X11SD_GetPixmapWithBg;
   336.6  static ReleasePixmapBgFunc X11SD_ReleasePixmapWithBg;
   336.7 -#ifndef XAWT
   336.8 -extern struct MComponentPeerIDs mComponentPeerIDs;
   336.9 -#endif
  336.10  extern int J2DXErrHandler(Display *display, XErrorEvent *xerr);
  336.11  extern AwtGraphicsConfigDataPtr
  336.12      getGraphicsConfigFromComponentPeer(JNIEnv *env, jobject this);
  336.13 @@ -263,31 +260,12 @@
  336.14      xsdo->sdOps.Dispose = X11SD_Dispose;
  336.15      xsdo->GetPixmapWithBg = X11SD_GetPixmapWithBg;
  336.16      xsdo->ReleasePixmapWithBg = X11SD_ReleasePixmapWithBg;
  336.17 -#ifndef XAWT
  336.18 -    if (peer != NULL) {
  336.19 -        struct ComponentData *cdata;
  336.20 -        cdata = (struct ComponentData *)
  336.21 -            JNU_GetLongFieldAsPtr(env, peer, mComponentPeerIDs.pData);
  336.22 -        if (cdata == NULL) {
  336.23 -            JNU_ThrowNullPointerException(env, "Component data missing");
  336.24 -            return;
  336.25 -        }
  336.26 -        if (cdata->widget == NULL) {
  336.27 -            JNU_ThrowInternalError(env, "Widget is NULL in initOps");
  336.28 -            return;
  336.29 -        }
  336.30 -        xsdo->widget = cdata->widget;
  336.31 -    } else {
  336.32 -        xsdo->widget = NULL;
  336.33 -    }
  336.34 -#else
  336.35      xsdo->widget = NULL;
  336.36      if (peer != NULL) {
  336.37          xsdo->drawable = JNU_CallMethodByName(env, NULL, peer, "getWindow", "()J").j;
  336.38      } else {
  336.39          xsdo->drawable = 0;
  336.40      }
  336.41 -#endif
  336.42      xsdo->depth = depth;
  336.43      xsdo->dgaAvailable = dgaAvailable;
  336.44      xsdo->isPixmap = JNI_FALSE;
  336.45 @@ -775,14 +753,6 @@
  336.46      if (xsdo->isPixmap == JNI_TRUE) {
  336.47          return SD_FAILURE;
  336.48      }
  336.49 -#ifndef XAWT
  336.50 -    if (!XtIsRealized(xsdo->widget)) {
  336.51 -        J2dTraceLn(J2D_TRACE_WARNING, "X11SD_InitWindow: widget is unrealized");
  336.52 -        /* AWT_UNLOCK(); unlock it in caller */
  336.53 -        return SD_FAILURE;
  336.54 -    }
  336.55 -    xsdo->drawable = XtWindow(xsdo->widget);
  336.56 -#endif
  336.57      xsdo->cData = xsdo->configData->color_data;
  336.58  
  336.59      return SD_SUCCESS;
  336.60 @@ -804,9 +774,7 @@
  336.61          SurfaceData_ThrowInvalidPipeException(env, "bounds changed");
  336.62          return SD_FAILURE;
  336.63      }
  336.64 -#ifdef XAWT
  336.65      xsdo->cData = xsdo->configData->color_data;
  336.66 -#endif
  336.67      if (xsdo->drawable == 0 && X11SD_InitWindow(env, xsdo) == SD_FAILURE) {
  336.68          AWT_UNLOCK();
  336.69          return SD_FAILURE;
  336.70 @@ -1081,30 +1049,6 @@
  336.71      int tmpx, tmpy;
  336.72      Window tmpchild;
  336.73  
  336.74 -#ifndef XAWT
  336.75 -    Widget w = xsdo->widget;
  336.76 -
  336.77 -    x1 = y1 = 0;
  336.78 -    for (; w != NULL && ! XtIsShell(w); w = w->core.parent) {
  336.79 -        x1 += w->core.x + w->core.border_width;
  336.80 -        y1 += w->core.y + w->core.border_width;
  336.81 -    }
  336.82 -    if (w == NULL) {
  336.83 -        return FALSE;
  336.84 -    }
  336.85 -
  336.86 -    /*
  336.87 -     * REMIND: We should not be offsetting here by border_width
  336.88 -     * but for some unknown reason if we do not do that the
  336.89 -     * results will be off exactly by border_width. We were unable
  336.90 -     * to find cause of this.
  336.91 -     */
  336.92 -    (void) XTranslateCoordinates(XtDisplay(w), XtWindow(w),
  336.93 -                                 RootWindowOfScreen(XtScreen(w)),
  336.94 -                                 (int) w->core.border_width,
  336.95 -                                 (int) w->core.border_width,
  336.96 -                                 &tmpx, &tmpy, &tmpchild);
  336.97 -#else
  336.98      Window window = (Window)(xsdo->drawable); /* is always a Window */
  336.99      XWindowAttributes winAttr;
 336.100  
 336.101 @@ -1118,7 +1062,6 @@
 336.102                                 0, 0, &tmpx, &tmpy, &tmpchild)) {
 336.103          return FALSE;
 336.104      }
 336.105 -#endif
 336.106  
 336.107      x1 = -(x1 + tmpx);
 336.108      y1 = -(y1 + tmpy);
 336.109 @@ -1150,89 +1093,6 @@
 336.110  static int
 336.111  X11SD_FindClip(SurfaceDataBounds *b, SurfaceDataBounds *bounds, X11SDOps *xsdo)
 336.112  {
 336.113 -#ifndef XAWT
 336.114 -    int x1, y1, x2, y2, px1, py1, px2, py2, child_x, child_y;
 336.115 -    Widget current_widget, child_widget;
 336.116 -
 336.117 -    XWindowAttributes attr;
 336.118 -    Window ignore_root, current_window, *ignore_children;
 336.119 -    unsigned int pborder, ignore_uint;
 336.120 -
 336.121 -    x1 = bounds->x1;
 336.122 -    y1 = bounds->y1;
 336.123 -    x2 = bounds->x2;
 336.124 -    y2 = bounds->y2;
 336.125 -
 336.126 -    px1 = py1 = 0;
 336.127 -
 336.128 -    child_widget = xsdo->widget;
 336.129 -    current_widget = XtParent(xsdo->widget);
 336.130 -    while (current_widget != NULL && !XtIsShell(current_widget)) {
 336.131 -        px1 = px1 - (child_widget->core.x + child_widget->core.border_width);
 336.132 -        py1 = py1 - (child_widget->core.y + child_widget->core.border_width);
 336.133 -        px2 = px1 + current_widget->core.width;
 336.134 -        py2 = py1 + current_widget->core.height;
 336.135 -        x1 = MAX(x1, px1);
 336.136 -        y1 = MAX(y1, py1);
 336.137 -        x2 = MIN(x2, px2);
 336.138 -        y2 = MIN(y2, py2);
 336.139 -        if ((x1 >= x2) || (y1 >= y2)) {
 336.140 -            return FALSE;
 336.141 -        }
 336.142 -
 336.143 -        child_widget = current_widget;
 336.144 -        current_widget = current_widget->core.parent;
 336.145 -    }
 336.146 -
 336.147 -    if (current_widget == NULL) {
 336.148 -        XQueryTree(awt_display,
 336.149 -                   XtWindow(child_widget),
 336.150 -                   &ignore_root,
 336.151 -                   &current_window,
 336.152 -                   &ignore_children,
 336.153 -                   &ignore_uint);
 336.154 -        XFree(ignore_children);
 336.155 -    } else {
 336.156 -        current_window = XtWindow(current_widget);
 336.157 -    }
 336.158 -
 336.159 -    child_x = child_widget->core.x + child_widget->core.border_width;
 336.160 -    child_y = child_widget->core.y + child_widget->core.border_width;
 336.161 -    while (current_window != 0) {
 336.162 -        px1 = px1 - child_x;
 336.163 -        py1 = py1 - child_y;
 336.164 -        if (!XGetGeometry(awt_display, current_window, &ignore_root,
 336.165 -                          &child_x, &child_y,
 336.166 -                          (unsigned int *)&px2, (unsigned int *)&py2,
 336.167 -                          &pborder, &ignore_uint)) {
 336.168 -            return FALSE;
 336.169 -        }
 336.170 -        child_x += pborder;
 336.171 -        child_y += pborder;
 336.172 -        px2 += px1;
 336.173 -        py2 += py1;
 336.174 -
 336.175 -        x1 = MAX(x1, px1);
 336.176 -        y1 = MAX(y1, py1);
 336.177 -        x2 = MIN(x2, px2);
 336.178 -        y2 = MIN(y2, py2);
 336.179 -        if ((x1 >= x2) || (y1 >= y2)) {
 336.180 -            return FALSE;
 336.181 -        }
 336.182 -        XQueryTree(awt_display,
 336.183 -                   current_window,
 336.184 -                   &ignore_root,
 336.185 -                   &current_window,
 336.186 -                   &ignore_children,
 336.187 -                   &ignore_uint);
 336.188 -        XFree(ignore_children);
 336.189 -    }
 336.190 -
 336.191 -    b->x1 = x1;
 336.192 -    b->y1 = y1;
 336.193 -    b->x2 = x2;
 336.194 -    b->y2 = y2;
 336.195 -#endif
 336.196      return TRUE;
 336.197  }
 336.198  
   337.1 --- a/src/solaris/native/sun/java2d/x11/X11SurfaceData.h	Tue Dec 06 16:31:58 2011 -0800
   337.2 +++ b/src/solaris/native/sun/java2d/x11/X11SurfaceData.h	Mon Dec 19 10:06:23 2011 -0800
   337.3 @@ -30,6 +30,10 @@
   337.4  
   337.5  #include <jdga.h>
   337.6  
   337.7 +#ifdef HEADLESS
   337.8 +#include "GLXGraphicsConfig.h"
   337.9 +#endif
  337.10 +
  337.11  #include <X11/extensions/Xrender.h>
  337.12  
  337.13  /**
   338.1 --- a/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c	Tue Dec 06 16:31:58 2011 -0800
   338.2 +++ b/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c	Mon Dec 19 10:06:23 2011 -0800
   338.3 @@ -996,7 +996,7 @@
   338.4  
   338.5          if (res != 0 || p == NULL || p->pw_name == NULL || *(p->pw_name) == '\0') {
   338.6              /* not found or error */
   338.7 -            if (errno != 0 && errno != ENOENT)
   338.8 +            if (errno != 0 && errno != ENOENT && errno != ESRCH)
   338.9                  throwUnixException(env, errno);
  338.10          } else {
  338.11              uid = p->pw_uid;
  338.12 @@ -1042,7 +1042,7 @@
  338.13          retry = 0;
  338.14          if (res != 0 || g == NULL || g->gr_name == NULL || *(g->gr_name) == '\0') {
  338.15              /* not found or error */
  338.16 -            if (errno != 0 && errno != ENOENT) {
  338.17 +            if (errno != 0 && errno != ENOENT && errno != ESRCH) {
  338.18                  if (errno == ERANGE) {
  338.19                      /* insufficient buffer size so need larger buffer */
  338.20                      buflen += ENT_BUF_SIZE;
   339.1 --- a/src/solaris/native/sun/xawt/XToolkit.c	Tue Dec 06 16:31:58 2011 -0800
   339.2 +++ b/src/solaris/native/sun/xawt/XToolkit.c	Mon Dec 19 10:06:23 2011 -0800
   339.3 @@ -39,7 +39,6 @@
   339.4  #include "awt_p.h"
   339.5  #include "awt_Component.h"
   339.6  #include "awt_MenuComponent.h"
   339.7 -#include "awt_KeyboardFocusManager.h"
   339.8  #include "awt_Font.h"
   339.9  
  339.10  #include "sun_awt_X11_XToolkit.h"
  339.11 @@ -47,6 +46,8 @@
  339.12  #include "java_awt_TrayIcon.h"
  339.13  #include <X11/extensions/XTest.h>
  339.14  
  339.15 +#include <unistd.h>
  339.16 +
  339.17  uint32_t awt_NumLockMask = 0;
  339.18  Boolean  awt_ModLockIsShiftLock = False;
  339.19  
  339.20 @@ -72,19 +73,17 @@
  339.21  
  339.22  struct MenuComponentIDs menuComponentIDs;
  339.23  
  339.24 -struct KeyboardFocusManagerIDs keyboardFocusManagerIDs;
  339.25 -
  339.26  #ifndef HEADLESS
  339.27  
  339.28  extern Display* awt_init_Display(JNIEnv *env, jobject this);
  339.29  
  339.30 -extern struct MFontPeerIDs mFontPeerIDs;
  339.31 +struct XFontPeerIDs xFontPeerIDs;
  339.32  
  339.33  JNIEXPORT void JNICALL
  339.34  Java_sun_awt_X11_XFontPeer_initIDs
  339.35    (JNIEnv *env, jclass cls)
  339.36  {
  339.37 -    mFontPeerIDs.xfsname =
  339.38 +    xFontPeerIDs.xfsname =
  339.39        (*env)->GetFieldID(env, cls, "xfsname", "Ljava/lang/String;");
  339.40  }
  339.41  #endif /* !HEADLESS */
  339.42 @@ -1087,3 +1086,38 @@
  339.43  
  339.44      return local_num_buttons;
  339.45  }
  339.46 +
  339.47 +/*
  339.48 + * Class:     sun_awt_X11_XWindowPeer
  339.49 + * Method:    getJvmPID
  339.50 + * Signature: ()I
  339.51 + */
  339.52 +JNIEXPORT jint JNICALL Java_sun_awt_X11_XWindowPeer_getJvmPID
  339.53 +(JNIEnv *env, jclass cls)
  339.54 +{
  339.55 +    /* Return the JVM's PID. */
  339.56 +    return getpid();
  339.57 +}
  339.58 +
  339.59 +#ifndef HOST_NAME_MAX
  339.60 +#define HOST_NAME_MAX 1024 /* Overestimated */
  339.61 +#endif
  339.62 +
  339.63 +/*
  339.64 + * Class:     sun_awt_X11_XWindowPeer
  339.65 + * Method:    getLocalHostname
  339.66 + * Signature: ()Ljava/lang/String;
  339.67 + */
  339.68 +JNIEXPORT jstring JNICALL Java_sun_awt_X11_XWindowPeer_getLocalHostname
  339.69 +(JNIEnv *env, jclass cls)
  339.70 +{
  339.71 +    /* Return the machine's FQDN. */
  339.72 +    char hostname[HOST_NAME_MAX + 1];
  339.73 +    if (gethostname(hostname, HOST_NAME_MAX + 1) == 0) {
  339.74 +        hostname[HOST_NAME_MAX] = '\0';
  339.75 +        jstring res = (*env)->NewStringUTF(env, hostname);
  339.76 +        return res;
  339.77 +    }
  339.78 +
  339.79 +    return (jstring)NULL;
  339.80 +}
   340.1 --- a/src/windows/native/java/io/io_util_md.c	Tue Dec 06 16:31:58 2011 -0800
   340.2 +++ b/src/windows/native/java/io/io_util_md.c	Mon Dec 19 10:06:23 2011 -0800
   340.3 @@ -478,7 +478,7 @@
   340.4  }
   340.5  
   340.6  JNIEXPORT
   340.7 -size_t
   340.8 +jint
   340.9  handleRead(jlong fd, void *buf, jint len)
  340.10  {
  340.11      DWORD read = 0;
  340.12 @@ -499,10 +499,10 @@
  340.13          }
  340.14          return -1;
  340.15      }
  340.16 -    return read;
  340.17 +    return (jint)read;
  340.18  }
  340.19  
  340.20 -static size_t writeInternal(jlong fd, const void *buf, jint len, jboolean append)
  340.21 +static jint writeInternal(jlong fd, const void *buf, jint len, jboolean append)
  340.22  {
  340.23      BOOL result = 0;
  340.24      DWORD written = 0;
  340.25 @@ -527,16 +527,16 @@
  340.26      if ((h == INVALID_HANDLE_VALUE) || (result == 0)) {
  340.27          return -1;
  340.28      }
  340.29 -    return (size_t)written;
  340.30 +    return (jint)written;
  340.31  }
  340.32  
  340.33  JNIEXPORT
  340.34 -size_t handleWrite(jlong fd, const void *buf, jint len) {
  340.35 +jint handleWrite(jlong fd, const void *buf, jint len) {
  340.36      return writeInternal(fd, buf, len, JNI_FALSE);
  340.37  }
  340.38  
  340.39  JNIEXPORT
  340.40 -size_t handleAppend(jlong fd, const void *buf, jint len) {
  340.41 +jint handleAppend(jlong fd, const void *buf, jint len) {
  340.42      return writeInternal(fd, buf, len, JNI_TRUE);
  340.43  }
  340.44  
   341.1 --- a/src/windows/native/java/io/io_util_md.h	Tue Dec 06 16:31:58 2011 -0800
   341.2 +++ b/src/windows/native/java/io/io_util_md.h	Mon Dec 19 10:06:23 2011 -0800
   341.3 @@ -39,9 +39,9 @@
   341.4  int handleAvailable(jlong fd, jlong *pbytes);
   341.5  JNIEXPORT int handleSync(jlong fd);
   341.6  int handleSetLength(jlong fd, jlong length);
   341.7 -JNIEXPORT size_t handleRead(jlong fd, void *buf, jint len);
   341.8 -JNIEXPORT size_t handleWrite(jlong fd, const void *buf, jint len);
   341.9 -JNIEXPORT size_t handleAppend(jlong fd, const void *buf, jint len);
  341.10 +JNIEXPORT jint handleRead(jlong fd, void *buf, jint len);
  341.11 +JNIEXPORT jint handleWrite(jlong fd, const void *buf, jint len);
  341.12 +JNIEXPORT jint handleAppend(jlong fd, const void *buf, jint len);
  341.13  jint handleClose(JNIEnv *env, jobject this, jfieldID fid);
  341.14  jlong handleLseek(jlong fd, jlong offset, jint whence);
  341.15  
   342.1 --- a/test/ProblemList.txt	Tue Dec 06 16:31:58 2011 -0800
   342.2 +++ b/test/ProblemList.txt	Mon Dec 19 10:06:23 2011 -0800
   342.3 @@ -400,8 +400,8 @@
   342.4  # 6963118
   342.5  java/nio/channels/Selector/Wakeup.java                          windows-all
   342.6  
   342.7 -# 7076700
   342.8 -java/nio/channels/SocketChannel/AdaptSocket.java                generic-all
   342.9 +# 7052549
  342.10 +java/nio/channels/FileChannel/ReleaseOnCloseDeadlock.java 	windows-all
  342.11  
  342.12  ############################################################################
  342.13  
   343.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   343.2 +++ b/test/java/awt/print/PaintSetEnabledDeadlock/PaintSetEnabledDeadlock.java	Mon Dec 19 10:06:23 2011 -0800
   343.3 @@ -0,0 +1,175 @@
   343.4 +/*
   343.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   343.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   343.7 + *
   343.8 + * This code is free software; you can redistribute it and/or modify it
   343.9 + * under the terms of the GNU General Public License version 2 only, as
  343.10 + * published by the Free Software Foundation.
  343.11 + *
  343.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  343.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  343.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  343.15 + * version 2 for more details (a copy is included in the LICENSE file that
  343.16 + * accompanied this code).
  343.17 + *
  343.18 + * You should have received a copy of the GNU General Public License version
  343.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  343.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  343.21 + *
  343.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  343.23 + * or visit www.oracle.com if you need additional information or have any
  343.24 + * questions.
  343.25 + */
  343.26 +
  343.27 +/*
  343.28 + * @test
  343.29 + * @bug 7108598
  343.30 + * @summary Container.paint/KeyboardFocusManager.clearMostRecentFocusOwner methods deadlock
  343.31 + * @library ../../regtesthelpers
  343.32 + * @author Oleg Pekhovskiy
  343.33 + * @build Util
  343.34 + * @run main/timeout=20 PaintSetEnabledDeadlock
  343.35 + */
  343.36 +
  343.37 +import java.awt.*;
  343.38 +import java.awt.event.*;
  343.39 +import test.java.awt.regtesthelpers.Util;
  343.40 +
  343.41 +public class PaintSetEnabledDeadlock extends Frame {
  343.42 +
  343.43 +    final TestPanel panel;
  343.44 +    final Button button;
  343.45 +
  343.46 +    public static void main(String[] args) {
  343.47 +        PaintSetEnabledDeadlock frame = new PaintSetEnabledDeadlock();
  343.48 +        frame.setSize(200, 200);
  343.49 +        frame.setVisible(true);
  343.50 +
  343.51 +        Robot robot = Util.createRobot();
  343.52 +        robot.setAutoDelay(100);
  343.53 +        robot.setAutoWaitForIdle(true);
  343.54 +
  343.55 +        for (int i = 0; i < 20; ++i) {
  343.56 +            Util.clickOnComp(frame.panel, robot);
  343.57 +            Util.clickOnComp(frame.button, robot);
  343.58 +        }
  343.59 +
  343.60 +        frame.panel.stop();
  343.61 +        frame.dispose();
  343.62 +
  343.63 +        System.out.println("Test passed.");
  343.64 +    }
  343.65 +
  343.66 +    public PaintSetEnabledDeadlock() {
  343.67 +        super("7108598 test");
  343.68 +        setLayout(new GridLayout(1, 2));
  343.69 +        addWindowListener(new WindowAdapter() {
  343.70 +
  343.71 +            @Override
  343.72 +            public void windowClosing(WindowEvent e) {
  343.73 +                panel.stop();
  343.74 +                System.exit(0);
  343.75 +            }
  343.76 +        });
  343.77 +        panel = new TestPanel();
  343.78 +        add(panel);
  343.79 +        button = new Button("Enable");
  343.80 +        button.addMouseListener(new MouseAdapter() {
  343.81 +
  343.82 +            @Override
  343.83 +            public void mousePressed(MouseEvent e) {
  343.84 +                panel.setEnabled(true);
  343.85 +                panel.sync();
  343.86 +                panel.repaint();
  343.87 +            }
  343.88 +        });
  343.89 +        add(button);
  343.90 +    }
  343.91 +}
  343.92 +
  343.93 +class TestPanel extends Panel implements Runnable {
  343.94 +
  343.95 +    Image image = null;
  343.96 +    Thread thread = null;
  343.97 +    volatile boolean active = true;
  343.98 +    final Object sync = new Object();
  343.99 +    Panel panel = this;
 343.100 +
 343.101 +    public TestPanel() {
 343.102 +        addMouseListener(new MouseAdapter() {
 343.103 +
 343.104 +            @Override
 343.105 +            public void mouseReleased(MouseEvent e) {
 343.106 +                synchronized (panel) {
 343.107 +                    sync();
 343.108 +                    panel.setEnabled(false);
 343.109 +                }
 343.110 +                panel.repaint();
 343.111 +            }
 343.112 +        });
 343.113 +        thread = new Thread(this);
 343.114 +        thread.start();
 343.115 +    }
 343.116 +
 343.117 +    @Override
 343.118 +    public void paint(Graphics paramGraphics) {
 343.119 +        synchronized (getTreeLock()) {
 343.120 +            Rectangle rect = getBounds();
 343.121 +            if (image == null) {
 343.122 +                image = createImage(rect.width, rect.height);
 343.123 +            }
 343.124 +
 343.125 +            if (image != null) {
 343.126 +                paramGraphics.drawImage(image, 0, 0, this);
 343.127 +            }
 343.128 +        }
 343.129 +    }
 343.130 +
 343.131 +    @Override
 343.132 +    public void run() {
 343.133 +        while (active) {
 343.134 +            try {
 343.135 +                synchronized (sync) {
 343.136 +                    sync.wait();
 343.137 +                }
 343.138 +            } catch (InterruptedException ex) {
 343.139 +            }
 343.140 +            if (active) {
 343.141 +                draw();
 343.142 +            }
 343.143 +        }
 343.144 +    }
 343.145 +
 343.146 +    public void stop() {
 343.147 +        active = false;
 343.148 +        try {
 343.149 +            synchronized (sync) {
 343.150 +                sync.notify();
 343.151 +            }
 343.152 +            synchronized (thread) {
 343.153 +                thread.wait();
 343.154 +            }
 343.155 +        } catch (InterruptedException ex) {
 343.156 +        }
 343.157 +    }
 343.158 +
 343.159 +    public void draw() {
 343.160 +        synchronized (getTreeLock()) {
 343.161 +            if (image != null) {
 343.162 +                Graphics localGraphics = image.getGraphics();
 343.163 +                Dimension size = getSize();
 343.164 +                localGraphics.setColor(isEnabled() ? Color.green : Color.red);
 343.165 +                localGraphics.fillRect(0, 0, size.width, size.height);
 343.166 +                super.paint(localGraphics);
 343.167 +                localGraphics.dispose();
 343.168 +                getTreeLock().notifyAll();
 343.169 +            }
 343.170 +        }
 343.171 +    }
 343.172 +
 343.173 +    public void sync() {
 343.174 +        synchronized (sync) {
 343.175 +            sync.notify();
 343.176 +        }
 343.177 +    }
 343.178 +}
   344.1 --- a/test/java/beans/Beans/6669869/TestDesignTime.java	Tue Dec 06 16:31:58 2011 -0800
   344.2 +++ b/test/java/beans/Beans/6669869/TestDesignTime.java	Mon Dec 19 10:06:23 2011 -0800
   344.3 @@ -29,7 +29,6 @@
   344.4   */
   344.5  
   344.6  import java.beans.Beans;
   344.7 -import sun.awt.SunToolkit;
   344.8  
   344.9  public class TestDesignTime implements Runnable {
  344.10      public static void main(String[] args) throws InterruptedException {
  344.11 @@ -44,7 +43,6 @@
  344.12      }
  344.13  
  344.14      public void run() {
  344.15 -        SunToolkit.createNewAppContext();
  344.16          if (Beans.isDesignTime()) {
  344.17              throw new Error("shared DesignTime property");
  344.18          }
   345.1 --- a/test/java/beans/Beans/6669869/TestGuiAvailable.java	Tue Dec 06 16:31:58 2011 -0800
   345.2 +++ b/test/java/beans/Beans/6669869/TestGuiAvailable.java	Mon Dec 19 10:06:23 2011 -0800
   345.3 @@ -30,7 +30,6 @@
   345.4  
   345.5  import java.awt.GraphicsEnvironment;
   345.6  import java.beans.Beans;
   345.7 -import sun.awt.SunToolkit;
   345.8  
   345.9  public class TestGuiAvailable implements Runnable {
  345.10      public static void main(String[] args) throws InterruptedException {
  345.11 @@ -45,7 +44,6 @@
  345.12      }
  345.13  
  345.14      public void run() {
  345.15 -        SunToolkit.createNewAppContext();
  345.16          if (Beans.isGuiAvailable() == GraphicsEnvironment.isHeadless()) {
  345.17              throw new Error("shared GuiAvailable property");
  345.18          }
   346.1 --- a/test/java/beans/Introspector/6380849/TestBeanInfo.java	Tue Dec 06 16:31:58 2011 -0800
   346.2 +++ b/test/java/beans/Introspector/6380849/TestBeanInfo.java	Mon Dec 19 10:06:23 2011 -0800
   346.3 @@ -41,8 +41,6 @@
   346.4  import java.lang.ref.Reference;
   346.5  import java.lang.reflect.Field;
   346.6  
   346.7 -import sun.awt.SunToolkit;
   346.8 -
   346.9  public class TestBeanInfo implements Runnable {
  346.10  
  346.11      private static final String[] SEARCH_PATH = { "infos" }; // NON-NLS: package name
  346.12 @@ -81,9 +79,6 @@
  346.13      private boolean passed;
  346.14  
  346.15      public void run() {
  346.16 -        if (this.passed) {
  346.17 -            SunToolkit.createNewAppContext();
  346.18 -        }
  346.19          Introspector.flushCaches();
  346.20  
  346.21          test(FirstBean.class, FirstBeanBeanInfo.class);
  346.22 @@ -98,7 +93,5 @@
  346.23          test(SecondBean.class, SecondBeanBeanInfo.class);
  346.24          test(ThirdBean.class, null);
  346.25          test(ThirdBeanBeanInfo.class, ThirdBeanBeanInfo.class);
  346.26 -
  346.27 -        this.passed = true;
  346.28      }
  346.29  }
   347.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   347.2 +++ b/test/java/beans/Introspector/7064279/Test7064279.java	Mon Dec 19 10:06:23 2011 -0800
   347.3 @@ -0,0 +1,75 @@
   347.4 +/*
   347.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   347.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   347.7 + *
   347.8 + * This code is free software; you can redistribute it and/or modify it
   347.9 + * under the terms of the GNU General Public License version 2 only, as
  347.10 + * published by the Free Software Foundation.
  347.11 + *
  347.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  347.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  347.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  347.15 + * version 2 for more details (a copy is included in the LICENSE file that
  347.16 + * accompanied this code).
  347.17 + *
  347.18 + * You should have received a copy of the GNU General Public License version
  347.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  347.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  347.21 + *
  347.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  347.23 + * or visit www.oracle.com if you need additional information or have any
  347.24 + * questions.
  347.25 + */
  347.26 +
  347.27 +/*
  347.28 + * @test
  347.29 + * @bug 7064279
  347.30 + * @summary Tests that Introspector does not have strong references to context class loader
  347.31 + * @author Sergey Malenkov
  347.32 + */
  347.33 +
  347.34 +import java.beans.Introspector;
  347.35 +import java.io.File;
  347.36 +import java.lang.ref.WeakReference;
  347.37 +import java.net.URL;
  347.38 +import java.net.URLClassLoader;
  347.39 +
  347.40 +public class Test7064279 {
  347.41 +
  347.42 +    public static void main(String[] args) throws Exception {
  347.43 +        WeakReference ref = new WeakReference(test("test.jar", "test.Test"));
  347.44 +        try {
  347.45 +            int[] array = new int[1024];
  347.46 +            while (true) {
  347.47 +                array = new int[array.length << 1];
  347.48 +            }
  347.49 +        }
  347.50 +        catch (OutOfMemoryError error) {
  347.51 +            System.gc();
  347.52 +        }
  347.53 +        if (null != ref.get()) {
  347.54 +            throw new Error("ClassLoader is not released");
  347.55 +        }
  347.56 +    }
  347.57 +
  347.58 +    private static Object test(String jarName, String className) throws Exception {
  347.59 +        StringBuilder sb = new StringBuilder(256);
  347.60 +        sb.append("file:");
  347.61 +        sb.append(System.getProperty("test.src", "."));
  347.62 +        sb.append(File.separatorChar);
  347.63 +        sb.append(jarName);
  347.64 +
  347.65 +        ClassLoader newLoader = new URLClassLoader(new URL[] { new URL(sb.toString()) });
  347.66 +        ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
  347.67 +
  347.68 +        Thread.currentThread().setContextClassLoader(newLoader);
  347.69 +        test(newLoader.loadClass(className));
  347.70 +        Thread.currentThread().setContextClassLoader(oldLoader);
  347.71 +
  347.72 +        return newLoader;
  347.73 +    }
  347.74 +
  347.75 +    private static void test(Class type) throws Exception {
  347.76 +        Introspector.getBeanInfo(type);
  347.77 +    }
  347.78 +}
   348.1 Binary file test/java/beans/Introspector/7064279/test.jar has changed
   349.1 --- a/test/java/beans/Introspector/Test6660539.java	Tue Dec 06 16:31:58 2011 -0800
   349.2 +++ b/test/java/beans/Introspector/Test6660539.java	Mon Dec 19 10:06:23 2011 -0800
   349.3 @@ -28,8 +28,6 @@
   349.4   * @author Sergey Malenkov
   349.5   */
   349.6  
   349.7 -import sun.awt.SunToolkit;
   349.8 -
   349.9  import java.beans.BeanInfo;
  349.10  import java.beans.IntrospectionException;
  349.11  import java.beans.Introspector;
  349.12 @@ -49,7 +47,6 @@
  349.13      }
  349.14  
  349.15      public void run() {
  349.16 -        SunToolkit.createNewAppContext();
  349.17          for (PropertyDescriptor pd : getPropertyDescriptors()) {
  349.18              if (pd.getDisplayName().equals(NAME))
  349.19                  throw new Error("shared BeanInfo cache");
   350.1 --- a/test/java/beans/Introspector/TestTypeResolver.java	Tue Dec 06 16:31:58 2011 -0800
   350.2 +++ b/test/java/beans/Introspector/TestTypeResolver.java	Mon Dec 19 10:06:23 2011 -0800
   350.3 @@ -29,6 +29,7 @@
   350.4  
   350.5  import com.sun.beans.TypeResolver;
   350.6  
   350.7 +import java.lang.annotation.Annotation;
   350.8  import java.lang.reflect.Field;
   350.9  import java.lang.reflect.GenericDeclaration;
  350.10  import java.lang.reflect.Method;
  350.11 @@ -170,6 +171,22 @@
  350.12          public int hashCode() {
  350.13              return hash(name) ^ hash(gd) ^ Arrays.hashCode(bounds);
  350.14          }
  350.15 +
  350.16 +        public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass) {
  350.17 +            return false; // not used
  350.18 +        }
  350.19 +
  350.20 +        public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
  350.21 +            return null; // not used
  350.22 +        }
  350.23 +
  350.24 +        public Annotation[] getAnnotations() {
  350.25 +            return null; // not used
  350.26 +        }
  350.27 +
  350.28 +        public Annotation[] getDeclaredAnnotations() {
  350.29 +            return null; // not used
  350.30 +        }
  350.31      }
  350.32  
  350.33      private static class ClassTypeVariable extends TypeVariableImpl<Class<?>> {
   351.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   351.2 +++ b/test/java/beans/PropertyChangeSupport/Test7087429.java	Mon Dec 19 10:06:23 2011 -0800
   351.3 @@ -0,0 +1,45 @@
   351.4 +/*
   351.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   351.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   351.7 + *
   351.8 + * This code is free software; you can redistribute it and/or modify it
   351.9 + * under the terms of the GNU General Public License version 2 only, as
  351.10 + * published by the Free Software Foundation.
  351.11 + *
  351.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  351.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  351.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  351.15 + * version 2 for more details (a copy is included in the LICENSE file that
  351.16 + * accompanied this code).
  351.17 + *
  351.18 + * You should have received a copy of the GNU General Public License version
  351.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  351.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  351.21 + *
  351.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  351.23 + * or visit www.oracle.com if you need additional information or have any
  351.24 + * questions.
  351.25 + */
  351.26 +
  351.27 +/*
  351.28 + * @test
  351.29 + * @bug 7087429
  351.30 + * @summary Tests IllegalArgumentException from the PropertyChangeEvent constructor
  351.31 + * @author Sergey Malenkov
  351.32 + */
  351.33 +
  351.34 +import java.beans.PropertyChangeEvent;
  351.35 +
  351.36 +public final class Test7087429 {
  351.37 +    public static void main(String[] args) {
  351.38 +        try {
  351.39 +            new PropertyChangeEvent(null, null, null, null);
  351.40 +        }
  351.41 +        catch (IllegalArgumentException exception) {
  351.42 +            if (exception.getMessage().equals("null source")) {
  351.43 +                return;
  351.44 +            }
  351.45 +        }
  351.46 +        throw new Error("IllegalArgumentException expected");
  351.47 +    }
  351.48 +}
   352.1 --- a/test/java/beans/PropertyEditor/6380849/TestPropertyEditor.java	Tue Dec 06 16:31:58 2011 -0800
   352.2 +++ b/test/java/beans/PropertyEditor/6380849/TestPropertyEditor.java	Mon Dec 19 10:06:23 2011 -0800
   352.3 @@ -36,7 +36,6 @@
   352.4  import java.beans.PropertyEditor;
   352.5  import java.beans.PropertyEditorManager;
   352.6  
   352.7 -import sun.awt.SunToolkit;
   352.8  import sun.beans.editors.BooleanEditor;
   352.9  import sun.beans.editors.ByteEditor;
  352.10  import sun.beans.editors.ColorEditor;
  352.11 @@ -77,12 +76,7 @@
  352.12          }
  352.13      }
  352.14  
  352.15 -    private boolean passed;
  352.16 -
  352.17      public void run() {
  352.18 -        if (this.passed) {
  352.19 -            SunToolkit.createNewAppContext();
  352.20 -        }
  352.21          PropertyEditorManager.registerEditor(ThirdBean.class, ThirdBeanEditor.class);
  352.22  
  352.23          test(FirstBean.class, FirstBeanEditor.class);
  352.24 @@ -135,7 +129,5 @@
  352.25          test(Color.class, null);
  352.26          test(Font.class, null);
  352.27          test(Enumeration.class, EnumEditor.class);
  352.28 -
  352.29 -        this.passed = true;
  352.30      }
  352.31  }
   353.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   353.2 +++ b/test/java/beans/PropertyEditor/Test7087876.java	Mon Dec 19 10:06:23 2011 -0800
   353.3 @@ -0,0 +1,59 @@
   353.4 +/*
   353.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   353.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   353.7 + *
   353.8 + * This code is free software; you can redistribute it and/or modify it
   353.9 + * under the terms of the GNU General Public License version 2 only, as
  353.10 + * published by the Free Software Foundation.
  353.11 + *
  353.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  353.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  353.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  353.15 + * version 2 for more details (a copy is included in the LICENSE file that
  353.16 + * accompanied this code).
  353.17 + *
  353.18 + * You should have received a copy of the GNU General Public License version
  353.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  353.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  353.21 + *
  353.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  353.23 + * or visit www.oracle.com if you need additional information or have any
  353.24 + * questions.
  353.25 + */
  353.26 +
  353.27 +/*
  353.28 + * @test
  353.29 + * @bug 7087876
  353.30 + * @summary Tests spec of the createPropertyEditor method
  353.31 + * @author Sergey Malenkov
  353.32 + */
  353.33 +
  353.34 +import java.beans.IntrospectionException;
  353.35 +import java.beans.PropertyDescriptor;
  353.36 +import java.beans.PropertyEditorSupport;
  353.37 +
  353.38 +public class Test7087876 {
  353.39 +
  353.40 +    public static void main(String[] args) throws IntrospectionException {
  353.41 +        PropertyDescriptor pd = new PropertyDescriptor("value", Bean.class);
  353.42 +        pd.setPropertyEditorClass(Editor.class);
  353.43 +        pd.createPropertyEditor(new Bean());
  353.44 +    }
  353.45 +
  353.46 +    public static class Bean {
  353.47 +        private String value;
  353.48 +
  353.49 +        public String getValue() {
  353.50 +            return this.value;
  353.51 +        }
  353.52 +
  353.53 +        public void setValue(String value) {
  353.54 +            this.value = value;
  353.55 +        }
  353.56 +    }
  353.57 +
  353.58 +    public static class Editor extends PropertyEditorSupport {
  353.59 +        private Editor() {
  353.60 +        }
  353.61 +    }
  353.62 +}
   354.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   354.2 +++ b/test/java/beans/XMLEncoder/Test7092744.java	Mon Dec 19 10:06:23 2011 -0800
   354.3 @@ -0,0 +1,66 @@
   354.4 +/*
   354.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   354.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   354.7 + *
   354.8 + * This code is free software; you can redistribute it and/or modify it
   354.9 + * under the terms of the GNU General Public License version 2 only, as
  354.10 + * published by the Free Software Foundation.
  354.11 + *
  354.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  354.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  354.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  354.15 + * version 2 for more details (a copy is included in the LICENSE file that
  354.16 + * accompanied this code).
  354.17 + *
  354.18 + * You should have received a copy of the GNU General Public License version
  354.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  354.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  354.21 + *
  354.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  354.23 + * or visit www.oracle.com if you need additional information or have any
  354.24 + * questions.
  354.25 + */
  354.26 +
  354.27 +/*
  354.28 + * @test
  354.29 + * @bug 7092744
  354.30 + * @summary Tests for ambiguous methods
  354.31 + * @author Sergey Malenkov
  354.32 + */
  354.33 +
  354.34 +public class Test7092744 extends AbstractTest {
  354.35 +
  354.36 +    public static void main(String[] args) {
  354.37 +        new Test7092744().test(true);
  354.38 +    }
  354.39 +
  354.40 +    protected Object getObject() {
  354.41 +        return new Bean();
  354.42 +    }
  354.43 +
  354.44 +    protected Object getAnotherObject() {
  354.45 +        Bean bean = new Bean();
  354.46 +        bean.setValue(99);
  354.47 +        return bean;
  354.48 +    }
  354.49 +
  354.50 +    public static interface I<T extends Number> {
  354.51 +
  354.52 +        T getValue();
  354.53 +
  354.54 +        void setValue(T value);
  354.55 +    }
  354.56 +
  354.57 +    public static class Bean implements I<Integer> {
  354.58 +
  354.59 +        private Integer value;
  354.60 +
  354.61 +        public Integer getValue() {
  354.62 +            return this.value;
  354.63 +        }
  354.64 +
  354.65 +        public void setValue(Integer value) {
  354.66 +            this.value = value;
  354.67 +        }
  354.68 +    }
  354.69 +}
   355.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   355.2 +++ b/test/java/lang/String/CaseInsensitiveComparator.java	Mon Dec 19 10:06:23 2011 -0800
   355.3 @@ -0,0 +1,68 @@
   355.4 +/*
   355.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   355.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   355.7 + *
   355.8 + * This code is free software; you can redistribute it and/or modify it
   355.9 + * under the terms of the GNU General Public License version 2 only, as
  355.10 + * published by the Free Software Foundation.
  355.11 + *
  355.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  355.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  355.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  355.15 + * version 2 for more details (a copy is included in the LICENSE file that
  355.16 + * accompanied this code).
  355.17 + *
  355.18 + * You should have received a copy of the GNU General Public License version
  355.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  355.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  355.21 + *
  355.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  355.23 + * or visit www.oracle.com if you need additional information or have any
  355.24 + * questions.
  355.25 + */
  355.26 +
  355.27 +/*
  355.28 + * This test tests that the String.CaseInsensitiveComparator.readResolve method
  355.29 + * deserializes String.CASE_INSENSITIVE_ORDER into an object which satisfies the
  355.30 + * equals method.
  355.31 + *
  355.32 + * @test
  355.33 + * @bug 5035850
  355.34 + * @summary Test for String.CaseInsensitiveComparator.readResolve
  355.35 + */
  355.36 +
  355.37 +import java.io.ByteArrayInputStream;
  355.38 +import java.io.ByteArrayOutputStream;
  355.39 +import java.io.ObjectInputStream;
  355.40 +import java.io.ObjectOutputStream;
  355.41 +
  355.42 +public class CaseInsensitiveComparator {
  355.43 +    public static void main(String[] args) throws Exception {
  355.44 +        Object result;
  355.45 +
  355.46 +        try (ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
  355.47 +                ObjectOutputStream out = new ObjectOutputStream(outBuffer))
  355.48 +        {
  355.49 +            out.writeObject(String.CASE_INSENSITIVE_ORDER);
  355.50 +            out.close();
  355.51 +
  355.52 +            try (ByteArrayInputStream inBuffer = new ByteArrayInputStream(outBuffer.toByteArray());
  355.53 +                    ObjectInputStream in = new ObjectInputStream(inBuffer))
  355.54 +            {
  355.55 +                result = in.readObject();
  355.56 +            }
  355.57 +        }
  355.58 +
  355.59 +        if (!String.CASE_INSENSITIVE_ORDER.equals(result)) {
  355.60 +            throw new Exception("Value restored from serial form does not equal original!");
  355.61 +        }
  355.62 +
  355.63 +        if (!result.equals(String.CASE_INSENSITIVE_ORDER)) {
  355.64 +            throw new Exception("Value restored from serial form does not equal original!");
  355.65 +        }
  355.66 +
  355.67 +        if (String.CASE_INSENSITIVE_ORDER != result) {
  355.68 +            throw new Exception("Value restored from serial form does not equal original!");
  355.69 +        }
  355.70 +    }
  355.71 +}
   356.1 --- a/test/java/nio/channels/AsynchronousSocketChannel/Basic.java	Tue Dec 06 16:31:58 2011 -0800
   356.2 +++ b/test/java/nio/channels/AsynchronousSocketChannel/Basic.java	Mon Dec 19 10:06:23 2011 -0800
   356.3 @@ -63,7 +63,9 @@
   356.4          testRead3();
   356.5          testWrite1();
   356.6          testWrite2();
   356.7 -        testTimeout();
   356.8 +        // skip timeout tests until 7052549 is fixed
   356.9 +        if (!System.getProperty("os.name").startsWith("Windows"))
  356.10 +            testTimeout();
  356.11          testShutdown();
  356.12      }
  356.13  
   357.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   357.2 +++ b/test/java/util/MissingFormatArgumentException/GetFormatSpecifier.java	Mon Dec 19 10:06:23 2011 -0800
   357.3 @@ -0,0 +1,56 @@
   357.4 +/*
   357.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   357.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   357.7 + *
   357.8 + * This code is free software; you can redistribute it and/or modify it
   357.9 + * under the terms of the GNU General Public License version 2 only, as
  357.10 + * published by the Free Software Foundation.
  357.11 + *
  357.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  357.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  357.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  357.15 + * version 2 for more details (a copy is included in the LICENSE file that
  357.16 + * accompanied this code).
  357.17 + *
  357.18 + * You should have received a copy of the GNU General Public License version
  357.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  357.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  357.21 + *
  357.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  357.23 + * or visit www.oracle.com if you need additional information or have any
  357.24 + * questions.
  357.25 + */
  357.26 +
  357.27 +/*
  357.28 + * @test
  357.29 + * @bug     5063455
  357.30 + * @summary Unit test for MissingFormatArgumentException.getFormatSpecifier
  357.31 + * @author  Brandon Passanisi
  357.32 + */
  357.33 +import java.util.MissingFormatArgumentException;
  357.34 +
  357.35 +public class GetFormatSpecifier {
  357.36 +
  357.37 +    static void fail(String s) {
  357.38 +        throw new RuntimeException(s);
  357.39 +    }
  357.40 +
  357.41 +    public static void main(String[] args) {
  357.42 +
  357.43 +        // Use the format specifier below, which should throw a
  357.44 +        // MissingFormatArgumentException. Then, use getFormatSpecifier()
  357.45 +        // to make sure the returned value equals the original format string.
  357.46 +        final String formatSpecifier = "%1$5.3s";
  357.47 +        try {
  357.48 +            String formatResult = String.format(formatSpecifier);
  357.49 +            fail("MissingFormatArgumentException not thrown.");
  357.50 +        } catch (MissingFormatArgumentException ex) {
  357.51 +            final String returnedFormatSpecifier = ex.getFormatSpecifier();
  357.52 +            if (!returnedFormatSpecifier.equals(formatSpecifier)) {
  357.53 +                fail("The specified format specifier: " + formatSpecifier
  357.54 +                        + " does not match the value from getFormatSpecifier(): "
  357.55 +                        + returnedFormatSpecifier);
  357.56 +            }
  357.57 +        }
  357.58 +    }
  357.59 +}
   358.1 --- a/test/java/util/ResourceBundle/Control/ExpirationTest.java	Tue Dec 06 16:31:58 2011 -0800
   358.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   358.3 @@ -1,176 +0,0 @@
   358.4 -/*
   358.5 - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
   358.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   358.7 - *
   358.8 - * This code is free software; you can redistribute it and/or modify it
   358.9 - * under the terms of the GNU General Public License version 2 only, as
  358.10 - * published by the Free Software Foundation.
  358.11 - *
  358.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
  358.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  358.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  358.15 - * version 2 for more details (a copy is included in the LICENSE file that
  358.16 - * accompanied this code).
  358.17 - *
  358.18 - * You should have received a copy of the GNU General Public License version
  358.19 - * 2 along with this work; if not, write to the Free Software Foundation,
  358.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  358.21 - *
  358.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  358.23 - * or visit www.oracle.com if you need additional information or have any
  358.24 - * questions.
  358.25 - */
  358.26 -/*
  358.27 - *
  358.28 - */
  358.29 -
  358.30 -/*
  358.31 - * This class is used by ExpirationTest.sh. See the timing information in
  358.32 - * the shell script.
  358.33 - */
  358.34 -
  358.35 -import java.util.*;
  358.36 -
  358.37 -public class ExpirationTest {
  358.38 -    static final Locale AUSTRIA = new Locale("de", "AT");
  358.39 -    static String format;
  358.40 -    static String fileType;
  358.41 -
  358.42 -    public static void main(String[] args) {
  358.43 -        // If -latency is specified, try sleeping for 3 seconds 3
  358.44 -        // times to see its latency. If the latency is too large, then
  358.45 -        // the program exits with 2. (See sleep())
  358.46 -        if ("-latency".equals(args[0])) {
  358.47 -            System.out.print("Checking latency... ");
  358.48 -            for (int i = 0; i < 3; i++) {
  358.49 -                sleep(3);
  358.50 -            }
  358.51 -            System.out.println("done");
  358.52 -            System.exit(0);
  358.53 -        }
  358.54 -
  358.55 -        format = args[0];
  358.56 -        fileType = args[1];
  358.57 -
  358.58 -        Locale loc = Locale.getDefault();
  358.59 -        try {
  358.60 -            Locale.setDefault(Locale.JAPAN);
  358.61 -            ResourceBundle.Control control = new TestControl();
  358.62 -            ResourceBundle rb = ResourceBundle.getBundle("ExpirationData", Locale.GERMAN,
  358.63 -                                                         control);
  358.64 -            check(rb.getString("data"), "German");
  358.65 -
  358.66 -            rb = ResourceBundle.getBundle("ExpirationData", AUSTRIA, control);
  358.67 -            check(rb.getString("january"), "Januar");
  358.68 -
  358.69 -            // Wait until the instance gets expired in the cache in 7 seconds.
  358.70 -            sleep(7);
  358.71 -
  358.72 -            // At this point, it should be determined that reloading is not needed.
  358.73 -            rb = ResourceBundle.getBundle("ExpirationData", Locale.GERMAN, control);
  358.74 -            check(rb.getString("data"), "German");
  358.75 -
  358.76 -            rb = ResourceBundle.getBundle("ExpirationData", AUSTRIA, control);
  358.77 -            check(rb.getString("january"), "Januar");
  358.78 -
  358.79 -            // Wait until the instance in the cache gets expired again and
  358.80 -            // ExpirationData_de gets updated.
  358.81 -            // 33 = 40 - 7 (See the timing chart in ExpirationTest.sh)
  358.82 -            sleep(33);
  358.83 -
  358.84 -            // At this point, getBundle must reload the updated
  358.85 -            // ExpirationData_de and ExpirationData_de_AT must be
  358.86 -            // avaible.
  358.87 -
  358.88 -            rb = ResourceBundle.getBundle("ExpirationData", Locale.GERMAN, control);
  358.89 -            try {
  358.90 -                check(rb.getString("data"), "Deutsch");
  358.91 -            } catch (RuntimeException e) {
  358.92 -                if (format.equals("class")) {
  358.93 -                    // Class loader doesn't load updated classes.
  358.94 -                    System.out.println("Known class limitation: " + e.getMessage());
  358.95 -                }
  358.96 -            }
  358.97 -
  358.98 -            rb = ResourceBundle.getBundle("ExpirationData", AUSTRIA, control);
  358.99 -            try {
 358.100 -                check(rb.getString("january"), "J\u00e4nner");
 358.101 -            } catch (RuntimeException e) {
 358.102 -                if (fileType.equals("jar")) {
 358.103 -                    // Jar doesn't load new entries.
 358.104 -                    System.out.println("Known jar limitation: " + e.getMessage());
 358.105 -                } else {
 358.106 -                    throw e;
 358.107 -                }
 358.108 -            }
 358.109 -        } finally {
 358.110 -            Locale.setDefault(loc);
 358.111 -        }
 358.112 -    }
 358.113 -
 358.114 -    private static void check(String s, String expected) {
 358.115 -        String time = getTime();
 358.116 -        if (!s.equals(expected)) {
 358.117 -            throw new RuntimeException("got '" + s + "', expected '" + expected + "' at "
 358.118 -                                       + time);
 358.119 -        }
 358.120 -        System.out.println("ExpirationTest: got '" + s + "' at " + time);
 358.121 -    }
 358.122 -
 358.123 -    private static void sleep(int seconds) {
 358.124 -        long millis = seconds * 1000;
 358.125 -        long start = System.currentTimeMillis();
 358.126 -        try {
 358.127 -            Thread.sleep(millis);
 358.128 -        } catch (InterruptedException e) {
 358.129 -        }
 358.130 -        long end = System.currentTimeMillis();
 358.131 -        long latency = end - start - millis;
 358.132 -        // If the latecy is more than 1% of the requested sleep time,
 358.133 -        // then give up the testing.
 358.134 -        if (latency > millis/100) {
 358.135 -            System.err.printf("Latency is too large: slept for %d [ms], "
 358.136 -                              + "expected %d [ms] latency rate: %+.2f%% (expected not more than 1%%)%n"
 358.137 -                              + "exiting...%n",
 358.138 -                              end - start, millis, (double)latency*100.0/millis);
 358.139 -            System.exit(2);
 358.140 -        }
 358.141 -    }
 358.142 -
 358.143 -    private static final String getTime() {
 358.144 -        return new Date().toString().substring(11, 19);
 358.145 -    }
 358.146 -
 358.147 -    private static class TestControl extends ResourceBundle.Control {
 358.148 -        @Override
 358.149 -        public long getTimeToLive(String name, Locale loc) {
 358.150 -            return 5000; // 5 seconds
 358.151 -        }
 358.152 -
 358.153 -        @Override
 358.154 -        public ResourceBundle newBundle(String name, Locale loc,
 358.155 -                                        String fmt, ClassLoader cl, boolean reload)
 358.156 -            throws IllegalAccessException, InstantiationException, java.io.IOException {
 358.157 -            ResourceBundle bundle = super.newBundle(name, loc, fmt, cl, reload);
 358.158 -            if (bundle != null) {
 358.159 -                System.out.println("newBundle: " + (reload ? "**re" : "")
 358.160 -                                   + "loaded '" + toName(name, loc , fmt) + "' at " + getTime());
 358.161 -            }
 358.162 -            return bundle;
 358.163 -        }
 358.164 -
 358.165 -        @Override
 358.166 -        public boolean needsReload(String name, Locale loc,
 358.167 -                                   String fmt, ClassLoader cl,
 358.168 -                                   ResourceBundle rb, long time) {
 358.169 -            boolean b = super.needsReload(name, loc, fmt, cl, rb, time);
 358.170 -            System.out.println("needsReload: '" + b + "' for " + toName(name, loc, fmt)
 358.171 -                               + " at " + getTime());
 358.172 -            return b;
 358.173 -        }
 358.174 -
 358.175 -        private String toName(String name, Locale loc, String fmt) {
 358.176 -            return toResourceName(toBundleName(name, loc), fmt.substring(5));
 358.177 -        }
 358.178 -    }
 358.179 -}
   359.1 --- a/test/java/util/ResourceBundle/Control/ExpirationTest.sh	Tue Dec 06 16:31:58 2011 -0800
   359.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
   359.3 @@ -1,331 +0,0 @@
   359.4 -# 
   359.5 -# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
   359.6 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   359.7 -# 
   359.8 -# This code is free software; you can redistribute it and/or modify it
   359.9 -# under the terms of the GNU General Public License version 2 only, as
  359.10 -# published by the Free Software Foundation.
  359.11 -# 
  359.12 -# This code is distributed in the hope that it will be useful, but WITHOUT
  359.13 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  359.14 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  359.15 -# version 2 for more details (a copy is included in the LICENSE file that
  359.16 -# accompanied this code).
  359.17 -# 
  359.18 -# You should have received a copy of the GNU General Public License version
  359.19 -# 2 along with this work; if not, write to the Free Software Foundation,
  359.20 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  359.21 -# 
  359.22 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  359.23 -# or visit www.oracle.com if you need additional information or have any
  359.24 -# questions.
  359.25 -#
  359.26 -# @test
  359.27 -# @bug 4212439 5102289 6272156
  359.28 -# @summary Tests for expiration control and reloading expired resource bundles.
  359.29 -# @build ExpirationTest
  359.30 -# @run shell/timeout=300 ExpirationTest.sh
  359.31 -
  359.32 -#
  359.33 -# Timings of the test sequence
  359.34 -#
  359.35 -# 0         5    7      10             20             40  [seconds]
  359.36 -# +---------+----+------+------//------+------//------+--
  359.37 -# g         X    g      X              U              g   [event]
  359.38 -#
  359.39 -#  0 g - java starts; the first getBundle call gets "German";
  359.40 -#        sleep for 7 sec
  359.41 -#  5 X - the bundle expires (every 5 seconds)
  359.42 -#  7 g - java wakes up; the second getBundle call still gets "German";
  359.43 -#        sleep for 33 sec
  359.44 -# 10 X - the bundle expires in the cache
  359.45 -# 20 U - shell script updates DE and add AT
  359.46 -# 40 g - java wakes up; third getBundle call; gets "Deutsch"
  359.47 -#
  359.48 -# event: g - getBundle, X - eXpire, U - Update
  359.49 -#
  359.50 -#
  359.51 -# ExpirationTest.java uses 3 exit values.
  359.52 -#  0 - passed
  359.53 -#  1 - failed
  359.54 -#  2 - can't proceed due to slow platform
  359.55 -#
  359.56 -
  359.57 -# Check environment variables
  359.58 -if [ "x$TESTJAVA" = "x" ]; then
  359.59 -    1>&2 echo "No TESTJAVA defined. exiting..."
  359.60 -    exit 1
  359.61 -fi
  359.62 -
  359.63 -# Make sure that this test is run in C locale
  359.64 -LANG=C
  359.65 -export LANG
  359.66 -LC_ALL=
  359.67 -export LC_ALL
  359.68 -
  359.69 -: ${TESTCLASSES:=.}
  359.70 -
  359.71 -# YES if the platform has %s support in date
  359.72 -HAS_S=NO
  359.73 -
  359.74 -case "`uname`" in
  359.75 -Windows* | CYGWIN* )
  359.76 -    DEL=";"
  359.77 -    ;;
  359.78 -SunOS)
  359.79 -    DEL=":"
  359.80 -    ;;
  359.81 -Linux)
  359.82 -    DEL=":"
  359.83 -    HAS_S=YES
  359.84 -    ;;
  359.85 -esac
  359.86 -
  359.87 -# Interval until resources are updated
  359.88 -INTERVAL=20
  359.89 -
  359.90 -DATA=ExpirationData
  359.91 -
  359.92 -ROOT=${DATA}.properties
  359.93 -JA=${DATA}_ja.properties
  359.94 -DE=${DATA}_de.properties
  359.95 -AT=${DATA}_de_AT.properties
  359.96 -
  359.97 -JARFILE=data.jar
  359.98 -
  359.99 -createProperties() {
 359.100 -    rm -f ${DATA}*.properties
 359.101 -    echo "data: English" > $ROOT
 359.102 -    (echo "data: Japanese"; echo "january: 1gatsu") > $JA
 359.103 -    (echo "data: German"; echo "january: Januar") > $DE
 359.104 -    echo "Properties files have been created at `date +%T`"
 359.105 -}
 359.106 -
 359.107 -createJar() {
 359.108 -    if [ "$FORMAT" = "properties" ]; then
 359.109 -	createProperties
 359.110 -	F="${DATA}*.properties"
 359.111 -    else
 359.112 -	createClasses
 359.113 -	F="-C classes ${ROOT}.class -C classes ${JA}.class -C classes ${DE}.class"
 359.114 -    fi
 359.115 -    ${TESTJAVA}/bin/jar cf $JARFILE $F
 359.116 -    ${TESTJAVA}/bin/jar tvf $JARFILE
 359.117 -    rm -f ${DATA}*.properties
 359.118 -    echo "Jar created at `date +%T`"
 359.119 -}
 359.120 -
 359.121 -createClasses() {
 359.122 -    rm -f ${DATA}*.java
 359.123 -    rm -rf classes
 359.124 -    mkdir classes
 359.125 -    createJava $ROOT English
 359.126 -    createJava $JA Japanese
 359.127 -    createJava $DE German Januar
 359.128 -    ${TESTJAVA}/bin/javac -d classes ${ROOT}.java ${JA}.java ${DE}.java
 359.129 -    echo "Created" classes/*.class "at `date +%T`"
 359.130 -}
 359.131 -
 359.132 -createJava() {
 359.133 -    (echo "
 359.134 -import java.util.*;
 359.135 -
 359.136 -public class $1 extends ListResourceBundle {
 359.137 -    public Object[][] getContents() {
 359.138 -	return new Object[][] {
 359.139 -	    { \"data\", \"$2\" },"
 359.140 -    if [ "x$3" != "x" ]; then
 359.141 -	echo "	    { \"january\", \"$3\" },"
 359.142 -    fi
 359.143 -echo "	};
 359.144 -    }
 359.145 -}") >$1.java
 359.146 -}
 359.147 -
 359.148 -updateDEaddAT() {
 359.149 -    rm -f $DE
 359.150 -    (echo "data=Deutsch"; echo "january=Januar") > $DE
 359.151 -    # add de_AT
 359.152 -    echo "january=J\u00e4nner" > $AT
 359.153 -    echo "Updated '"${DE}"' and added '"${AT}"' at `date +%T`"
 359.154 -}
 359.155 -
 359.156 -updateClassDEaddClassAT() {
 359.157 -    rm -f $DE.java classes/$DE.class
 359.158 -    createJava $DE Deutsch Januar
 359.159 -    ${TESTJAVA}/bin/javac -d classes ${DE}.java
 359.160 -    createJava $AT Deutsch "J\\u00e4nner"
 359.161 -    ${TESTJAVA}/bin/javac -d classes ${AT}.java
 359.162 -    echo "Updated '"${DE}"' class and added '"${AT}"' class at `date +%T`"
 359.163 -}
 359.164 -
 359.165 -updateJar() {
 359.166 -    if [ "$FORMAT" = "properties" ]; then
 359.167 -	updateDEaddAT
 359.168 -	F="$DE $AT"
 359.169 -    else
 359.170 -	updateClassDEaddClassAT
 359.171 -	F="-C classes ${DE}.class -C classes ${AT}.class"
 359.172 -    fi
 359.173 -    ${TESTJAVA}/bin/jar uf $JARFILE $F
 359.174 -    rm -f $DE $AT
 359.175 -    echo "Updated '"${JARFILE}"' at `date +%T`"
 359.176 -    ${TESTJAVA}/bin/jar tvf $JARFILE
 359.177 -}
 359.178 -
 359.179 -getSeconds() {
 359.180 -    if [ "$HAS_S" = "YES" ]; then
 359.181 -	date '+%s'
 359.182 -    else
 359.183 -	# Returns an approximation of the offset from the Epoch in
 359.184 -	# seconds.
 359.185 -	date -u '+%Y %j %H %M %S' | \
 359.186 -	awk '{d=($1-1970)*365.2425; print int(((((((d+$2-1)*24)+$3)*60)+$3)*60)+$5);}'
 359.187 -    fi
 359.188 -}
 359.189 -
 359.190 -#
 359.191 -# Execute $1 and check how long it takes
 359.192 -#
 359.193 -timedExec() {
 359.194 -    S=`getSeconds`
 359.195 -    eval $1
 359.196 -    E=`getSeconds`
 359.197 -    D=`expr $E - $S`
 359.198 -    #
 359.199 -    # If this machine is too slow, give up the further testing.
 359.200 -    #
 359.201 -    if [ "$D" -gt $2 ]; then
 359.202 -	1>&2 echo "This machine took $D seconds to prepare test data," \
 359.203 -		  "which is too slow to proceed. Exiting..."
 359.204 -	exit 0
 359.205 -    fi
 359.206 -    unset S
 359.207 -    unset E
 359.208 -    unset D
 359.209 -}
 359.210 -
 359.211 -checkStatus() {
 359.212 -    if [ $1 = 0 ]; then
 359.213 -	echo "$2: PASSED"
 359.214 -    elif [ $1 != 2 ]; then
 359.215 -	echo "$2: FAILED"
 359.216 -	exit 1
 359.217 -    else
 359.218 -	# Just we should't proceed to avoid timing issues.
 359.219 -	exit 0
 359.220 -    fi
 359.221 -}
 359.222 -
 359.223 -#
 359.224 -# Before starting tests, check the latency with Thread.sleep().
 359.225 -#
 359.226 -${TESTJAVA}/bin/java -cp "${TESTCLASSES}${DEL}." ExpirationTest -latency
 359.227 -STATUS=$?
 359.228 -if [ $STATUS = 2 ]; then
 359.229 -    exit 0
 359.230 -fi
 359.231 -
 359.232 -#
 359.233 -# Tests for properties
 359.234 -#
 359.235 -FORMAT=properties
 359.236 -
 359.237 -#
 359.238 -# Test with plain files (properties)
 359.239 -#
 359.240 -echo "Starting test with properties files at `date +%T`"
 359.241 -
 359.242 -#
 359.243 -# Creates properties files
 359.244 -#
 359.245 -timedExec createProperties 10
 359.246 -
 359.247 -#
 359.248 -# Execute a child process which will update files in $INTERVAL seconds.
 359.249 -#
 359.250 -(sleep $INTERVAL; updateDEaddAT; exit 0) &
 359.251 -
 359.252 -${TESTJAVA}/bin/java -cp "${TESTCLASSES}${DEL}." ExpirationTest properties file
 359.253 -STATUS=$?
 359.254 -wait
 359.255 -checkStatus $STATUS "Test with properties files"
 359.256 -
 359.257 -#
 359.258 -# Test with jar file if jar is available (properties)
 359.259 -#
 359.260 -if [ -x ${TESTJAVA}/bin/jar ] || [ -x ${TESTJAVA}/bin/jar.exe ]; then
 359.261 -    HASJAR=YES
 359.262 -else
 359.263 -    HASJAR=NO
 359.264 -fi
 359.265 -
 359.266 -if [ $HASJAR = YES  ]; then
 359.267 -    echo ""
 359.268 -    echo "Starting test with a jar file (properties) at `date +%T`"
 359.269 -
 359.270 -    #
 359.271 -    # Create a jar files with properties
 359.272 -    #
 359.273 -    timedExec createJar 10
 359.274 -
 359.275 -    (sleep $INTERVAL; updateJar; exit 0) &
 359.276 -    ${TESTJAVA}/bin/java -cp "${TESTCLASSES}${DEL}${JARFILE}" ExpirationTest properties jar
 359.277 -    STATUS=$?
 359.278 -    wait
 359.279 -    checkStatus $STATUS "Test with a jar file (properties)"
 359.280 -fi
 359.281 -
 359.282 -#
 359.283 -# Test for classes
 359.284 -#
 359.285 -
 359.286 -# Note: class-based resource bundles can't be reloaded due to the
 359.287 -# cache support in class loaders. So the results of the test cases
 359.288 -# below are not checked. (Test cases always pass.)
 359.289 -
 359.290 -# If there's no javac available, then give up the test with
 359.291 -# class-based properties.
 359.292 -if [ ! -x ${TESTJAVA}/bin/javac ] && [ ! -x ${TESTJAVA}/bin/javac.exe ]; then
 359.293 -    exit 0
 359.294 -fi
 359.295 -
 359.296 -rm -f ${DATA}*.properties $JARFILE
 359.297 -
 359.298 -FORMAT=class
 359.299 -ROOT=`basename $ROOT .properties`
 359.300 -JA=`basename $JA .properties`
 359.301 -DE=`basename $DE .properties`
 359.302 -AT=`basename $AT .properties`
 359.303 -
 359.304 -echo ""
 359.305 -echo "Starting test with class files at `date +%T`"
 359.306 -
 359.307 -#
 359.308 -# Create class files
 359.309 -#
 359.310 -timedExec createClasses 10
 359.311 -
 359.312 -(sleep $INTERVAL; updateClassDEaddClassAT; exit 0) &
 359.313 -${TESTJAVA}/bin/java -cp "${TESTCLASSES}${DEL}classes" ExpirationTest class file
 359.314 -STATUS=$?
 359.315 -wait
 359.316 -checkStatus $STATUS "Test with class files"
 359.317 -
 359.318 -if [ $HASJAR = YES ]; then
 359.319 -    echo ""
 359.320 -    echo "Starting test with a jar file (class) at `date +%T`"
 359.321 -
 359.322 -    #
 359.323 -    # Create a jar file with class files
 359.324 -    #
 359.325 -    timedExec createJar 10
 359.326 -
 359.327 -    (sleep $INTERVAL; updateJar; exit 0) &
 359.328 -    ${TESTJAVA}/bin/java -cp "${TESTCLASSES}${DEL}${JARFILE}" ExpirationTest class jar
 359.329 -    STATUS=$?
 359.330 -    wait
 359.331 -    checkStatus $STATUS "Test with a jar file (class)"
 359.332 -fi
 359.333 -
 359.334 -exit 0
   360.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   360.2 +++ b/test/java/util/zip/DeInflate.java	Mon Dec 19 10:06:23 2011 -0800
   360.3 @@ -0,0 +1,96 @@
   360.4 +/*
   360.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   360.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   360.7 + *
   360.8 + * This code is free software; you can redistribute it and/or modify it
   360.9 + * under the terms of the GNU General Public License version 2 only, as
  360.10 + * published by the Free Software Foundation.
  360.11 + *
  360.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  360.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  360.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  360.15 + * version 2 for more details (a copy is included in the LICENSE file that
  360.16 + * accompanied this code).
  360.17 + *
  360.18 + * You should have received a copy of the GNU General Public License version
  360.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  360.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  360.21 + *
  360.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  360.23 + * or visit www.oracle.com if you need additional information or have any
  360.24 + * questions.
  360.25 + */
  360.26 +
  360.27 +/**
  360.28 + * @test
  360.29 + * @bug 7110149
  360.30 + * @summary Test basic deflater & inflater functionality
  360.31 + */
  360.32 +
  360.33 +import java.io.*;
  360.34 +import java.util.*;
  360.35 +import java.util.zip.*;
  360.36 +
  360.37 +public class DeInflate {
  360.38 +
  360.39 +    static void check(Deflater compresser, byte[] in, int len,
  360.40 +                      byte[] out1, byte[] out2, boolean nowrap)
  360.41 +        throws Throwable
  360.42 +    {
  360.43 +        Arrays.fill(out1, (byte)0);
  360.44 +        Arrays.fill(out2, (byte)0);
  360.45 +
  360.46 +        compresser.setInput(in, 0, len);
  360.47 +        compresser.finish();
  360.48 +        int m = compresser.deflate(out1);
  360.49 +
  360.50 +        Inflater decompresser = new Inflater(nowrap);
  360.51 +        decompresser.setInput(out1, 0, m);
  360.52 +        int n = decompresser.inflate(out2);
  360.53 +
  360.54 +        if (n != len ||
  360.55 +            !Arrays.equals(Arrays.copyOf(in, len), Arrays.copyOf(out2, len)) ||
  360.56 +            decompresser.inflate(out2) != 0) {
  360.57 +            System.out.printf("m=%d, n=%d, len=%d, eq=%b%n",
  360.58 +                              m, n, len, Arrays.equals(in, out2));
  360.59 +            throw new RuntimeException("De/inflater failed:" + compresser);
  360.60 +        }
  360.61 +    }
  360.62 +
  360.63 +    public static void main(String[] args) throws Throwable {
  360.64 +        byte[] dataIn = new byte[1024 * 512];
  360.65 +        new Random().nextBytes(dataIn);
  360.66 +        byte[] dataOut1 = new byte[dataIn.length + 1024];
  360.67 +        byte[] dataOut2 = new byte[dataIn.length];
  360.68 +        boolean wrap[] = new boolean[] { false, true };
  360.69 +
  360.70 +        for (int level = Deflater.DEFAULT_COMPRESSION;
  360.71 +                 level <= Deflater.BEST_COMPRESSION; level++) {
  360.72 +            System.out.print("level=" + level + ", strategy= ");
  360.73 +            for (int strategy = Deflater.DEFAULT_STRATEGY;
  360.74 +                     strategy <= Deflater.HUFFMAN_ONLY; strategy++) {
  360.75 +                System.out.print(" " + strategy + " nowrap[");
  360.76 +                for (int dowrap = 0; dowrap <= 1; dowrap++) {
  360.77 +                    System.out.print(" " + wrap[dowrap]);
  360.78 +                    for (int i = 0; i < 5; i++) {
  360.79 +                        Deflater def = new Deflater(level, wrap[dowrap]);
  360.80 +                        if (strategy != Deflater.DEFAULT_STRATEGY) {
  360.81 +                            def.setStrategy(strategy);
  360.82 +                            // The first invocation after setLevel/Strategy()
  360.83 +                            // with a different level/stragety returns 0, if
  360.84 +                            // there is no need to flush out anything for the
  360.85 +                            // previous setting/"data", this is tricky and
  360.86 +                            // appears un-documented.
  360.87 +                            def.deflate(dataOut2);
  360.88 +                        }
  360.89 +                        int len = (i == 0)? dataIn.length
  360.90 +                                          : new Random().nextInt(dataIn.length);
  360.91 +                            check(def, dataIn, len, dataOut1, dataOut2, wrap[dowrap]);
  360.92 +                    }
  360.93 +                }
  360.94 +                System.out.print("] ");
  360.95 +            }
  360.96 +            System.out.println();
  360.97 +        }
  360.98 +    }
  360.99 +}
   361.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   361.2 +++ b/test/java/util/zip/TimeChecksum.java	Mon Dec 19 10:06:23 2011 -0800
   361.3 @@ -0,0 +1,205 @@
   361.4 +/*
   361.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   361.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   361.7 + *
   361.8 + * This code is free software; you can redistribute it and/or modify it
   361.9 + * under the terms of the GNU General Public License version 2 only, as
  361.10 + * published by the Free Software Foundation.
  361.11 + *
  361.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  361.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  361.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  361.15 + * version 2 for more details (a copy is included in the LICENSE file that
  361.16 + * accompanied this code).
  361.17 + *
  361.18 + * You should have received a copy of the GNU General Public License version
  361.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  361.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  361.21 + *
  361.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  361.23 + * or visit www.oracle.com if you need additional information or have any
  361.24 + * questions.
  361.25 + */
  361.26 +
  361.27 +
  361.28 +/* @test
  361.29 + * @bug 7109837
  361.30 + * @summary Test Adler32/CRC32.update(ByteBuffer)
  361.31 + */
  361.32 +
  361.33 +import java.util.*;
  361.34 +import java.util.zip.*;
  361.35 +import java.nio.*;
  361.36 +
  361.37 +public class TimeChecksum {
  361.38 +
  361.39 +    static long time(Adler32 adler32, byte[] data, int iters, int len) {
  361.40 +        long start_t = System.nanoTime();
  361.41 +        for (int i = 0; i < iters; i++) {
  361.42 +            adler32.reset();
  361.43 +            adler32.update(data, 0, len);
  361.44 +        }
  361.45 +        long t = System.nanoTime() - start_t;
  361.46 +        System.out.printf("%,12d", t / len);
  361.47 +        return t;
  361.48 +    }
  361.49 +
  361.50 +    static long time(Adler32 adler32, ByteBuffer buf, int iters) {
  361.51 +        long start_t = System.nanoTime();
  361.52 +        for (int i = 0; i < iters; i++) {
  361.53 +            adler32.reset();
  361.54 +            buf.mark();
  361.55 +            adler32.update(buf);
  361.56 +            buf.reset();
  361.57 +        }
  361.58 +        long t = System.nanoTime() - start_t;
  361.59 +        System.out.printf("%,12d", t / buf.remaining());
  361.60 +        return t;
  361.61 +    }
  361.62 +
  361.63 +    static void testPosLimit(Adler32 adler32, ByteBuffer buf) {
  361.64 +        int pos = buf.position();
  361.65 +        int limit = buf.limit();
  361.66 +        adler32.update(buf);
  361.67 +        if (limit != buf.position() || limit != buf.limit()) {
  361.68 +            System.out.printf("%nFAILED: pos,limit=(%d, %d), expected (%d, %d)%n",
  361.69 +                    buf.position(), buf.limit(), limit, limit);
  361.70 +            throw new RuntimeException();
  361.71 +        }
  361.72 +        buf.position(pos);
  361.73 +    }
  361.74 +
  361.75 +    static long time(CRC32 crc32, byte[] data, int iters, int len) {
  361.76 +        long start_t = System.nanoTime();
  361.77 +        for (int i = 0; i < iters; i++) {
  361.78 +            crc32.reset();
  361.79 +            crc32.update(data, 0, len);
  361.80 +        }
  361.81 +        long t = System.nanoTime() - start_t;
  361.82 +        System.out.printf("%,12d", t / len);
  361.83 +        return t;
  361.84 +    }
  361.85 +
  361.86 +    static long time(CRC32 crc32, ByteBuffer buf, int iters) {
  361.87 +        long start_t = System.nanoTime();
  361.88 +        for (int i = 0; i < iters; i++) {
  361.89 +            crc32.reset();
  361.90 +            buf.mark();
  361.91 +            crc32.update(buf);
  361.92 +            buf.reset();
  361.93 +        }
  361.94 +        long t = System.nanoTime() - start_t;
  361.95 +        System.out.printf("%,12d", t / buf.remaining());
  361.96 +        return t;
  361.97 +    }
  361.98 +
  361.99 +    static void testPosLimit(CRC32 crc32, ByteBuffer buf) {
 361.100 +        int pos = buf.position();
 361.101 +        int limit = buf.limit();
 361.102 +        crc32.update(buf);
 361.103 +        if (limit != buf.position() || limit != buf.limit()) {
 361.104 +            System.out.printf("%nFAILED: pos,limit=(%d, %d), expected (%d, %d)%n",
 361.105 +                    buf.position(), buf.limit(), limit, limit);
 361.106 +            throw new RuntimeException();
 361.107 +        }
 361.108 +        buf.position(pos);
 361.109 +    }
 361.110 +
 361.111 +    public static void main(String[] args) {
 361.112 +        int len     = 1024 * 32;
 361.113 +        int iters   = 1;
 361.114 +        if (args.length != 0 && "-benchmark".equals(args[0]))
 361.115 +            iters = 100000;
 361.116 +        Adler32 adler32 = new Adler32();
 361.117 +        CRC32 crc32 = new CRC32();
 361.118 +        Random rdm = new Random();
 361.119 +        byte[] data = new byte[len];
 361.120 +        new Random().nextBytes(data);
 361.121 +        ByteBuffer buf;
 361.122 +
 361.123 +        System.out.println("---------- Adler32 ----------");
 361.124 +        System.out.print("Warmup...");
 361.125 +        time(adler32, data, iters, len);
 361.126 +        time(adler32, ByteBuffer.wrap(data), iters);
 361.127 +        buf = ByteBuffer.allocateDirect(len);
 361.128 +        buf.put(data, 0, len);
 361.129 +        buf.flip();
 361.130 +        time(adler32, buf, iters);
 361.131 +        System.out.println("\n");
 361.132 +
 361.133 +        System.out.println("Length    byte[](ns/len)  ByteBuffer(direct)   ByteBuffer");
 361.134 +        for (int testlen = 1; testlen < data.length; testlen <<= 1) {
 361.135 +            System.out.print(testlen + "\t");
 361.136 +            long baT = time(adler32, data, iters, testlen);
 361.137 +            long baV = adler32.getValue();
 361.138 +            System.out.print("\t");
 361.139 +
 361.140 +            buf = ByteBuffer.allocateDirect(testlen);
 361.141 +            buf.put(data, 0, testlen);
 361.142 +            buf.flip();
 361.143 +            long bbdT = time(adler32, buf, iters);
 361.144 +            long bbdV = adler32.getValue();
 361.145 +            if (baV != bbdV) {
 361.146 +                System.out.printf("%nFAILED: baV=%x,bbdV=%x%n", baV, bbdV);
 361.147 +                throw new RuntimeException();
 361.148 +            }
 361.149 +            System.out.printf(" (%.2f)", (float)bbdT/baT);
 361.150 +            testPosLimit(adler32, buf);
 361.151 +
 361.152 +            buf = ByteBuffer.allocate(testlen);
 361.153 +            buf.put(data, 0, testlen);
 361.154 +            buf.flip();
 361.155 +            long bbT = time(adler32, buf, iters);
 361.156 +            long bbV = adler32.getValue();
 361.157 +            if (baV != bbV) {
 361.158 +                System.out.printf("%nFAILED: baV=%x,bbV=%x%n", baV, bbV);
 361.159 +                throw new RuntimeException();
 361.160 +            }
 361.161 +            testPosLimit(adler32, buf);
 361.162 +            System.out.printf(" (%.2f)     checksum=%x%n", (float)bbT/baT, bbV);
 361.163 +        }
 361.164 +
 361.165 +        System.out.println("\n---------- CRC32 ----------");
 361.166 +        System.out.print("Warmup...");
 361.167 +        time(crc32, data, iters, len);
 361.168 +        time(crc32, ByteBuffer.wrap(data), iters);
 361.169 +        buf = ByteBuffer.allocateDirect(len);
 361.170 +        buf.put(data, 0, len);
 361.171 +        buf.flip();
 361.172 +        time(crc32, buf, iters);
 361.173 +        System.out.println("\n");
 361.174 +
 361.175 +
 361.176 +        System.out.println("Length    byte[](ns/len)  ByteBuffer(direct)   ByteBuffer");
 361.177 +        for (int testlen = 1; testlen < data.length; testlen <<= 1) {
 361.178 +            System.out.print(testlen + "\t");
 361.179 +            long baT = time(crc32, data, iters, testlen);
 361.180 +            long baV = crc32.getValue();
 361.181 +            System.out.print("\t");
 361.182 +
 361.183 +            buf = ByteBuffer.allocateDirect(testlen);
 361.184 +            buf.put(data, 0,  testlen);
 361.185 +            buf.flip();
 361.186 +            long bbdT = time(crc32, buf, iters);
 361.187 +            long bbdV = crc32.getValue();
 361.188 +            if (baV != bbdV) {
 361.189 +                System.out.printf("%nFAILED: baV=%x,bbdV=%x%n", baV, bbdV);
 361.190 +                throw new RuntimeException();
 361.191 +            }
 361.192 +            System.out.printf(" (%.2f)", (float)bbdT/baT);
 361.193 +            testPosLimit(crc32, buf);
 361.194 +
 361.195 +            buf = ByteBuffer.allocate(testlen);
 361.196 +            buf.put(data, 0, testlen);
 361.197 +            buf.flip();
 361.198 +            long bbT = time(crc32, buf, iters);
 361.199 +            long bbV = crc32.getValue();
 361.200 +            if (baV != bbV) {
 361.201 +                System.out.printf("%nFAILED: baV=%x,bbV=%x%n", baV, bbV);
 361.202 +                throw new RuntimeException();
 361.203 +            }
 361.204 +            testPosLimit(crc32, buf);
 361.205 +            System.out.printf(" (%.2f)     checksum=%x%n", (float)bbT / baT, bbV);
 361.206 +        }
 361.207 +    }
 361.208 +}
   362.1 --- a/test/java/util/zip/ZipFile/ClearStaleZipFileInputStreams.java	Tue Dec 06 16:31:58 2011 -0800
   362.2 +++ b/test/java/util/zip/ZipFile/ClearStaleZipFileInputStreams.java	Mon Dec 19 10:06:23 2011 -0800
   362.3 @@ -63,11 +63,9 @@
   362.4              File.createTempFile("test-data" + compression, ".zip");
   362.5          tempZipFile.deleteOnExit();
   362.6  
   362.7 -        ZipOutputStream zos =
   362.8 -            new ZipOutputStream(new FileOutputStream(tempZipFile));
   362.9 -        zos.setLevel(compression);
  362.10 -
  362.11 -        try {
  362.12 +        try (FileOutputStream fos = new FileOutputStream(tempZipFile);
  362.13 +                ZipOutputStream zos = new ZipOutputStream(fos)) {
  362.14 +            zos.setLevel(compression);
  362.15              for (int i = 0; i < ZIP_ENTRY_NUM; i++) {
  362.16                  String text = "Entry" + i;
  362.17                  ZipEntry entry = new ZipEntry(text);
  362.18 @@ -78,33 +76,47 @@
  362.19                      zos.closeEntry();
  362.20                  }
  362.21              }
  362.22 -        } finally {
  362.23 -            zos.close();
  362.24          }
  362.25  
  362.26          return tempZipFile;
  362.27      }
  362.28  
  362.29 -    private static void startGcInducingThread(final int sleepMillis) {
  362.30 -        final Thread gcInducingThread = new Thread() {
  362.31 -            public void run() {
  362.32 -                while (true) {
  362.33 -                    System.gc();
  362.34 -                    try {
  362.35 -                        Thread.sleep(sleepMillis);
  362.36 -                    } catch (InterruptedException e) { }
  362.37 +    private static final class GcInducingThread extends Thread {
  362.38 +        private final int sleepMillis;
  362.39 +        private boolean keepRunning = true;
  362.40 +
  362.41 +        public GcInducingThread(final int sleepMillis) {
  362.42 +            this.sleepMillis = sleepMillis;
  362.43 +        }
  362.44 +
  362.45 +        public synchronized void run() {
  362.46 +            while (keepRunning) {
  362.47 +                System.gc();
  362.48 +                try {
  362.49 +                    wait(sleepMillis);
  362.50 +                } catch (InterruptedException e) {
  362.51 +                    System.out.println("GCing thread unexpectedly interrupted");
  362.52 +                    return;
  362.53                  }
  362.54              }
  362.55 -        };
  362.56 +        }
  362.57  
  362.58 -        gcInducingThread.setDaemon(true);
  362.59 -        gcInducingThread.start();
  362.60 +        public synchronized void shutDown() {
  362.61 +            keepRunning = false;
  362.62 +            notifyAll();
  362.63 +        }
  362.64      }
  362.65  
  362.66      public static void main(String[] args) throws Exception {
  362.67 -        startGcInducingThread(500);
  362.68 -        runTest(ZipOutputStream.DEFLATED);
  362.69 -        runTest(ZipOutputStream.STORED);
  362.70 +        GcInducingThread gcThread = new GcInducingThread(500);
  362.71 +        gcThread.start();
  362.72 +        try {
  362.73 +            runTest(ZipOutputStream.DEFLATED);
  362.74 +            runTest(ZipOutputStream.STORED);
  362.75 +        } finally {
  362.76 +            gcThread.shutDown();
  362.77 +            gcThread.join();
  362.78 +        }
  362.79      }
  362.80  
  362.81      private static void runTest(int compression) throws Exception {
  362.82 @@ -113,21 +125,16 @@
  362.83          System.out.println("Testing with a zip file with compression level = "
  362.84                  + compression);
  362.85          File f = createTestFile(compression);
  362.86 -        try {
  362.87 -            ZipFile zf = new ZipFile(f);
  362.88 -            try {
  362.89 -                Set<Object> refSet = createTransientInputStreams(zf, rq);
  362.90 +        try (ZipFile zf = new ZipFile(f)) {
  362.91 +            Set<Object> refSet = createTransientInputStreams(zf, rq);
  362.92  
  362.93 -                System.out.println("Waiting for 'stale' input streams from ZipFile to be GC'd ...");
  362.94 -                System.out.println("(The test will hang on failure)");
  362.95 -                while (false == refSet.isEmpty()) {
  362.96 -                    refSet.remove(rq.remove());
  362.97 -                }
  362.98 -                System.out.println("Test PASSED.");
  362.99 -                System.out.println();
 362.100 -            } finally {
 362.101 -                zf.close();
 362.102 +            System.out.println("Waiting for 'stale' input streams from ZipFile to be GC'd ...");
 362.103 +            System.out.println("(The test will hang on failure)");
 362.104 +            while (false == refSet.isEmpty()) {
 362.105 +                refSet.remove(rq.remove());
 362.106              }
 362.107 +            System.out.println("Test PASSED.");
 362.108 +            System.out.println();
 362.109          } finally {
 362.110              f.delete();
 362.111          }
   363.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   363.2 +++ b/test/javax/swing/JScrollBar/4865918/bug4865918.java	Mon Dec 19 10:06:23 2011 -0800
   363.3 @@ -0,0 +1,116 @@
   363.4 +/*
   363.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   363.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   363.7 + *
   363.8 + * This code is free software; you can redistribute it and/or modify it
   363.9 + * under the terms of the GNU General Public License version 2 only, as
  363.10 + * published by the Free Software Foundation.
  363.11 + *
  363.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  363.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  363.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  363.15 + * version 2 for more details (a copy is included in the LICENSE file that
  363.16 + * accompanied this code).
  363.17 + *
  363.18 + * You should have received a copy of the GNU General Public License version
  363.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  363.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  363.21 + *
  363.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  363.23 + * or visit www.oracle.com if you need additional information or have any
  363.24 + * questions.
  363.25 + */
  363.26 +
  363.27 +/*
  363.28 + * @test
  363.29 + * @bug 4865918
  363.30 + * @summary REGRESSION:JCK1.4a-runtime api/javax_swing/interactive/JScrollBarTests.html#JScrollBar
  363.31 + * @author Andrey Pikalev
  363.32 + * @run main bug4865918
  363.33 + */
  363.34 +
  363.35 +import javax.swing.*;
  363.36 +import java.awt.*;
  363.37 +import java.awt.event.*;
  363.38 +import java.util.*;
  363.39 +import sun.awt.SunToolkit;
  363.40 +
  363.41 +public class bug4865918 {
  363.42 +
  363.43 +    private static TestScrollBar sbar;
  363.44 +
  363.45 +    public static void main(String[] argv) throws Exception {
  363.46 +        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
  363.47 +
  363.48 +        SwingUtilities.invokeAndWait(new Runnable() {
  363.49 +
  363.50 +            public void run() {
  363.51 +                createAndShowGUI();
  363.52 +            }
  363.53 +        });
  363.54 +
  363.55 +        toolkit.realSync();
  363.56 +
  363.57 +        SwingUtilities.invokeAndWait(new Runnable() {
  363.58 +
  363.59 +            @Override
  363.60 +            public void run() {
  363.61 +                sbar.pressMouse();
  363.62 +            }
  363.63 +        });
  363.64 +
  363.65 +        toolkit.realSync();
  363.66 +
  363.67 +        int value = getValue();
  363.68 +
  363.69 +        if (value != 9) {
  363.70 +            throw new Error("The scrollbar block increment is incorect");
  363.71 +        }
  363.72 +    }
  363.73 +
  363.74 +    private static int getValue() throws Exception {
  363.75 +        final int[] result = new int[1];
  363.76 +
  363.77 +        SwingUtilities.invokeAndWait(new Runnable() {
  363.78 +            @Override
  363.79 +            public void run() {
  363.80 +                result[0] = sbar.getValue();
  363.81 +            }
  363.82 +        });
  363.83 +
  363.84 +        return result[0];
  363.85 +    }
  363.86 +
  363.87 +    private static void createAndShowGUI() {
  363.88 +        JFrame frame = new JFrame("bug4865918");
  363.89 +        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  363.90 +
  363.91 +        sbar = new TestScrollBar(JScrollBar.HORIZONTAL, -1, 10, -100, 100);
  363.92 +        sbar.setPreferredSize(new Dimension(200, 20));
  363.93 +        sbar.setBlockIncrement(10);
  363.94 +
  363.95 +        frame.getContentPane().add(sbar);
  363.96 +        frame.pack();
  363.97 +        frame.setVisible(true);
  363.98 +
  363.99 +    }
 363.100 +
 363.101 +    static class TestScrollBar extends JScrollBar {
 363.102 +
 363.103 +        public TestScrollBar(int orientation, int value, int extent,
 363.104 +                int min, int max) {
 363.105 +            super(orientation, value, extent, min, max);
 363.106 +
 363.107 +        }
 363.108 +
 363.109 +        public void pressMouse() {
 363.110 +            MouseEvent me = new MouseEvent(sbar,
 363.111 +                    MouseEvent.MOUSE_PRESSED,
 363.112 +                    (new Date()).getTime(),
 363.113 +                    MouseEvent.BUTTON1_MASK,
 363.114 +                    3 * getWidth() / 4, getHeight() / 2,
 363.115 +                    1, true);
 363.116 +            processMouseEvent(me);
 363.117 +        }
 363.118 +    }
 363.119 +}
   364.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   364.2 +++ b/test/javax/swing/JTabbedPane/4624207/bug4624207.java	Mon Dec 19 10:06:23 2011 -0800
   364.3 @@ -0,0 +1,131 @@
   364.4 +/*
   364.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   364.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   364.7 + *
   364.8 + * This code is free software; you can redistribute it and/or modify it
   364.9 + * under the terms of the GNU General Public License version 2 only, as
  364.10 + * published by the Free Software Foundation.
  364.11 + *
  364.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  364.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  364.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  364.15 + * version 2 for more details (a copy is included in the LICENSE file that
  364.16 + * accompanied this code).
  364.17 + *
  364.18 + * You should have received a copy of the GNU General Public License version
  364.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  364.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  364.21 + *
  364.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  364.23 + * or visit www.oracle.com if you need additional information or have any
  364.24 + * questions.
  364.25 + */
  364.26 +
  364.27 +/*
  364.28 + * @test
  364.29 + * @bug 4624207
  364.30 + * @summary JTabbedPane mnemonics don't work from outside the tabbed pane
  364.31 + * @author Oleg Mokhovikov
  364.32 + * @library ../../regtesthelpers
  364.33 + * @build Util
  364.34 + * @run main bug4624207
  364.35 + */
  364.36 +import javax.swing.*;
  364.37 +import javax.swing.event.ChangeEvent;
  364.38 +import javax.swing.event.ChangeListener;
  364.39 +import java.awt.*;
  364.40 +import java.awt.event.FocusEvent;
  364.41 +import java.awt.event.FocusListener;
  364.42 +import java.awt.event.KeyEvent;
  364.43 +import sun.awt.SunToolkit;
  364.44 +
  364.45 +public class bug4624207 implements ChangeListener, FocusListener {
  364.46 +
  364.47 +    private static volatile boolean stateChanged = false;
  364.48 +    private static volatile boolean focusGained = false;
  364.49 +    private static JTextField txtField;
  364.50 +    private static JTabbedPane tab;
  364.51 +    private static Object listener;
  364.52 +
  364.53 +    public void stateChanged(ChangeEvent e) {
  364.54 +        System.out.println("stateChanged called");
  364.55 +        stateChanged = true;
  364.56 +    }
  364.57 +
  364.58 +    public void focusGained(FocusEvent e) {
  364.59 +        System.out.println("focusGained called");
  364.60 +        focusGained = true;
  364.61 +    }
  364.62 +
  364.63 +    public void focusLost(FocusEvent e) {
  364.64 +        System.out.println("focusLost called");
  364.65 +        focusGained = false;
  364.66 +    }
  364.67 +
  364.68 +    public static void main(String[] args) throws Exception {
  364.69 +        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
  364.70 +        Robot robot = new Robot();
  364.71 +        robot.setAutoDelay(50);
  364.72 +
  364.73 +        SwingUtilities.invokeAndWait(new Runnable() {
  364.74 +
  364.75 +            public void run() {
  364.76 +                createAndShowGUI();
  364.77 +            }
  364.78 +        });
  364.79 +
  364.80 +        toolkit.realSync();
  364.81 +
  364.82 +        SwingUtilities.invokeAndWait(new Runnable() {
  364.83 +
  364.84 +            public void run() {
  364.85 +                txtField.requestFocus();
  364.86 +            }
  364.87 +        });
  364.88 +
  364.89 +        toolkit.realSync();
  364.90 +
  364.91 +        if (!focusGained) {
  364.92 +            throw new RuntimeException("Couldn't gain focus for text field");
  364.93 +        }
  364.94 +
  364.95 +        SwingUtilities.invokeAndWait(new Runnable() {
  364.96 +
  364.97 +            public void run() {
  364.98 +                tab.addChangeListener((ChangeListener) listener);
  364.99 +                txtField.removeFocusListener((FocusListener) listener);
 364.100 +            }
 364.101 +        });
 364.102 +
 364.103 +        toolkit.realSync();
 364.104 +
 364.105 +        if ("Aqua".equals(UIManager.getLookAndFeel().getID())) {
 364.106 +            Util.hitKeys(robot, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT, KeyEvent.VK_B);
 364.107 +        } else {
 364.108 +            Util.hitKeys(robot, KeyEvent.VK_ALT, KeyEvent.VK_B);
 364.109 +        }
 364.110 +
 364.111 +        toolkit.realSync();
 364.112 +
 364.113 +        if (!stateChanged || tab.getSelectedIndex() != 1) {
 364.114 +            throw new RuntimeException("JTabbedPane mnemonics don't work from outside the tabbed pane");
 364.115 +        }
 364.116 +    }
 364.117 +
 364.118 +    private static void createAndShowGUI() {
 364.119 +        tab = new JTabbedPane();
 364.120 +        tab.add("Tab1", new JButton("Button1"));
 364.121 +        tab.add("Tab2", new JButton("Button2"));
 364.122 +        tab.setMnemonicAt(0, KeyEvent.VK_T);
 364.123 +        tab.setMnemonicAt(1, KeyEvent.VK_B);
 364.124 +
 364.125 +        JFrame frame = new JFrame();
 364.126 +        frame.getContentPane().add(tab, BorderLayout.CENTER);
 364.127 +        txtField = new JTextField();
 364.128 +        frame.getContentPane().add(txtField, BorderLayout.NORTH);
 364.129 +        listener = new bug4624207();
 364.130 +        txtField.addFocusListener((FocusListener) listener);
 364.131 +        frame.pack();
 364.132 +        frame.setVisible(true);
 364.133 +    }
 364.134 +}
   365.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   365.2 +++ b/test/javax/swing/JTable/6263446/bug6263446.java	Mon Dec 19 10:06:23 2011 -0800
   365.3 @@ -0,0 +1,242 @@
   365.4 +/*
   365.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   365.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   365.7 + *
   365.8 + * This code is free software; you can redistribute it and/or modify it
   365.9 + * under the terms of the GNU General Public License version 2 only, as
  365.10 + * published by the Free Software Foundation.
  365.11 + *
  365.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  365.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  365.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  365.15 + * version 2 for more details (a copy is included in the LICENSE file that
  365.16 + * accompanied this code).
  365.17 + *
  365.18 + * You should have received a copy of the GNU General Public License version
  365.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  365.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  365.21 + *
  365.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  365.23 + * or visit www.oracle.com if you need additional information or have any
  365.24 + * questions.
  365.25 + */
  365.26 +
  365.27 +/*
  365.28 + * @test
  365.29 + * @bug 6263446
  365.30 + * @summary Tests that double-clicking to edit a cell doesn't select the content.
  365.31 + * @author Shannon Hickey
  365.32 + * @run main bug6263446
  365.33 + */
  365.34 +import java.awt.*;
  365.35 +import java.awt.event.*;
  365.36 +import javax.swing.*;
  365.37 +import javax.swing.table.*;
  365.38 +import sun.awt.SunToolkit;
  365.39 +
  365.40 +public class bug6263446 {
  365.41 +
  365.42 +    private static JTable table;
  365.43 +    private static final String FIRST = "AAAAA";
  365.44 +    private static final String SECOND = "BB";
  365.45 +    private static final String ALL = FIRST + " " + SECOND;
  365.46 +    private static Robot robot;
  365.47 +
  365.48 +    public static void main(String[] args) throws Exception {
  365.49 +        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
  365.50 +        robot = new Robot();
  365.51 +        robot.setAutoDelay(50);
  365.52 +
  365.53 +        SwingUtilities.invokeAndWait(new Runnable() {
  365.54 +
  365.55 +            public void run() {
  365.56 +                createAndShowGUI();
  365.57 +            }
  365.58 +        });
  365.59 +
  365.60 +
  365.61 +        toolkit.realSync();
  365.62 +
  365.63 +        Point point = getClickPoint();
  365.64 +        robot.mouseMove(point.x, point.y);
  365.65 +        toolkit.realSync();
  365.66 +
  365.67 +        click(1);
  365.68 +        toolkit.realSync();
  365.69 +        assertEditing(false);
  365.70 +
  365.71 +        click(2);
  365.72 +        toolkit.realSync();
  365.73 +        checkSelectedText(null);
  365.74 +
  365.75 +        click(3);
  365.76 +        toolkit.realSync();
  365.77 +        checkSelectedText(FIRST);
  365.78 +
  365.79 +
  365.80 +        click(4);
  365.81 +        toolkit.realSync();
  365.82 +        checkSelectedText(ALL);
  365.83 +
  365.84 +        setClickCountToStart(1);
  365.85 +
  365.86 +        click(1);
  365.87 +        toolkit.realSync();
  365.88 +        checkSelectedText(null);
  365.89 +
  365.90 +        click(2);
  365.91 +        toolkit.realSync();
  365.92 +        checkSelectedText(FIRST);
  365.93 +
  365.94 +        click(3);
  365.95 +        toolkit.realSync();
  365.96 +        checkSelectedText(ALL);
  365.97 +
  365.98 +        setClickCountToStart(3);
  365.99 +
 365.100 +        click(1);
 365.101 +        toolkit.realSync();
 365.102 +        assertEditing(false);
 365.103 +
 365.104 +        click(2);
 365.105 +        toolkit.realSync();
 365.106 +        assertEditing(false);
 365.107 +
 365.108 +        click(3);
 365.109 +        toolkit.realSync();
 365.110 +        checkSelectedText(null);
 365.111 +
 365.112 +        click(4);
 365.113 +        toolkit.realSync();
 365.114 +        checkSelectedText(FIRST);
 365.115 +
 365.116 +        click(5);
 365.117 +        toolkit.realSync();
 365.118 +        checkSelectedText(ALL);
 365.119 +
 365.120 +
 365.121 +        SwingUtilities.invokeAndWait(new Runnable() {
 365.122 +
 365.123 +            @Override
 365.124 +            public void run() {
 365.125 +                table.editCellAt(0, 0);
 365.126 +            }
 365.127 +        });
 365.128 +
 365.129 +        toolkit.realSync();
 365.130 +        assertEditing(true);
 365.131 +
 365.132 +        click(2);
 365.133 +        toolkit.realSync();
 365.134 +        checkSelectedText(FIRST);
 365.135 +
 365.136 +    }
 365.137 +
 365.138 +    private static void checkSelectedText(String sel) throws Exception {
 365.139 +        assertEditing(true);
 365.140 +        checkSelection(sel);
 365.141 +        cancelCellEditing();
 365.142 +        assertEditing(false);
 365.143 +    }
 365.144 +
 365.145 +    private static void setClickCountToStart(final int clicks) throws Exception {
 365.146 +        SwingUtilities.invokeAndWait(new Runnable() {
 365.147 +
 365.148 +            @Override
 365.149 +            public void run() {
 365.150 +                DefaultCellEditor editor =
 365.151 +                        (DefaultCellEditor) table.getDefaultEditor(String.class);
 365.152 +                editor.setClickCountToStart(clicks);
 365.153 +            }
 365.154 +        });
 365.155 +
 365.156 +    }
 365.157 +
 365.158 +    private static void cancelCellEditing() throws Exception {
 365.159 +        SwingUtilities.invokeAndWait(new Runnable() {
 365.160 +
 365.161 +            @Override
 365.162 +            public void run() {
 365.163 +                table.getCellEditor().cancelCellEditing();
 365.164 +            }
 365.165 +        });
 365.166 +    }
 365.167 +
 365.168 +    private static void checkSelection(final String sel) throws Exception {
 365.169 +        SwingUtilities.invokeAndWait(new Runnable() {
 365.170 +
 365.171 +            @Override
 365.172 +            public void run() {
 365.173 +                DefaultCellEditor editor =
 365.174 +                        (DefaultCellEditor) table.getDefaultEditor(String.class);
 365.175 +                JTextField field = (JTextField) editor.getComponent();
 365.176 +                String text = field.getSelectedText();
 365.177 +                if (sel == null) {
 365.178 +                    if (text != null && text.length() != 0) {
 365.179 +                        throw new RuntimeException("Nothing should be selected,"
 365.180 +                                + " but \"" + text + "\" is selected.");
 365.181 +                    }
 365.182 +                } else if (!sel.equals(text)) {
 365.183 +                    throw new RuntimeException("\"" + sel + "\" should be "
 365.184 +                            + "selected, but \"" + text + "\" is selected.");
 365.185 +                }
 365.186 +            }
 365.187 +        });
 365.188 +    }
 365.189 +
 365.190 +    private static void assertEditing(final boolean editing) throws Exception {
 365.191 +        SwingUtilities.invokeAndWait(new Runnable() {
 365.192 +
 365.193 +            @Override
 365.194 +            public void run() {
 365.195 +                if (editing && !table.isEditing()) {
 365.196 +                    throw new RuntimeException("Table should be editing");
 365.197 +                }
 365.198 +                if (!editing && table.isEditing()) {
 365.199 +                    throw new RuntimeException("Table should not be editing");
 365.200 +                }
 365.201 +            }
 365.202 +        });
 365.203 +    }
 365.204 +
 365.205 +    private static Point getClickPoint() throws Exception {
 365.206 +        final Point[] result = new Point[1];
 365.207 +        SwingUtilities.invokeAndWait(new Runnable() {
 365.208 +
 365.209 +            @Override
 365.210 +            public void run() {
 365.211 +                Rectangle rect = table.getCellRect(0, 0, false);
 365.212 +                Point point = new Point(rect.x + rect.width / 5,
 365.213 +                        rect.y + rect.height / 2);
 365.214 +                SwingUtilities.convertPointToScreen(point, table);
 365.215 +                result[0] = point;
 365.216 +            }
 365.217 +        });
 365.218 +
 365.219 +        return result[0];
 365.220 +    }
 365.221 +
 365.222 +    private static void click(int times) {
 365.223 +        robot.delay(500);
 365.224 +        for (int i = 0; i < times; i++) {
 365.225 +            robot.mousePress(InputEvent.BUTTON1_MASK);
 365.226 +            robot.mouseRelease(InputEvent.BUTTON1_MASK);
 365.227 +        }
 365.228 +    }
 365.229 +
 365.230 +    private static TableModel createTableModel() {
 365.231 +        String[] columnNames = {"Column 0"};
 365.232 +        String[][] data = {{ALL}};
 365.233 +
 365.234 +        return new DefaultTableModel(data, columnNames);
 365.235 +    }
 365.236 +
 365.237 +    private static void createAndShowGUI() {
 365.238 +        JFrame frame = new JFrame("bug6263446");
 365.239 +        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 365.240 +        table = new JTable(createTableModel());
 365.241 +        frame.add(table);
 365.242 +        frame.pack();
 365.243 +        frame.setVisible(true);
 365.244 +    }
 365.245 +}
   366.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   366.2 +++ b/test/javax/swing/PopupFactory/6276087/NonOpaquePopupMenuTest.java	Mon Dec 19 10:06:23 2011 -0800
   366.3 @@ -0,0 +1,114 @@
   366.4 +/*
   366.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   366.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   366.7 + *
   366.8 + * This code is free software; you can redistribute it and/or modify it
   366.9 + * under the terms of the GNU General Public License version 2 only, as
  366.10 + * published by the Free Software Foundation.
  366.11 + *
  366.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  366.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  366.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  366.15 + * version 2 for more details (a copy is included in the LICENSE file that
  366.16 + * accompanied this code).
  366.17 + *
  366.18 + * You should have received a copy of the GNU General Public License version
  366.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  366.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  366.21 + *
  366.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  366.23 + * or visit www.oracle.com if you need additional information or have any
  366.24 + * questions.
  366.25 + */
  366.26 +
  366.27 +/**
  366.28 + * @test
  366.29 + * @bug 6276087
  366.30 + * @author Romain Guy
  366.31 + * @summary Tests opacity of a popup menu.
  366.32 + */
  366.33 +import java.awt.*;
  366.34 +import java.awt.event.*;
  366.35 +
  366.36 +import javax.swing.*;
  366.37 +import sun.awt.SunToolkit;
  366.38 +
  366.39 +public class NonOpaquePopupMenuTest extends JFrame {
  366.40 +
  366.41 +    private static JMenu fileMenu;
  366.42 +
  366.43 +    public NonOpaquePopupMenuTest() {
  366.44 +        getContentPane().setBackground(java.awt.Color.RED);
  366.45 +        JMenuBar menuBar = new JMenuBar();
  366.46 +        fileMenu = new JMenu("File");
  366.47 +        JMenuItem menuItem = new JMenuItem("New");
  366.48 +        menuBar.add(fileMenu);
  366.49 +        setJMenuBar(menuBar);
  366.50 +
  366.51 +        fileMenu.add(menuItem);
  366.52 +        fileMenu.getPopupMenu().setOpaque(false);
  366.53 +
  366.54 +        setSize(new Dimension(640, 480));
  366.55 +        setVisible(true);
  366.56 +    }
  366.57 +
  366.58 +    public static void main(String[] args) throws Throwable {
  366.59 +        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
  366.60 +        Robot robot = new Robot();
  366.61 +        robot.setAutoDelay(250);
  366.62 +
  366.63 +        SwingUtilities.invokeAndWait(new Runnable() {
  366.64 +
  366.65 +            @Override
  366.66 +            public void run() {
  366.67 +                new NonOpaquePopupMenuTest();
  366.68 +            }
  366.69 +        });
  366.70 +
  366.71 +        toolkit.realSync();
  366.72 +
  366.73 +        Point p = getMenuClickPoint();
  366.74 +        robot.mouseMove(p.x, p.y);
  366.75 +        robot.mousePress(InputEvent.BUTTON1_MASK);
  366.76 +
  366.77 +        toolkit.realSync();
  366.78 +
  366.79 +        if (isParentOpaque()) {
  366.80 +            throw new RuntimeException("Popup menu parent is opaque");
  366.81 +        }
  366.82 +
  366.83 +    }
  366.84 +
  366.85 +    private static boolean isParentOpaque() throws Exception {
  366.86 +        final boolean result[] = new boolean[1];
  366.87 +
  366.88 +        SwingUtilities.invokeAndWait(new Runnable() {
  366.89 +
  366.90 +            @Override
  366.91 +            public void run() {
  366.92 +                result[0] = fileMenu.getPopupMenu().getParent().isOpaque();
  366.93 +            }
  366.94 +        });
  366.95 +
  366.96 +        return result[0];
  366.97 +    }
  366.98 +
  366.99 +    private static Point getMenuClickPoint() throws Exception {
 366.100 +        final Point[] result = new Point[1];
 366.101 +
 366.102 +        SwingUtilities.invokeAndWait(new Runnable() {
 366.103 +
 366.104 +            @Override
 366.105 +            public void run() {
 366.106 +                Point p = fileMenu.getLocationOnScreen();
 366.107 +                Dimension size = fileMenu.getSize();
 366.108 +
 366.109 +                result[0] = new Point(p.x + size.width / 2,
 366.110 +                        p.y + size.height / 2);
 366.111 +            }
 366.112 +        });
 366.113 +
 366.114 +        return result[0];
 366.115 +
 366.116 +    }
 366.117 +}
   367.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   367.2 +++ b/test/javax/swing/plaf/metal/MetalLookAndFeel/5073047/bug5073047.java	Mon Dec 19 10:06:23 2011 -0800
   367.3 @@ -0,0 +1,53 @@
   367.4 +/*
   367.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   367.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   367.7 + *
   367.8 + * This code is free software; you can redistribute it and/or modify it
   367.9 + * under the terms of the GNU General Public License version 2 only, as
  367.10 + * published by the Free Software Foundation.
  367.11 + *
  367.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  367.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  367.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  367.15 + * version 2 for more details (a copy is included in the LICENSE file that
  367.16 + * accompanied this code).
  367.17 + *
  367.18 + * You should have received a copy of the GNU General Public License version
  367.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  367.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  367.21 + *
  367.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  367.23 + * or visit www.oracle.com if you need additional information or have any
  367.24 + * questions.
  367.25 + */
  367.26 +
  367.27 +/*
  367.28 + * @test
  367.29 + * @bug 5073407
  367.30 + * @summary Tests 5073407
  367.31 + * @author Scott Violet
  367.32 + */
  367.33 +
  367.34 +import javax.swing.*;
  367.35 +import javax.swing.plaf.*;
  367.36 +import javax.swing.plaf.metal.*;
  367.37 +
  367.38 +public class bug5073047 {
  367.39 +
  367.40 +    public static void main(String[] args) throws Exception{
  367.41 +        MyTheme theme = new MyTheme();
  367.42 +        MetalLookAndFeel.setCurrentTheme(theme);
  367.43 +        UIManager.setLookAndFeel(new MetalLookAndFeel());
  367.44 +        if (UIManager.get("Button.font") != theme.ctf) {
  367.45 +            throw new RuntimeException("Unexpected font");
  367.46 +        }
  367.47 +    }
  367.48 +
  367.49 +    private static class MyTheme extends DefaultMetalTheme {
  367.50 +        public final FontUIResource ctf = new FontUIResource(
  367.51 +                super.getControlTextFont().deriveFont(40.0f));
  367.52 +        public FontUIResource getControlTextFont() {
  367.53 +            return ctf;
  367.54 +        }
  367.55 +    }
  367.56 +}
   368.1 --- a/test/javax/swing/regtesthelpers/Util.java	Tue Dec 06 16:31:58 2011 -0800
   368.2 +++ b/test/javax/swing/regtesthelpers/Util.java	Mon Dec 19 10:06:23 2011 -0800
   368.3 @@ -140,4 +140,17 @@
   368.4  
   368.5          return null;
   368.6      }
   368.7 +
   368.8 +     /**
   368.9 +     * Hits keys by robot.
  368.10 +     */
  368.11 +    public static void hitKeys(Robot robot, int... keys) {
  368.12 +        for (int i = 0; i < keys.length; i++) {
  368.13 +            robot.keyPress(keys[i]);
  368.14 +        }
  368.15 +
  368.16 +        for (int i = keys.length - 1; i >= 0; i--) {
  368.17 +            robot.keyRelease(keys[i]);
  368.18 +        }
  368.19 +    }
  368.20  }
   369.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   369.2 +++ b/test/javax/swing/text/DefaultCaret/6938583/bug6938583.java	Mon Dec 19 10:06:23 2011 -0800
   369.3 @@ -0,0 +1,51 @@
   369.4 +/*
   369.5 + * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
   369.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   369.7 + *
   369.8 + * This code is free software; you can redistribute it and/or modify it
   369.9 + * under the terms of the GNU General Public License version 2 only, as
  369.10 + * published by the Free Software Foundation.
  369.11 + *
  369.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  369.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  369.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  369.15 + * version 2 for more details (a copy is included in the LICENSE file that
  369.16 + * accompanied this code).
  369.17 + *
  369.18 + * You should have received a copy of the GNU General Public License version
  369.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  369.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  369.21 + *
  369.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  369.23 + * or visit www.oracle.com if you need additional information or have any
  369.24 + * questions.
  369.25 + */
  369.26 +
  369.27 +/*
  369.28 + * Portions Copyright (c) 2011 IBM Corporation
  369.29 + */
  369.30 +
  369.31 +/*
  369.32 + * @test
  369.33 + * @bug 6938583
  369.34 + * @summary Unexpected NullPointerException when use CodeIM demo on windows
  369.35 + * @author LittleE
  369.36 + */
  369.37 +
  369.38 +import javax.swing.*;
  369.39 +import javax.swing.text.DefaultCaret;
  369.40 +import java.awt.event.MouseEvent;
  369.41 +
  369.42 +public class bug6938583 {
  369.43 +    public static void main(String[] args) throws Exception {
  369.44 +        SwingUtilities.invokeAndWait(new Runnable() {
  369.45 +            public void run() {
  369.46 +                JTextArea jta = new JTextArea();
  369.47 +                DefaultCaret dc = new DefaultCaret();
  369.48 +                jta.setCaret(dc);
  369.49 +                dc.deinstall(jta);
  369.50 +                dc.mouseClicked(new MouseEvent(jta, MouseEvent.MOUSE_CLICKED, 0, 0, 0, 0, 0, false));
  369.51 +            }
  369.52 +        });
  369.53 +    }
  369.54 +}
   370.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   370.2 +++ b/test/javax/swing/text/DefaultEditorKit/4278839/bug4278839.java	Mon Dec 19 10:06:23 2011 -0800
   370.3 @@ -0,0 +1,154 @@
   370.4 +/*
   370.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   370.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   370.7 + *
   370.8 + * This code is free software; you can redistribute it and/or modify it
   370.9 + * under the terms of the GNU General Public License version 2 only, as
  370.10 + * published by the Free Software Foundation.
  370.11 + *
  370.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  370.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  370.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  370.15 + * version 2 for more details (a copy is included in the LICENSE file that
  370.16 + * accompanied this code).
  370.17 + *
  370.18 + * You should have received a copy of the GNU General Public License version
  370.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  370.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  370.21 + *
  370.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  370.23 + * or visit www.oracle.com if you need additional information or have any
  370.24 + * questions.
  370.25 + */
  370.26 +
  370.27 +/* @test Jan 16, 2003
  370.28 + * @bug 4278839
  370.29 + * @summary Incorrect cursor movement between words at the end of line
  370.30 + * @author Anton Nashatyrev
  370.31 + * @library ../../../regtesthelpers
  370.32 + * @build Util
  370.33 + * @run main bug4278839
  370.34 + */
  370.35 +
  370.36 +import java.awt.*;
  370.37 +import java.awt.event.*;
  370.38 +import javax.swing.*;
  370.39 +import sun.awt.SunToolkit;
  370.40 +
  370.41 +public class bug4278839 extends JFrame {
  370.42 +
  370.43 +    private static boolean passed = true;
  370.44 +    private static JTextArea area;
  370.45 +    private static Robot robo;
  370.46 +    private static SunToolkit toolkit;
  370.47 +
  370.48 +    public static void main(String[] args) {
  370.49 +        try {
  370.50 +
  370.51 +            toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
  370.52 +            robo = new Robot();
  370.53 +            robo.setAutoDelay(100);
  370.54 +
  370.55 +            SwingUtilities.invokeAndWait(new Runnable() {
  370.56 +                @Override
  370.57 +                public void run() {
  370.58 +                    createAndShowGUI();
  370.59 +                }
  370.60 +            });
  370.61 +
  370.62 +            toolkit.realSync();
  370.63 +
  370.64 +            clickMouse();
  370.65 +            toolkit.realSync();
  370.66 +
  370.67 +
  370.68 +            if ("Aqua".equals(UIManager.getLookAndFeel().getID())) {
  370.69 +                Util.hitKeys(robo, KeyEvent.VK_HOME);
  370.70 +            } else {
  370.71 +                Util.hitKeys(robo, KeyEvent.VK_CONTROL, KeyEvent.VK_HOME);
  370.72 +            }
  370.73 +            toolkit.realSync();
  370.74 +
  370.75 +            passed &= moveCaret(true) == 1;
  370.76 +            passed &= moveCaret(true) == 5;
  370.77 +            passed &= moveCaret(true) == 8;
  370.78 +            passed &= moveCaret(true) == 9;
  370.79 +            passed &= moveCaret(true) == 13;
  370.80 +            passed &= moveCaret(true) == 16;
  370.81 +            passed &= moveCaret(true) == 17;
  370.82 +            passed &= moveCaret(false) == 16;
  370.83 +            passed &= moveCaret(false) == 13;
  370.84 +            passed &= moveCaret(false) == 9;
  370.85 +            passed &= moveCaret(false) == 8;
  370.86 +            passed &= moveCaret(false) == 5;
  370.87 +            passed &= moveCaret(false) == 1;
  370.88 +            passed &= moveCaret(false) == 0;
  370.89 +
  370.90 +        } catch (Exception e) {
  370.91 +            throw new RuntimeException("Test failed because of an exception:",
  370.92 +                    e);
  370.93 +        }
  370.94 +
  370.95 +        if (!passed) {
  370.96 +            throw new RuntimeException("Test failed.");
  370.97 +        }
  370.98 +    }
  370.99 +
 370.100 +    private static int moveCaret(boolean right) throws Exception {
 370.101 +        Util.hitKeys(robo, getCtrlKey(),
 370.102 +                right ? KeyEvent.VK_RIGHT : KeyEvent.VK_LEFT);
 370.103 +        toolkit.realSync();
 370.104 +
 370.105 +        final int[] result = new int[1];
 370.106 +
 370.107 +        SwingUtilities.invokeAndWait(new Runnable() {
 370.108 +
 370.109 +            @Override
 370.110 +            public void run() {
 370.111 +                result[0] = area.getCaretPosition();
 370.112 +            }
 370.113 +        });
 370.114 +
 370.115 +        int pos = result[0];
 370.116 +        return pos;
 370.117 +    }
 370.118 +
 370.119 +    private static void clickMouse() throws Exception {
 370.120 +        final Rectangle result[] = new Rectangle[1];
 370.121 +
 370.122 +        SwingUtilities.invokeAndWait(new Runnable() {
 370.123 +            @Override
 370.124 +            public void run() {
 370.125 +                result[0] = new Rectangle(area.getLocationOnScreen(), area.getSize());
 370.126 +            }
 370.127 +        });
 370.128 +
 370.129 +        Rectangle rect = result[0];
 370.130 +
 370.131 +        robo.mouseMove(rect.x + rect.width / 2, rect.y + rect.width / 2);
 370.132 +        robo.mousePress(InputEvent.BUTTON1_MASK);
 370.133 +    }
 370.134 +
 370.135 +    /**
 370.136 +     * Gets a control key related to the used Look & Feel
 370.137 +     * Returns VK_ALT for Aqua and VK_CONTROL for others
 370.138 +     */
 370.139 +    public static int getCtrlKey() {
 370.140 +
 370.141 +        if ("Aqua".equals(UIManager.getLookAndFeel().getID())) {
 370.142 +            return KeyEvent.VK_ALT;
 370.143 +        }
 370.144 +
 370.145 +        return KeyEvent.VK_CONTROL;
 370.146 +    }
 370.147 +
 370.148 +    private static void createAndShowGUI() {
 370.149 +        JFrame frame = new JFrame();
 370.150 +        frame.setTitle("Bug# 4278839");
 370.151 +        frame.setSize(200, 200);
 370.152 +        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 370.153 +        area = new JTextArea("\naaa bbb\nccc ddd\n");
 370.154 +        frame.getContentPane().add(new JScrollPane(area));
 370.155 +        frame.setVisible(true);
 370.156 +    }
 370.157 +}
   371.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   371.2 +++ b/test/javax/swing/text/JTextComponent/5074573/bug5074573.java	Mon Dec 19 10:06:23 2011 -0800
   371.3 @@ -0,0 +1,159 @@
   371.4 +/*
   371.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   371.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   371.7 + *
   371.8 + * This code is free software; you can redistribute it and/or modify it
   371.9 + * under the terms of the GNU General Public License version 2 only, as
  371.10 + * published by the Free Software Foundation.
  371.11 + *
  371.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  371.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  371.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  371.15 + * version 2 for more details (a copy is included in the LICENSE file that
  371.16 + * accompanied this code).
  371.17 + *
  371.18 + * You should have received a copy of the GNU General Public License version
  371.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  371.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  371.21 + *
  371.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  371.23 + * or visit www.oracle.com if you need additional information or have any
  371.24 + * questions.
  371.25 + */
  371.26 +
  371.27 +/*
  371.28 + * @test
  371.29 + * @bug 5074573
  371.30 + * @summary tests delte-next-word and delete-prev-word actions for all text compnents and all look&feels
  371.31 + * @author Igor Kushnirskiy
  371.32 + * @run main bug5074573
  371.33 + */
  371.34 +
  371.35 +import java.util.*;
  371.36 +import java.awt.Robot;
  371.37 +import java.awt.Toolkit;
  371.38 +import java.awt.event.*;
  371.39 +import javax.swing.*;
  371.40 +import javax.swing.text.*;
  371.41 +import sun.awt.SunToolkit;
  371.42 +
  371.43 +public class bug5074573 {
  371.44 +
  371.45 +    private static JTextComponent textComponent;
  371.46 +    final static String testString = "123 456 789";
  371.47 +    final static String resultString = "456 ";
  371.48 +    final static List<Class<? extends JTextComponent>> textClasses = Arrays.asList(
  371.49 +            JTextArea.class, JEditorPane.class, JTextPane.class,
  371.50 +            JTextField.class, JFormattedTextField.class, JPasswordField.class);
  371.51 +
  371.52 +    public static void main(String[] args) throws Exception {
  371.53 +        for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
  371.54 +            UIManager.setLookAndFeel(info.getClassName());
  371.55 +            System.out.println(info);
  371.56 +            for (Class<? extends JTextComponent> clazz : textClasses) {
  371.57 +                boolean res = test(clazz);
  371.58 +                if (!res && clazz != JPasswordField.class) {
  371.59 +                    throw new RuntimeException("failed");
  371.60 +                }
  371.61 +            }
  371.62 +        }
  371.63 +    }
  371.64 +
  371.65 +    static boolean test(final Class<? extends JTextComponent> textComponentClass) throws Exception {
  371.66 +        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
  371.67 +        Robot robot = new Robot();
  371.68 +        robot.setAutoWaitForIdle(true);
  371.69 +        robot.setAutoDelay(50);
  371.70 +
  371.71 +        SwingUtilities.invokeAndWait(new Runnable() {
  371.72 +
  371.73 +            @Override
  371.74 +            public void run() {
  371.75 +                initialize(textComponentClass);
  371.76 +            }
  371.77 +        });
  371.78 +
  371.79 +        toolkit.realSync();
  371.80 +
  371.81 +        // Remove selection from JTextField components for the Aqua Look & Feel
  371.82 +        if (textComponent instanceof JTextField && "Aqua".equals(UIManager.getLookAndFeel().getID())) {
  371.83 +            SwingUtilities.invokeAndWait(new Runnable() {
  371.84 +
  371.85 +                @Override
  371.86 +                public void run() {
  371.87 +                    Caret caret = textComponent.getCaret();
  371.88 +                    int dot = caret.getDot();
  371.89 +                    textComponent.select(dot, dot);
  371.90 +                }
  371.91 +            });
  371.92 +
  371.93 +            toolkit.realSync();
  371.94 +        }
  371.95 +
  371.96 +        robot.keyPress(getCtrlKey());
  371.97 +        robot.keyPress(KeyEvent.VK_BACK_SPACE);
  371.98 +        robot.keyRelease(KeyEvent.VK_BACK_SPACE);
  371.99 +        robot.keyRelease(getCtrlKey());
 371.100 +        toolkit.realSync();
 371.101 +
 371.102 +        SwingUtilities.invokeAndWait(new Runnable() {
 371.103 +
 371.104 +            @Override
 371.105 +            public void run() {
 371.106 +                Caret caret = textComponent.getCaret();
 371.107 +                caret.setDot(0);
 371.108 +            }
 371.109 +        });
 371.110 +        toolkit.realSync();
 371.111 +
 371.112 +        robot.keyPress(getCtrlKey());
 371.113 +        robot.keyPress(KeyEvent.VK_DELETE);
 371.114 +        robot.keyRelease(KeyEvent.VK_DELETE);
 371.115 +        robot.keyRelease(getCtrlKey());
 371.116 +        toolkit.realSync();
 371.117 +
 371.118 +        return resultString.equals(getText());
 371.119 +    }
 371.120 +
 371.121 +    private static String getText() throws Exception {
 371.122 +        final String[] result = new String[1];
 371.123 +
 371.124 +        SwingUtilities.invokeAndWait(new Runnable() {
 371.125 +            @Override
 371.126 +            public void run() {
 371.127 +                result[0] = textComponent.getText();
 371.128 +            }
 371.129 +        });
 371.130 +
 371.131 +        return result[0];
 371.132 +    }
 371.133 +
 371.134 +    /**
 371.135 +     * Gets a control key related to the used Look & Feel
 371.136 +     * Returns VK_ALT for Aqua and VK_CONTROL for others
 371.137 +     */
 371.138 +    public static int getCtrlKey() {
 371.139 +
 371.140 +        if ("Aqua".equals(UIManager.getLookAndFeel().getID())) {
 371.141 +            return KeyEvent.VK_ALT;
 371.142 +        }
 371.143 +
 371.144 +        return KeyEvent.VK_CONTROL;
 371.145 +    }
 371.146 +
 371.147 +    private static void initialize(Class<? extends JTextComponent> textComponentClass) {
 371.148 +        try {
 371.149 +            JFrame frame = new JFrame();
 371.150 +            textComponent = textComponentClass.newInstance();
 371.151 +            textComponent.setText(testString);
 371.152 +            frame.add(textComponent);
 371.153 +            frame.pack();
 371.154 +            frame.setVisible(true);
 371.155 +            textComponent.requestFocus();
 371.156 +            Caret caret = textComponent.getCaret();
 371.157 +            caret.setDot(textComponent.getDocument().getLength());
 371.158 +        } catch (Exception e) {
 371.159 +            throw new RuntimeException(e);
 371.160 +        }
 371.161 +    }
 371.162 +}
   372.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   372.2 +++ b/test/javax/swing/text/html/HTMLEditorKit/5043626/bug5043626.java	Mon Dec 19 10:06:23 2011 -0800
   372.3 @@ -0,0 +1,112 @@
   372.4 +/*
   372.5 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
   372.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   372.7 + *
   372.8 + * This code is free software; you can redistribute it and/or modify it
   372.9 + * under the terms of the GNU General Public License version 2 only, as
  372.10 + * published by the Free Software Foundation.
  372.11 + *
  372.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  372.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  372.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  372.15 + * version 2 for more details (a copy is included in the LICENSE file that
  372.16 + * accompanied this code).
  372.17 + *
  372.18 + * You should have received a copy of the GNU General Public License version
  372.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  372.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  372.21 + *
  372.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  372.23 + * or visit www.oracle.com if you need additional information or have any
  372.24 + * questions.
  372.25 + */
  372.26 +
  372.27 +/*
  372.28 + * @test
  372.29 + * @bug 5043626
  372.30 + * @summary  Tests pressing Home or Ctrl+Home set cursor to invisible element <head>
  372.31 + * @author Alexander Potochkin
  372.32 + * @library ../../../../regtesthelpers
  372.33 + * @build Util
  372.34 + * @run main bug5043626
  372.35 + */
  372.36 +
  372.37 +import java.awt.Robot;
  372.38 +import java.awt.Toolkit;
  372.39 +import javax.swing.*;
  372.40 +import javax.swing.text.Document;
  372.41 +import javax.swing.text.BadLocationException;
  372.42 +import java.awt.event.KeyEvent;
  372.43 +import sun.awt.SunToolkit;
  372.44 +
  372.45 +public class bug5043626 {
  372.46 +
  372.47 +    private static Document doc;
  372.48 +    private static Robot robot;
  372.49 +
  372.50 +    public static void main(String[] args) throws Exception {
  372.51 +        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
  372.52 +        robot = new Robot();
  372.53 +
  372.54 +        SwingUtilities.invokeAndWait(new Runnable() {
  372.55 +            public void run() {
  372.56 +                createAndShowGUI();
  372.57 +            }
  372.58 +        });
  372.59 +
  372.60 +        toolkit.realSync();
  372.61 +
  372.62 +        Util.hitKeys(robot, KeyEvent.VK_HOME);
  372.63 +        Util.hitKeys(robot, KeyEvent.VK_1);
  372.64 +
  372.65 +        toolkit.realSync();
  372.66 +
  372.67 +        String test = getText();
  372.68 +
  372.69 +        if (!"1test".equals(test)) {
  372.70 +            throw new RuntimeException("Begin line action set cursor inside <head> tag");
  372.71 +        }
  372.72 +
  372.73 +        Util.hitKeys(robot, KeyEvent.VK_HOME);
  372.74 +        Util.hitKeys(robot, KeyEvent.VK_2);
  372.75 +
  372.76 +        toolkit.realSync();
  372.77 +
  372.78 +        test = getText();
  372.79 +
  372.80 +        if (!"21test".equals(test)) {
  372.81 +            throw new RuntimeException("Begin action set cursor inside <head> tag");
  372.82 +        }
  372.83 +    }
  372.84 +
  372.85 +    private static String getText() throws Exception {
  372.86 +        final String[] result = new String[1];
  372.87 +
  372.88 +        SwingUtilities.invokeAndWait(new Runnable() {
  372.89 +            public void run() {
  372.90 +                try {
  372.91 +                    result[0] = doc.getText(0, doc.getLength()).trim();
  372.92 +                } catch (BadLocationException ex) {
  372.93 +                    ex.printStackTrace();
  372.94 +                }
  372.95 +            }
  372.96 +        });
  372.97 +
  372.98 +        return result[0];
  372.99 +    }
 372.100 +
 372.101 +    private static void createAndShowGUI() {
 372.102 +        JFrame frame = new JFrame();
 372.103 +        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 372.104 +
 372.105 +        JEditorPane editorPane = new JEditorPane();
 372.106 +        editorPane.setContentType("text/html");
 372.107 +        editorPane.setText("test");
 372.108 +        editorPane.setEditable(true);
 372.109 +        frame.add(editorPane);
 372.110 +        frame.pack();
 372.111 +        frame.setVisible(true);
 372.112 +        doc = editorPane.getDocument();
 372.113 +        editorPane.setCaretPosition(doc.getLength());
 372.114 +    }
 372.115 +}
   373.1 --- a/test/sun/misc/JarIndex/metaInfFilenames/Basic.java	Tue Dec 06 16:31:58 2011 -0800
   373.2 +++ b/test/sun/misc/JarIndex/metaInfFilenames/Basic.java	Mon Dec 19 10:06:23 2011 -0800
   373.3 @@ -154,8 +154,7 @@
   373.4      /* run javac <args> */
   373.5      static void compile(String... args) {
   373.6          debug("Running: javac " + Arrays.toString(args));
   373.7 -        com.sun.tools.javac.Main compiler = new com.sun.tools.javac.Main();
   373.8 -        if (compiler.compile(args) != 0) {
   373.9 +        if (com.sun.tools.javac.Main.compile(args) != 0) {
  373.10               throw new RuntimeException("javac failed: args=" + Arrays.toString(args));
  373.11          }
  373.12      }
  373.13 @@ -259,7 +258,7 @@
  373.14          URLClassLoader loader = getLoader(baseURL);
  373.15          httpServer.reset();
  373.16  
  373.17 -        Class messageServiceClass = null;
  373.18 +        Class<?> messageServiceClass = null;
  373.19          try {
  373.20              messageServiceClass = loader.loadClass(serviceClass);
  373.21          } catch (ClassNotFoundException cnfe) {
  373.22 @@ -267,7 +266,7 @@
  373.23              throw new RuntimeException("Error in test: " + cnfe);
  373.24          }
  373.25  
  373.26 -        Iterator<Class<?>> iterator = sun.misc.Service.providers(messageServiceClass, loader);
  373.27 +        Iterator<?> iterator = sun.misc.Service.providers(messageServiceClass, loader);
  373.28          if (expectToFind && !iterator.hasNext()) {
  373.29              debug(messageServiceClass + " NOT found.");
  373.30              return false;
  373.31 @@ -301,7 +300,7 @@
  373.32          URLClassLoader loader = getLoader(baseURL);
  373.33          httpServer.reset();
  373.34  
  373.35 -        Class messageServiceClass = null;
  373.36 +        Class<?> messageServiceClass = null;
  373.37          try {
  373.38              messageServiceClass = loader.loadClass(serviceClass);
  373.39          } catch (ClassNotFoundException cnfe) {
  373.40 @@ -309,7 +308,7 @@
  373.41              throw new RuntimeException("Error in test: " + cnfe);
  373.42          }
  373.43  
  373.44 -        Iterator<Class<?>> iterator = (ServiceLoader.load(messageServiceClass, loader)).iterator();
  373.45 +        Iterator<?> iterator = (ServiceLoader.load(messageServiceClass, loader)).iterator();
  373.46          if (expectToFind && !iterator.hasNext()) {
  373.47              debug(messageServiceClass + " NOT found.");
  373.48              return false;
  373.49 @@ -345,7 +344,7 @@
  373.50          URLClassLoader loader = getLoader(baseURL);
  373.51          httpServer.reset();
  373.52  
  373.53 -        Class ADotAKlass = null;
  373.54 +        Class<?> ADotAKlass = null;
  373.55          try {
  373.56              ADotAKlass = loader.loadClass("a.A");
  373.57          } catch (ClassNotFoundException cnfe) {
   374.1 --- a/test/sun/security/krb5/auto/CrossRealm.java	Tue Dec 06 16:31:58 2011 -0800
   374.2 +++ b/test/sun/security/krb5/auto/CrossRealm.java	Mon Dec 19 10:06:23 2011 -0800
   374.3 @@ -65,7 +65,6 @@
   374.4                  "forwardable=true",
   374.5                  "[domain_realm]",
   374.6                  ".snake.hole=SNAKE.HOLE");
   374.7 -        new File("krb5-localkdc.conf").deleteOnExit();
   374.8          System.setProperty("java.security.krb5.conf", "krb5-localkdc.conf");
   374.9      }
  374.10  
  374.11 @@ -73,7 +72,6 @@
  374.12          Security.setProperty("auth.login.defaultCallbackHandler", "CrossRealm");
  374.13          System.setProperty("java.security.auth.login.config", "jaas-localkdc.conf");
  374.14          System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");
  374.15 -        new File("jaas-localkdc.conf").deleteOnExit();
  374.16          FileOutputStream fos = new FileOutputStream("jaas-localkdc.conf");
  374.17          fos.write(("com.sun.security.jgss.krb5.initiate {\n" +
  374.18                  "    com.sun.security.auth.module.Krb5LoginModule\n" +
   375.1 --- a/test/sun/security/krb5/auto/HttpNegotiateServer.java	Tue Dec 06 16:31:58 2011 -0800
   375.2 +++ b/test/sun/security/krb5/auto/HttpNegotiateServer.java	Mon Dec 19 10:06:23 2011 -0800
   375.3 @@ -178,7 +178,6 @@
   375.4                  "    com.sun.security.auth.module.Krb5LoginModule required;\n};\n"
   375.5                  ).getBytes());
   375.6          fos.close();
   375.7 -        f.deleteOnExit();
   375.8  
   375.9          HttpServer h1 = httpd("Negotiate", false,
  375.10                  "HTTP/" + WEB_HOST + "@" + REALM_WEB, KRB5_TAB);
   376.1 --- a/test/sun/security/krb5/auto/KDC.java	Tue Dec 06 16:31:58 2011 -0800
   376.2 +++ b/test/sun/security/krb5/auto/KDC.java	Mon Dec 19 10:06:23 2011 -0800
   376.3 @@ -1071,7 +1071,6 @@
   376.4                  }
   376.5                  cache.update(credentials);
   376.6                  cache.save();
   376.7 -                new File(ccache).deleteOnExit();
   376.8              }
   376.9  
  376.10              return result;
   377.1 --- a/test/sun/security/krb5/auto/OkAsDelegateXRealm.java	Tue Dec 06 16:31:58 2011 -0800
   377.2 +++ b/test/sun/security/krb5/auto/OkAsDelegateXRealm.java	Mon Dec 19 10:06:23 2011 -0800
   377.3 @@ -109,9 +109,6 @@
   377.4  
   377.5          System.setProperty("java.security.auth.login.config", "jaas-localkdc.conf");
   377.6  
   377.7 -        new File("krb5-localkdc.conf").deleteOnExit();
   377.8 -        new File("localkdc.ktab").deleteOnExit();
   377.9 -        new File("jaas-localkdc.conf").deleteOnExit();
  377.10          Config.refresh();
  377.11  
  377.12          Context c = Context.fromJAAS("com.sun.security.jgss.krb5.initiate");
   378.1 --- a/test/sun/security/krb5/auto/OneKDC.java	Tue Dec 06 16:31:58 2011 -0800
   378.2 +++ b/test/sun/security/krb5/auto/OneKDC.java	Mon Dec 19 10:06:23 2011 -0800
   378.3 @@ -76,8 +76,6 @@
   378.4          Config.refresh();
   378.5  
   378.6          writeKtab(KTAB);
   378.7 -        new File(KRB5_CONF).deleteOnExit();
   378.8 -        new File(KTAB).deleteOnExit();
   378.9      }
  378.10  
  378.11      /**
  378.12 @@ -114,7 +112,6 @@
  378.13                  "    isInitiator=false;\n};\n"
  378.14                  ).getBytes());
  378.15          fos.close();
  378.16 -        f.deleteOnExit();
  378.17          Security.setProperty("auth.login.defaultCallbackHandler", "OneKDC$CallbackForClient");
  378.18      }
  378.19  
   379.1 --- a/test/sun/security/krb5/auto/SSL.java	Tue Dec 06 16:31:58 2011 -0800
   379.2 +++ b/test/sun/security/krb5/auto/SSL.java	Mon Dec 19 10:06:23 2011 -0800
   379.3 @@ -96,7 +96,6 @@
   379.4                  "    storeKey=true;\n};\n"
   379.5                  ).getBytes());
   379.6          fos.close();
   379.7 -        f.deleteOnExit();
   379.8  
   379.9          Context c;
  379.10          final Context s = Context.fromJAAS("ssl");
   380.1 --- a/test/sun/security/krb5/auto/W83.java	Tue Dec 06 16:31:58 2011 -0800
   380.2 +++ b/test/sun/security/krb5/auto/W83.java	Mon Dec 19 10:06:23 2011 -0800
   380.3 @@ -52,8 +52,6 @@
   380.4          Config.refresh();
   380.5  
   380.6          kdc.writeKtab(OneKDC.KTAB);
   380.7 -        new File(OneKDC.KRB5_CONF).deleteOnExit();
   380.8 -        new File(OneKDC.KTAB).deleteOnExit();
   380.9  
  380.10          KeyTab ktab = KeyTab.getInstance(OneKDC.KTAB);
  380.11          for (int etype: EType.getBuiltInDefaults()) {
   381.1 --- a/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngineResult/Deserialize.java	Tue Dec 06 16:31:58 2011 -0800
   381.2 +++ b/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngineResult/Deserialize.java	Mon Dec 19 10:06:23 2011 -0800
   381.3 @@ -42,7 +42,6 @@
   381.4          SSLEngineResult.Status obj = SSLEngineResult.Status.OK;
   381.5  
   381.6          File file = new File("deserial-test-file");
   381.7 -        file.deleteOnExit();
   381.8  
   381.9          ObjectOutputStream oos = new ObjectOutputStream(
  381.10              new FileOutputStream(file));