--- old/make/lib/Awt2dLibraries.gmk 2017-10-16 13:03:44.001462938 -0700 +++ new/make/lib/Awt2dLibraries.gmk 2017-10-16 13:03:43.849463388 -0700 @@ -355,9 +355,6 @@ CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_XAWT_CFLAGS) \ $(X_CFLAGS), \ WARNINGS_AS_ERRORS_xlc := false, \ - DISABLED_WARNINGS_gcc := type-limits pointer-to-int-cast \ - unused-result maybe-uninitialized format \ - format-security int-to-pointer-cast parentheses, \ DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE \ E_ASSIGNMENT_TYPE_MISMATCH E_NON_CONST_INIT, \ MAPFILE := $(TOPDIR)/make/mapfiles/libawt_xawt/mapfile-vers, \ --- old/src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c 2017-10-16 13:03:44.393461780 -0700 +++ new/src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c 2017-10-16 13:03:44.237462241 -0700 @@ -149,7 +149,7 @@ static jboolean isXCompositeDisplay(Display *display, int screenNumber) { char NET_WM_CM_Sn[25]; - snprintf(NET_WM_CM_Sn, sizeof(NET_WM_CM_Sn), "_NET_WM_CM_S%d\0", screenNumber); + snprintf(NET_WM_CM_Sn, sizeof(NET_WM_CM_Sn), "_NET_WM_CM_S%d", screenNumber); Atom managerSelection = XInternAtom(display, NET_WM_CM_Sn, 0); Window owner = XGetSelectionOwner(display, managerSelection); --- old/src/java.desktop/unix/native/libawt_xawt/xawt/awt_Taskbar.c 2017-10-16 13:03:44.785460620 -0700 +++ new/src/java.desktop/unix/native/libawt_xawt/xawt/awt_Taskbar.c 2017-10-16 13:03:44.633461069 -0700 @@ -152,7 +152,7 @@ fp_unity_launcher_entry_set_count(entry, value); fp_unity_launcher_entry_set_count_visible(entry, visible); DbusmenuMenuitem* m; - if (m = fp_unity_launcher_entry_get_quicklist(entry)) { + if ((m = fp_unity_launcher_entry_get_quicklist(entry))) { fp_unity_launcher_entry_set_quicklist(entry, m); } gtk->gdk_threads_leave(); @@ -168,7 +168,7 @@ gtk->gdk_threads_enter(); fp_unity_launcher_entry_set_urgent(entry, urgent); DbusmenuMenuitem* m; - if (m = fp_unity_launcher_entry_get_quicklist(entry)) { + if ((m = fp_unity_launcher_entry_get_quicklist(entry))) { fp_unity_launcher_entry_set_quicklist(entry, m); } gtk->gdk_threads_leave(); @@ -185,7 +185,7 @@ fp_unity_launcher_entry_set_progress(entry, value); fp_unity_launcher_entry_set_progress_visible(entry, visible); DbusmenuMenuitem* m; - if (m = fp_unity_launcher_entry_get_quicklist(entry)) { + if ((m = fp_unity_launcher_entry_get_quicklist(entry))) { fp_unity_launcher_entry_set_quicklist(entry, m); } gtk->gdk_threads_leave(); --- old/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c 2017-10-16 13:03:45.173459472 -0700 +++ new/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c 2017-10-16 13:03:45.017459933 -0700 @@ -583,8 +583,8 @@ * Strip the AT-SPI GTK_MODULEs if present */ gtk_modules_env = getenv ("GTK_MODULES"); - if (gtk_modules_env && strstr (gtk_modules_env, "atk-bridge") || - gtk_modules_env && strstr (gtk_modules_env, "gail")) + if ((gtk_modules_env && strstr (gtk_modules_env, "atk-bridge")) || + (gtk_modules_env && strstr (gtk_modules_env, "gail"))) { /* the new env will be smaller than the old one */ gchar *s, *new_env = SAFE_SIZE_STRUCT_ALLOC(malloc, @@ -598,7 +598,7 @@ /* strip out 'atk-bridge' and 'gail' */ size_t PREFIX_LENGTH = strlen(ENV_PREFIX); - while (s = strtok(tmp_env, ":")) + while ((s = strtok(tmp_env, ":"))) { if ((!strstr (s, "atk-bridge")) && (!strstr (s, "gail"))) { @@ -918,14 +918,14 @@ { case BUTTON: case TABLE_HEADER: - if (init_result = (NULL == gtk3_widgets[_GTK_BUTTON_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_BUTTON_TYPE]))) { gtk3_widgets[_GTK_BUTTON_TYPE] = (*fp_gtk_button_new)(); } result = gtk3_widgets[_GTK_BUTTON_TYPE]; break; case CHECK_BOX: - if (init_result = (NULL == gtk3_widgets[_GTK_CHECK_BUTTON_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_CHECK_BUTTON_TYPE]))) { gtk3_widgets[_GTK_CHECK_BUTTON_TYPE] = (*fp_gtk_check_button_new)(); @@ -933,7 +933,7 @@ result = gtk3_widgets[_GTK_CHECK_BUTTON_TYPE]; break; case CHECK_BOX_MENU_ITEM: - if (init_result = (NULL == gtk3_widgets[_GTK_CHECK_MENU_ITEM_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_CHECK_MENU_ITEM_TYPE]))) { gtk3_widgets[_GTK_CHECK_MENU_ITEM_TYPE] = (*fp_gtk_check_menu_item_new)(); @@ -954,7 +954,7 @@ result = gtk3_widgets[_GTK_COLOR_SELECTION_DIALOG_TYPE]; break;*/ case COMBO_BOX: - if (init_result = (NULL == gtk3_widgets[_GTK_COMBO_BOX_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_COMBO_BOX_TYPE]))) { gtk3_widgets[_GTK_COMBO_BOX_TYPE] = (*fp_gtk_combo_box_new)(); @@ -962,8 +962,8 @@ result = gtk3_widgets[_GTK_COMBO_BOX_TYPE]; break; case COMBO_BOX_ARROW_BUTTON: - if (init_result = - (NULL == gtk3_widgets[_GTK_COMBO_BOX_ARROW_BUTTON_TYPE])) + if ((init_result = + (NULL == gtk3_widgets[_GTK_COMBO_BOX_ARROW_BUTTON_TYPE]))) { gtk3_widgets[_GTK_COMBO_BOX_ARROW_BUTTON_TYPE] = (*fp_gtk_toggle_button_new)(); @@ -971,8 +971,8 @@ result = gtk3_widgets[_GTK_COMBO_BOX_ARROW_BUTTON_TYPE]; break; case COMBO_BOX_TEXT_FIELD: - if (init_result = - (NULL == gtk3_widgets[_GTK_COMBO_BOX_TEXT_FIELD_TYPE])) + if ((init_result = + (NULL == gtk3_widgets[_GTK_COMBO_BOX_TEXT_FIELD_TYPE]))) { result = gtk3_widgets[_GTK_COMBO_BOX_TEXT_FIELD_TYPE] = (*fp_gtk_entry_new)(); @@ -982,7 +982,7 @@ case DESKTOP_ICON: case INTERNAL_FRAME_TITLE_PANE: case LABEL: - if (init_result = (NULL == gtk3_widgets[_GTK_LABEL_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_LABEL_TYPE]))) { gtk3_widgets[_GTK_LABEL_TYPE] = (*fp_gtk_label_new)(NULL); @@ -992,7 +992,7 @@ case DESKTOP_PANE: case PANEL: case ROOT_PANE: - if (init_result = (NULL == gtk3_widgets[_GTK_CONTAINER_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_CONTAINER_TYPE]))) { /* There is no constructor for a container type. I've * chosen GtkFixed container since it has a default @@ -1006,7 +1006,7 @@ case EDITOR_PANE: case TEXT_AREA: case TEXT_PANE: - if (init_result = (NULL == gtk3_widgets[_GTK_TEXT_VIEW_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_TEXT_VIEW_TYPE]))) { gtk3_widgets[_GTK_TEXT_VIEW_TYPE] = (*fp_gtk_text_view_new)(); @@ -1016,7 +1016,7 @@ case FORMATTED_TEXT_FIELD: case PASSWORD_FIELD: case TEXT_FIELD: - if (init_result = (NULL == gtk3_widgets[_GTK_ENTRY_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_ENTRY_TYPE]))) { gtk3_widgets[_GTK_ENTRY_TYPE] = (*fp_gtk_entry_new)(); @@ -1024,7 +1024,7 @@ result = gtk3_widgets[_GTK_ENTRY_TYPE]; break; case HANDLE_BOX: - if (init_result = (NULL == gtk3_widgets[_GTK_HANDLE_BOX_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_HANDLE_BOX_TYPE]))) { gtk3_widgets[_GTK_HANDLE_BOX_TYPE] = (*fp_gtk_handle_box_new)(); @@ -1036,7 +1036,7 @@ case HSCROLL_BAR_BUTTON_RIGHT: case HSCROLL_BAR_TRACK: case HSCROLL_BAR_THUMB: - if (init_result = (NULL == gtk3_widgets[_GTK_HSCROLLBAR_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_HSCROLLBAR_TYPE]))) { gtk3_widgets[_GTK_HSCROLLBAR_TYPE] = (*fp_gtk_hscrollbar_new)(create_adjustment()); @@ -1044,7 +1044,7 @@ result = gtk3_widgets[_GTK_HSCROLLBAR_TYPE]; break; case HSEPARATOR: - if (init_result = (NULL == gtk3_widgets[_GTK_HSEPARATOR_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_HSEPARATOR_TYPE]))) { gtk3_widgets[_GTK_HSEPARATOR_TYPE] = (*fp_gtk_hseparator_new)(); @@ -1054,7 +1054,7 @@ case HSLIDER: case HSLIDER_THUMB: case HSLIDER_TRACK: - if (init_result = (NULL == gtk3_widgets[_GTK_HSCALE_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_HSCALE_TYPE]))) { gtk3_widgets[_GTK_HSCALE_TYPE] = (*fp_gtk_scale_new)(GTK_ORIENTATION_HORIZONTAL, NULL); @@ -1063,21 +1063,21 @@ break; case HSPLIT_PANE_DIVIDER: case SPLIT_PANE: - if (init_result = (NULL == gtk3_widgets[_GTK_HPANED_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_HPANED_TYPE]))) { gtk3_widgets[_GTK_HPANED_TYPE] = (*fp_gtk_hpaned_new)(); } result = gtk3_widgets[_GTK_HPANED_TYPE]; break; case IMAGE: - if (init_result = (NULL == gtk3_widgets[_GTK_IMAGE_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_IMAGE_TYPE]))) { gtk3_widgets[_GTK_IMAGE_TYPE] = (*fp_gtk_image_new)(); } result = gtk3_widgets[_GTK_IMAGE_TYPE]; break; case INTERNAL_FRAME: - if (init_result = (NULL == gtk3_widgets[_GTK_WINDOW_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_WINDOW_TYPE]))) { gtk3_widgets[_GTK_WINDOW_TYPE] = (*fp_gtk_window_new)(GTK_WINDOW_TOPLEVEL); @@ -1085,7 +1085,7 @@ result = gtk3_widgets[_GTK_WINDOW_TYPE]; break; case TOOL_TIP: - if (init_result = (NULL == gtk3_widgets[_GTK_TOOLTIP_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_TOOLTIP_TYPE]))) { result = (*fp_gtk_window_new)(GTK_WINDOW_TOPLEVEL); gtk3_widgets[_GTK_TOOLTIP_TYPE] = result; @@ -1096,7 +1096,7 @@ case TABLE: case TREE: case TREE_CELL: - if (init_result = (NULL == gtk3_widgets[_GTK_TREE_VIEW_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_TREE_VIEW_TYPE]))) { gtk3_widgets[_GTK_TREE_VIEW_TYPE] = (*fp_gtk_tree_view_new)(); @@ -1104,14 +1104,14 @@ result = gtk3_widgets[_GTK_TREE_VIEW_TYPE]; break; case TITLED_BORDER: - if (init_result = (NULL == gtk3_widgets[_GTK_FRAME_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_FRAME_TYPE]))) { gtk3_widgets[_GTK_FRAME_TYPE] = fp_gtk_frame_new(NULL); } result = gtk3_widgets[_GTK_FRAME_TYPE]; break; case POPUP_MENU: - if (init_result = (NULL == gtk3_widgets[_GTK_MENU_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_MENU_TYPE]))) { gtk3_widgets[_GTK_MENU_TYPE] = (*fp_gtk_menu_new)(); @@ -1121,7 +1121,7 @@ case MENU: case MENU_ITEM: case MENU_ITEM_ACCELERATOR: - if (init_result = (NULL == gtk3_widgets[_GTK_MENU_ITEM_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_MENU_ITEM_TYPE]))) { gtk3_widgets[_GTK_MENU_ITEM_TYPE] = (*fp_gtk_menu_item_new)(); @@ -1129,7 +1129,7 @@ result = gtk3_widgets[_GTK_MENU_ITEM_TYPE]; break; case MENU_BAR: - if (init_result = (NULL == gtk3_widgets[_GTK_MENU_BAR_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_MENU_BAR_TYPE]))) { gtk3_widgets[_GTK_MENU_BAR_TYPE] = (*fp_gtk_menu_bar_new)(); @@ -1138,7 +1138,7 @@ break; case COLOR_CHOOSER: case OPTION_PANE: - if (init_result = (NULL == gtk3_widgets[_GTK_DIALOG_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_DIALOG_TYPE]))) { gtk3_widgets[_GTK_DIALOG_TYPE] = (*fp_gtk_dialog_new)(); @@ -1146,8 +1146,8 @@ result = gtk3_widgets[_GTK_DIALOG_TYPE]; break; case POPUP_MENU_SEPARATOR: - if (init_result = - (NULL == gtk3_widgets[_GTK_SEPARATOR_MENU_ITEM_TYPE])) + if ((init_result = + (NULL == gtk3_widgets[_GTK_SEPARATOR_MENU_ITEM_TYPE]))) { gtk3_widgets[_GTK_SEPARATOR_MENU_ITEM_TYPE] = (*fp_gtk_separator_menu_item_new)(); @@ -1155,7 +1155,7 @@ result = gtk3_widgets[_GTK_SEPARATOR_MENU_ITEM_TYPE]; break; case HPROGRESS_BAR: - if (init_result = (NULL == gtk3_widgets[_GTK_HPROGRESS_BAR_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_HPROGRESS_BAR_TYPE]))) { gtk3_widgets[_GTK_HPROGRESS_BAR_TYPE] = (*fp_gtk_progress_bar_new)(); @@ -1163,7 +1163,7 @@ result = gtk3_widgets[_GTK_HPROGRESS_BAR_TYPE]; break; case VPROGRESS_BAR: - if (init_result = (NULL == gtk3_widgets[_GTK_VPROGRESS_BAR_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_VPROGRESS_BAR_TYPE]))) { gtk3_widgets[_GTK_VPROGRESS_BAR_TYPE] = (*fp_gtk_progress_bar_new)(); @@ -1178,7 +1178,7 @@ result = gtk3_widgets[_GTK_VPROGRESS_BAR_TYPE]; break; case RADIO_BUTTON: - if (init_result = (NULL == gtk3_widgets[_GTK_RADIO_BUTTON_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_RADIO_BUTTON_TYPE]))) { gtk3_widgets[_GTK_RADIO_BUTTON_TYPE] = (*fp_gtk_radio_button_new)(NULL); @@ -1186,8 +1186,8 @@ result = gtk3_widgets[_GTK_RADIO_BUTTON_TYPE]; break; case RADIO_BUTTON_MENU_ITEM: - if (init_result = - (NULL == gtk3_widgets[_GTK_RADIO_MENU_ITEM_TYPE])) + if ((init_result = + (NULL == gtk3_widgets[_GTK_RADIO_MENU_ITEM_TYPE]))) { gtk3_widgets[_GTK_RADIO_MENU_ITEM_TYPE] = (*fp_gtk_radio_menu_item_new)(NULL); @@ -1195,8 +1195,8 @@ result = gtk3_widgets[_GTK_RADIO_MENU_ITEM_TYPE]; break; case SCROLL_PANE: - if (init_result = - (NULL == gtk3_widgets[_GTK_SCROLLED_WINDOW_TYPE])) + if ((init_result = + (NULL == gtk3_widgets[_GTK_SCROLLED_WINDOW_TYPE]))) { gtk3_widgets[_GTK_SCROLLED_WINDOW_TYPE] = (*fp_gtk_scrolled_window_new)(NULL, NULL); @@ -1206,7 +1206,7 @@ case SPINNER: case SPINNER_ARROW_BUTTON: case SPINNER_TEXT_FIELD: - if (init_result = (NULL == gtk3_widgets[_GTK_SPIN_BUTTON_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_SPIN_BUTTON_TYPE]))) { result = gtk3_widgets[_GTK_SPIN_BUTTON_TYPE] = (*fp_gtk_spin_button_new)(NULL, 0, 0); @@ -1217,7 +1217,7 @@ case TABBED_PANE_TAB_AREA: case TABBED_PANE_CONTENT: case TABBED_PANE_TAB: - if (init_result = (NULL == gtk3_widgets[_GTK_NOTEBOOK_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_NOTEBOOK_TYPE]))) { gtk3_widgets[_GTK_NOTEBOOK_TYPE] = (*fp_gtk_notebook_new)(NULL); @@ -1225,7 +1225,7 @@ result = gtk3_widgets[_GTK_NOTEBOOK_TYPE]; break; case TOGGLE_BUTTON: - if (init_result = (NULL == gtk3_widgets[_GTK_TOGGLE_BUTTON_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_TOGGLE_BUTTON_TYPE]))) { gtk3_widgets[_GTK_TOGGLE_BUTTON_TYPE] = (*fp_gtk_toggle_button_new)(NULL); @@ -1234,7 +1234,7 @@ break; case TOOL_BAR: case TOOL_BAR_DRAG_WINDOW: - if (init_result = (NULL == gtk3_widgets[_GTK_TOOLBAR_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_TOOLBAR_TYPE]))) { gtk3_widgets[_GTK_TOOLBAR_TYPE] = (*fp_gtk_toolbar_new)(NULL); @@ -1242,8 +1242,8 @@ result = gtk3_widgets[_GTK_TOOLBAR_TYPE]; break; case TOOL_BAR_SEPARATOR: - if (init_result = - (NULL == gtk3_widgets[_GTK_SEPARATOR_TOOL_ITEM_TYPE])) + if ((init_result = + (NULL == gtk3_widgets[_GTK_SEPARATOR_TOOL_ITEM_TYPE]))) { gtk3_widgets[_GTK_SEPARATOR_TOOL_ITEM_TYPE] = (*fp_gtk_separator_tool_item_new)(); @@ -1251,7 +1251,7 @@ result = gtk3_widgets[_GTK_SEPARATOR_TOOL_ITEM_TYPE]; break; case VIEWPORT: - if (init_result = (NULL == gtk3_widgets[_GTK_VIEWPORT_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_VIEWPORT_TYPE]))) { GtkAdjustment *adjustment = create_adjustment(); gtk3_widgets[_GTK_VIEWPORT_TYPE] = @@ -1264,7 +1264,7 @@ case VSCROLL_BAR_BUTTON_DOWN: case VSCROLL_BAR_TRACK: case VSCROLL_BAR_THUMB: - if (init_result = (NULL == gtk3_widgets[_GTK_VSCROLLBAR_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_VSCROLLBAR_TYPE]))) { gtk3_widgets[_GTK_VSCROLLBAR_TYPE] = (*fp_gtk_vscrollbar_new)(create_adjustment()); @@ -1272,7 +1272,7 @@ result = gtk3_widgets[_GTK_VSCROLLBAR_TYPE]; break; case VSEPARATOR: - if (init_result = (NULL == gtk3_widgets[_GTK_VSEPARATOR_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_VSEPARATOR_TYPE]))) { gtk3_widgets[_GTK_VSEPARATOR_TYPE] = (*fp_gtk_vseparator_new)(); @@ -1282,7 +1282,7 @@ case VSLIDER: case VSLIDER_THUMB: case VSLIDER_TRACK: - if (init_result = (NULL == gtk3_widgets[_GTK_VSCALE_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_VSCALE_TYPE]))) { gtk3_widgets[_GTK_VSCALE_TYPE] = (*fp_gtk_scale_new)(GTK_ORIENTATION_VERTICAL, NULL); @@ -1296,7 +1296,7 @@ fp_gtk_range_set_inverted((GtkRange*)result, TRUE); break; case VSPLIT_PANE_DIVIDER: - if (init_result = (NULL == gtk3_widgets[_GTK_VPANED_TYPE])) + if ((init_result = (NULL == gtk3_widgets[_GTK_VPANED_TYPE]))) { gtk3_widgets[_GTK_VPANED_TYPE] = (*fp_gtk_vpaned_new)(); } @@ -2014,9 +2014,6 @@ static guint8 recode_color(gdouble channel) { guint16 result = (guint16)(channel * 65535); - if (result > 65535) { - result = 65535; - } return (guint8)( result >> 8); } --- old/src/java.desktop/unix/native/libawt_xawt/awt/list.c 2017-10-16 13:03:45.589458241 -0700 +++ new/src/java.desktop/unix/native/libawt_xawt/awt/list.c 2017-10-16 13:03:45.433458703 -0700 @@ -122,7 +122,7 @@ { list_ptr lp; - if (lp = (list_ptr) malloc( sizeof( list_item))) { + if ((lp = (list_ptr) malloc( sizeof( list_item)))) { lp->next = NULL; lp->ptr.item = NULL; } --- old/src/java.desktop/share/native/common/java2d/opengl/OGLBufImgOps.c 2017-10-16 13:03:45.981457082 -0700 +++ new/src/java.desktop/share/native/common/java2d/opengl/OGLBufImgOps.c 2017-10-16 13:03:45.829457532 -0700 @@ -60,44 +60,6 @@ * don't know of any simple way to find out, other than to compile * the shader at runtime and see if the drivers complain). */ -static const char *convolveShaderSource = - // maximum size supported by this shader - "const int MAX_KERNEL_SIZE = %s;" - // image to be convolved - "uniform sampler%s baseImage;" - // image edge limits: - // imgEdge.xy = imgMin.xy (anything < will be treated as edge case) - // imgEdge.zw = imgMax.xy (anything > will be treated as edge case) - "uniform vec4 imgEdge;" - // value for each location in the convolution kernel: - // kernelVals[i].x = offsetX[i] - // kernelVals[i].y = offsetY[i] - // kernelVals[i].z = kernel[i] - "uniform vec3 kernelVals[MAX_KERNEL_SIZE];" - "" - "void main(void)" - "{" - " int i;" - " vec4 sum;" - "" - " if (any(lessThan(gl_TexCoord[0].st, imgEdge.xy)) ||" - " any(greaterThan(gl_TexCoord[0].st, imgEdge.zw)))" - " {" - // (placeholder for edge condition code) - " %s" - " } else {" - " sum = vec4(0.0);" - " for (i = 0; i < MAX_KERNEL_SIZE; i++) {" - " sum +=" - " kernelVals[i].z *" - " texture%s(baseImage," - " gl_TexCoord[0].st + kernelVals[i].xy);" - " }" - " }" - "" - // modulate with gl_Color in order to apply extra alpha - " gl_FragColor = sum * gl_Color;" - "}"; /** * Flags that can be bitwise-or'ed together to control how the shader @@ -150,8 +112,44 @@ } // compose the final source code string from the various pieces - sprintf(finalSource, convolveShaderSource, - kernelMax, target, edge, target); + sprintf(finalSource, + // maximum size supported by this shader + "const int MAX_KERNEL_SIZE = %s;" + // image to be convolved + "uniform sampler%s baseImage;" + // image edge limits: + // imgEdge.xy = imgMin.xy (anything < will be treated as edge case) + // imgEdge.zw = imgMax.xy (anything > will be treated as edge case) + "uniform vec4 imgEdge;" + // value for each location in the convolution kernel: + // kernelVals[i].x = offsetX[i] + // kernelVals[i].y = offsetY[i] + // kernelVals[i].z = kernel[i] + "uniform vec3 kernelVals[MAX_KERNEL_SIZE];" + "" + "void main(void)" + "{" + " int i;" + " vec4 sum;" + "" + " if (any(lessThan(gl_TexCoord[0].st, imgEdge.xy)) ||" + " any(greaterThan(gl_TexCoord[0].st, imgEdge.zw)))" + " {" + // (placeholder for edge condition code) + " %s" + " } else {" + " sum = vec4(0.0);" + " for (i = 0; i < MAX_KERNEL_SIZE; i++) {" + " sum +=" + " kernelVals[i].z *" + " texture%s(baseImage," + " gl_TexCoord[0].st + kernelVals[i].xy);" + " }" + " }" + "" + // modulate with gl_Color in order to apply extra alpha + " gl_FragColor = sum * gl_Color;" + "}", kernelMax, target, edge, target); convolveProgram = OGLContext_CreateFragmentProgram(finalSource); if (convolveProgram == 0) { @@ -299,26 +297,6 @@ * simply by filling in these "holes" with a call to sprintf(). See the * OGLBufImgOps_CreateRescaleProgram() method for more details. */ -static const char *rescaleShaderSource = - // image to be rescaled - "uniform sampler%s baseImage;" - // vector containing scale factors - "uniform vec4 scaleFactors;" - // vector containing offsets - "uniform vec4 offsets;" - "" - "void main(void)" - "{" - " vec4 srcColor = texture%s(baseImage, gl_TexCoord[0].st);" - // (placeholder for un-premult code) - " %s" - // rescale source value - " vec4 result = (srcColor * scaleFactors) + offsets;" - // (placeholder for re-premult code) - " %s" - // modulate with gl_Color in order to apply extra alpha - " gl_FragColor = result * gl_Color;" - "}"; /** * Flags that can be bitwise-or'ed together to control how the shader @@ -360,8 +338,26 @@ } // compose the final source code string from the various pieces - sprintf(finalSource, rescaleShaderSource, - target, target, preRescale, postRescale); + sprintf(finalSource, + // image to be rescaled + "uniform sampler%s baseImage;" + // vector containing scale factors + "uniform vec4 scaleFactors;" + // vector containing offsets + "uniform vec4 offsets;" + "" + "void main(void)" + "{" + " vec4 srcColor = texture%s(baseImage, gl_TexCoord[0].st);" + // (placeholder for un-premult code) + " %s" + // rescale source value + " vec4 result = (srcColor * scaleFactors) + offsets;" + // (placeholder for re-premult code) + " %s" + // modulate with gl_Color in order to apply extra alpha + " gl_FragColor = result * gl_Color;" + "}", target, target, preRescale, postRescale); rescaleProgram = OGLContext_CreateFragmentProgram(finalSource); if (rescaleProgram == 0) { @@ -505,35 +501,6 @@ * simply by filling in these "holes" with a call to sprintf(). See the * OGLBufImgOps_CreateLookupProgram() method for more details. */ -static const char *lookupShaderSource = - // source image (bound to texture unit 0) - "uniform sampler%s baseImage;" - // lookup table (bound to texture unit 1) - "uniform sampler2D lookupTable;" - // offset subtracted from source index prior to lookup step - "uniform vec4 offset;" - "" - "void main(void)" - "{" - " vec4 srcColor = texture%s(baseImage, gl_TexCoord[0].st);" - // (placeholder for un-premult code) - " %s" - // subtract offset from original index - " vec4 srcIndex = srcColor - offset;" - // use source value as input to lookup table (note that - // "v" texcoords are hardcoded to hit texel centers of - // each row/band in texture) - " vec4 result;" - " result.r = texture2D(lookupTable, vec2(srcIndex.r, 0.125)).r;" - " result.g = texture2D(lookupTable, vec2(srcIndex.g, 0.375)).r;" - " result.b = texture2D(lookupTable, vec2(srcIndex.b, 0.625)).r;" - // (placeholder for alpha store code) - " %s" - // (placeholder for re-premult code) - " %s" - // modulate with gl_Color in order to apply extra alpha - " gl_FragColor = result * gl_Color;" - "}"; /** * Flags that can be bitwise-or'ed together to control how the shader @@ -592,8 +559,35 @@ } // compose the final source code string from the various pieces - sprintf(finalSource, lookupShaderSource, - target, target, preLookup, alpha, postLookup); + sprintf(finalSource, + // source image (bound to texture unit 0) + "uniform sampler%s baseImage;" + // lookup table (bound to texture unit 1) + "uniform sampler2D lookupTable;" + // offset subtracted from source index prior to lookup step + "uniform vec4 offset;" + "" + "void main(void)" + "{" + " vec4 srcColor = texture%s(baseImage, gl_TexCoord[0].st);" + // (placeholder for un-premult code) + " %s" + // subtract offset from original index + " vec4 srcIndex = srcColor - offset;" + // use source value as input to lookup table (note that + // "v" texcoords are hardcoded to hit texel centers of + // each row/band in texture) + " vec4 result;" + " result.r = texture2D(lookupTable, vec2(srcIndex.r, 0.125)).r;" + " result.g = texture2D(lookupTable, vec2(srcIndex.g, 0.375)).r;" + " result.b = texture2D(lookupTable, vec2(srcIndex.b, 0.625)).r;" + // (placeholder for alpha store code) + " %s" + // (placeholder for re-premult code) + " %s" + // modulate with gl_Color in order to apply extra alpha + " gl_FragColor = result * gl_Color;" + "}", target, target, preLookup, alpha, postLookup); lookupProgram = OGLContext_CreateFragmentProgram(finalSource); if (lookupProgram == 0) { --- old/src/java.desktop/share/native/common/java2d/opengl/OGLPaints.c 2017-10-16 13:03:46.381455900 -0700 +++ new/src/java.desktop/share/native/common/java2d/opengl/OGLPaints.c 2017-10-16 13:03:46.221456372 -0700 @@ -382,57 +382,6 @@ static GLuint multiGradientTexID = 0; /** - * This is essentially a template of the shader source code that can be used - * for either LinearGradientPaint or RadialGradientPaint. It includes the - * structure and some variables that are common to each; the remaining - * code snippets (for CycleMethod, ColorSpaceType, and mask modulation) - * are filled in prior to compiling the shader at runtime depending on the - * paint parameters. See OGLPaints_CreateMultiGradProgram() for more details. - */ -static const char *multiGradientShaderSource = - // gradient texture size (in texels) - "const int TEXTURE_SIZE = %d;" - // maximum number of fractions/colors supported by this shader - "const int MAX_FRACTIONS = %d;" - // size of a single texel - "const float FULL_TEXEL = (1.0 / float(TEXTURE_SIZE));" - // size of half of a single texel - "const float HALF_TEXEL = (FULL_TEXEL / 2.0);" - // texture containing the gradient colors - "uniform sampler1D colors;" - // array of gradient stops/fractions - "uniform float fractions[MAX_FRACTIONS];" - // array of scale factors (one for each interval) - "uniform float scaleFactors[MAX_FRACTIONS-1];" - // (placeholder for mask variable) - "%s" - // (placeholder for Linear/RadialGP-specific variables) - "%s" - "" - "void main(void)" - "{" - " float dist;" - // (placeholder for Linear/RadialGradientPaint-specific code) - " %s" - "" - " float tc;" - // (placeholder for CycleMethod-specific code) - " %s" - "" - // calculate interpolated color - " vec4 result = texture1D(colors, tc);" - "" - // (placeholder for ColorSpace conversion code) - " %s" - "" - // (placeholder for mask modulation code) - " %s" - "" - // modulate with gl_Color in order to apply extra alpha - " gl_FragColor = result * gl_Color;" - "}"; - -/** * This code takes a "dist" value as input (as calculated earlier by the * LGP/RGP-specific code) in the range [0,1] and produces a texture * coordinate value "tc" that represents the position of the chosen color @@ -476,29 +425,6 @@ // color between the two texel centers of interest "tc = HALF_TEXEL + (FULL_TEXEL * relFraction);"; -/** Code for NO_CYCLE that gets plugged into the CycleMethod placeholder. */ -static const char *noCycleCode = - "if (dist <= 0.0) {" - " tc = 0.0;" - "} else if (dist >= 1.0) {" - " tc = 1.0;" - "} else {" - // (placeholder for texcoord calculation) - " %s" - "}"; - -/** Code for REFLECT that gets plugged into the CycleMethod placeholder. */ -static const char *reflectCode = - "dist = 1.0 - (abs(fract(dist * 0.5) - 0.5) * 2.0);" - // (placeholder for texcoord calculation) - "%s"; - -/** Code for REPEAT that gets plugged into the CycleMethod placeholder. */ -static const char *repeatCode = - "dist = fract(dist);" - // (placeholder for texcoord calculation) - "%s"; - static void OGLPaints_InitMultiGradientTexture() { @@ -578,16 +504,81 @@ } if (cycleMethod == CYCLE_NONE) { - sprintf(cycleCode, noCycleCode, texCoordCalcCode); + sprintf(cycleCode, + /** Code for NO_CYCLE that gets plugged into the CycleMethod placeholder. */ + "if (dist <= 0.0) {" + " tc = 0.0;" + "} else if (dist >= 1.0) {" + " tc = 1.0;" + "} else {" + // (placeholder for texcoord calculation) + " %s" + "}", texCoordCalcCode); } else if (cycleMethod == CYCLE_REFLECT) { - sprintf(cycleCode, reflectCode, texCoordCalcCode); + sprintf(cycleCode, + /** Code for REFLECT that gets plugged into the CycleMethod placeholder. */ + "dist = 1.0 - (abs(fract(dist * 0.5) - 0.5) * 2.0);" + // (placeholder for texcoord calculation) + "%s", texCoordCalcCode); } else { // (cycleMethod == CYCLE_REPEAT) - sprintf(cycleCode, repeatCode, texCoordCalcCode); + sprintf(cycleCode, + /** Code for REPEAT that gets plugged into the CycleMethod placeholder. */ + "dist = fract(dist);" + // (placeholder for texcoord calculation) + "%s", texCoordCalcCode); } // compose the final source code string from the various pieces - sprintf(finalSource, multiGradientShaderSource, - MAX_COLORS, maxFractions, + sprintf(finalSource, +/** + * This is essentially a template of the shader source code that can be used + * for either LinearGradientPaint or RadialGradientPaint. It includes the + * structure and some variables that are common to each; the remaining + * code snippets (for CycleMethod, ColorSpaceType, and mask modulation) + * are filled in prior to compiling the shader at runtime depending on the + * paint parameters. See OGLPaints_CreateMultiGradProgram() for more details. + */ + // gradient texture size (in texels) + "const int TEXTURE_SIZE = %d;" + // maximum number of fractions/colors supported by this shader + "const int MAX_FRACTIONS = %d;" + // size of a single texel + "const float FULL_TEXEL = (1.0 / float(TEXTURE_SIZE));" + // size of half of a single texel + "const float HALF_TEXEL = (FULL_TEXEL / 2.0);" + // texture containing the gradient colors + "uniform sampler1D colors;" + // array of gradient stops/fractions + "uniform float fractions[MAX_FRACTIONS];" + // array of scale factors (one for each interval) + "uniform float scaleFactors[MAX_FRACTIONS-1];" + // (placeholder for mask variable) + "%s" + // (placeholder for Linear/RadialGP-specific variables) + "%s" + "" + "void main(void)" + "{" + " float dist;" + // (placeholder for Linear/RadialGradientPaint-specific code) + " %s" + "" + " float tc;" + // (placeholder for CycleMethod-specific code) + " %s" + "" + // calculate interpolated color + " vec4 result = texture1D(colors, tc);" + "" + // (placeholder for ColorSpace conversion code) + " %s" + "" + // (placeholder for mask modulation code) + " %s" + "" + // modulate with gl_Color in order to apply extra alpha + " gl_FragColor = result * gl_Color;" + "}", MAX_COLORS, maxFractions, maskVars, paintVars, distCode, cycleCode, colorSpaceCode, maskCode); --- old/src/java.base/share/native/libjava/sizecalc.h 2017-10-16 13:03:46.813454621 -0700 +++ new/src/java.base/share/native/libjava/sizecalc.h 2017-10-16 13:03:46.641455131 -0700 @@ -44,7 +44,7 @@ #define SIZE_MAX ((size_t)-1) #endif -#define IS_SAFE_SIZE_T(x) ((x) >= 0 && (unsigned long long)(x) <= SIZE_MAX) +#define IS_SAFE_SIZE_T(x) (((x) + 1) > 0 && (unsigned long long)(x) - 1u < SIZE_MAX) #define IS_SAFE_SIZE_MUL(m, n) \ (IS_SAFE_SIZE_T(m) && IS_SAFE_SIZE_T(n) && ((m) == 0 || (n) == 0 || (size_t)(n) <= (SIZE_MAX / (size_t)(m)))) --- old/src/java.desktop/unix/native/libawt_xawt/awt/sun_awt_X11_GtkFileDialogPeer.c 2017-10-16 13:03:47.205453461 -0700 +++ new/src/java.desktop/unix/native/libawt_xawt/awt/sun_awt_X11_GtkFileDialogPeer.c 2017-10-16 13:03:47.053453911 -0700 @@ -80,7 +80,7 @@ static void quit(JNIEnv * env, jobject jpeer, gboolean isSignalHandler) { jthrowable pendingException; - if (pendingException = (*env)->ExceptionOccurred(env)) { + if ((pendingException = (*env)->ExceptionOccurred(env))) { (*env)->ExceptionClear(env); } --- old/src/java.desktop/unix/native/common/java2d/x11/X11PMBlitLoops.c 2017-10-16 13:03:47.601452290 -0700 +++ new/src/java.desktop/unix/native/common/java2d/x11/X11PMBlitLoops.c 2017-10-16 13:03:47.445452751 -0700 @@ -60,7 +60,7 @@ return; } - xgc = (GC)gc; + xgc = (GC)jlong_to_ptr(gc); if (xgc == NULL) { return; } @@ -151,7 +151,7 @@ return; } - dstGC = (GC)xgc; + dstGC = (GC)jlong_to_ptr(xgc); if (dstGC == NULL) { return; } --- old/src/java.desktop/unix/native/common/java2d/x11/X11Renderer.c 2017-10-16 13:03:47.997451119 -0700 +++ new/src/java.desktop/unix/native/common/java2d/x11/X11Renderer.c 2017-10-16 13:03:47.841451580 -0700 @@ -225,13 +225,13 @@ jint x1, jint y1, jint x2, jint y2) { #ifndef HEADLESS - X11SDOps *xsdo = (X11SDOps *) pXSData; + X11SDOps *xsdo = (X11SDOps *) jlong_to_ptr(pXSData); if (xsdo == NULL) { return; } - XDrawLine(awt_display, xsdo->drawable, (GC) xgc, + XDrawLine(awt_display, xsdo->drawable, (GC) jlong_to_ptr(xgc), CLAMP_TO_SHORT(x1), CLAMP_TO_SHORT(y1), CLAMP_TO_SHORT(x2), CLAMP_TO_SHORT(y2)); X11SD_DirectRenderNotify(env, xsdo); @@ -249,7 +249,7 @@ jint x, jint y, jint w, jint h) { #ifndef HEADLESS - X11SDOps *xsdo = (X11SDOps *) pXSData; + X11SDOps *xsdo = (X11SDOps *) jlong_to_ptr(pXSData); if (xsdo == NULL || w < 0 || h < 0) { return; @@ -263,11 +263,11 @@ * the anomalies of various X11 implementations that draw * nothing for degenerate Polygons and Rectangles. */ - XFillRectangle(awt_display, xsdo->drawable, (GC) xgc, + XFillRectangle(awt_display, xsdo->drawable, (GC) jlong_to_ptr(xgc), CLAMP_TO_SHORT(x), CLAMP_TO_SHORT(y), CLAMP_TO_USHORT(w+1), CLAMP_TO_USHORT(h+1)); } else { - XDrawRectangle(awt_display, xsdo->drawable, (GC) xgc, + XDrawRectangle(awt_display, xsdo->drawable, (GC) jlong_to_ptr(xgc), CLAMP_TO_SHORT(x), CLAMP_TO_SHORT(y), CLAMP_TO_USHORT(w), CLAMP_TO_USHORT(h)); } @@ -289,7 +289,7 @@ #ifndef HEADLESS long ty1, ty2, tx1, tx2, cx, cy, cxw, cyh, halfW, halfH, leftW, rightW, topH, bottomH; - X11SDOps *xsdo = (X11SDOps *) pXSData; + X11SDOps *xsdo = (X11SDOps *) jlong_to_ptr(pXSData); if (xsdo == NULL || w < 0 || h < 0) { return; @@ -334,32 +334,32 @@ topH = (ty1 - cy) * 2; bottomH = (cyh - ty2) * 2; - awt_drawArc(env, xsdo->drawable, (GC) xgc, + awt_drawArc(env, xsdo->drawable, (GC) jlong_to_ptr(xgc), cx, cy, leftW, topH, 90, 90, JNI_FALSE); - awt_drawArc(env, xsdo->drawable, (GC) xgc, + awt_drawArc(env, xsdo->drawable, (GC) jlong_to_ptr(xgc), cxw - rightW, cy, rightW, topH, 0, 90, JNI_FALSE); - awt_drawArc(env, xsdo->drawable, (GC) xgc, + awt_drawArc(env, xsdo->drawable, (GC) jlong_to_ptr(xgc), cx, cyh - bottomH, leftW, bottomH, 180, 90, JNI_FALSE); - awt_drawArc(env, xsdo->drawable, (GC) xgc, + awt_drawArc(env, xsdo->drawable, (GC) jlong_to_ptr(xgc), cxw - rightW, cyh - bottomH, rightW, bottomH, 270, 90, JNI_FALSE); if (tx1 <= tx2) { - XDrawLine(awt_display, xsdo->drawable, (GC) xgc, + XDrawLine(awt_display, xsdo->drawable, (GC) jlong_to_ptr(xgc), tx1, cy, tx2, cy); if (h > 0) { - XDrawLine(awt_display, xsdo->drawable, (GC) xgc, + XDrawLine(awt_display, xsdo->drawable, (GC) jlong_to_ptr(xgc), tx1, cyh, tx2, cyh); } } if (ty1 <= ty2) { - XDrawLine(awt_display, xsdo->drawable, (GC) xgc, + XDrawLine(awt_display, xsdo->drawable, (GC) jlong_to_ptr(xgc), cx, ty1, cx, ty2); if (w > 0) { - XDrawLine(awt_display, xsdo->drawable, (GC) xgc, + XDrawLine(awt_display, xsdo->drawable, (GC) jlong_to_ptr(xgc), cxw, ty1, cxw, ty2); } } @@ -378,7 +378,7 @@ jint x, jint y, jint w, jint h) { #ifndef HEADLESS - X11SDOps *xsdo = (X11SDOps *) pXSData; + X11SDOps *xsdo = (X11SDOps *) jlong_to_ptr(pXSData); if (xsdo == NULL) { return; @@ -393,11 +393,11 @@ * for speed and to deal better with degenerate sizes. */ if (w >= 0 && h >= 0) { - XFillRectangle(awt_display, xsdo->drawable, (GC) xgc, + XFillRectangle(awt_display, xsdo->drawable, (GC) jlong_to_ptr(xgc), x, y, w+1, h+1); } } else { - awt_drawArc(env, xsdo->drawable, (GC) xgc, + awt_drawArc(env, xsdo->drawable, (GC) jlong_to_ptr(xgc), x, y, w, h, 0, 360, JNI_FALSE); } X11SD_DirectRenderNotify(env, xsdo); @@ -416,13 +416,13 @@ jint angleStart, jint angleExtent) { #ifndef HEADLESS - X11SDOps *xsdo = (X11SDOps *) pXSData; + X11SDOps *xsdo = (X11SDOps *) jlong_to_ptr(pXSData); if (xsdo == NULL) { return; } - awt_drawArc(env, xsdo->drawable, (GC) xgc, + awt_drawArc(env, xsdo->drawable, (GC) jlong_to_ptr(xgc), x, y, w, h, angleStart, angleExtent, JNI_FALSE); X11SD_DirectRenderNotify(env, xsdo); #endif /* !HEADLESS */ @@ -442,7 +442,7 @@ { #ifndef HEADLESS XPoint pTmp[POLYTEMPSIZE], *points; - X11SDOps *xsdo = (X11SDOps *) pXSData; + X11SDOps *xsdo = (X11SDOps *) jlong_to_ptr(pXSData); if (xsdo == NULL) { return; @@ -476,11 +476,11 @@ * non-degenerate as this may invoke less processing * down the line than a Poly primitive anyway. */ - XDrawLine(awt_display, xsdo->drawable, (GC) xgc, + XDrawLine(awt_display, xsdo->drawable, (GC) jlong_to_ptr(xgc), points[0].x, points[0].y, points[1].x, points[1].y); } else { - XDrawLines(awt_display, xsdo->drawable, (GC) xgc, + XDrawLines(awt_display, xsdo->drawable, (GC) jlong_to_ptr(xgc), points, npoints, CoordModeOrigin); } if (points != pTmp) { @@ -569,7 +569,7 @@ jint transX, jint transY, jobject p2df, jboolean isFill) { #ifndef HEADLESS - X11SDOps *xsdo = (X11SDOps *) pXSData; + X11SDOps *xsdo = (X11SDOps *) jlong_to_ptr(pXSData); jarray typesArray; jobject pointArray; jarray coordsArray; @@ -609,7 +609,7 @@ return; } - XDHD_INIT(&dHData, (GC)xgc, xsdo->drawable); + XDHD_INIT(&dHData, (GC) jlong_to_ptr(xgc), xsdo->drawable); drawHandler.pData = &dHData; stroke = (((*env)->GetIntField(env, sg2d, sg2dStrokeHintID) == @@ -666,13 +666,13 @@ jint x, jint y, jint w, jint h) { #ifndef HEADLESS - X11SDOps *xsdo = (X11SDOps *) pXSData; + X11SDOps *xsdo = (X11SDOps *) jlong_to_ptr(pXSData); if (xsdo == NULL) { return; } - XFillRectangle(awt_display, xsdo->drawable, (GC) xgc, + XFillRectangle(awt_display, xsdo->drawable, (GC) jlong_to_ptr(xgc), CLAMP_TO_SHORT(x), CLAMP_TO_SHORT(y), CLAMP_TO_USHORT(w), CLAMP_TO_USHORT(h)); X11SD_DirectRenderNotify(env, xsdo); @@ -693,7 +693,7 @@ #ifndef HEADLESS long ty1, ty2, tx1, tx2, cx, cy, cxw, cyh, halfW, halfH, leftW, rightW, topH, bottomH; - X11SDOps *xsdo = (X11SDOps *) pXSData; + X11SDOps *xsdo = (X11SDOps *) jlong_to_ptr(pXSData); if (xsdo == NULL || w <= 0 || h <= 0) { return; @@ -738,31 +738,31 @@ topH = (ty1 - cy) * 2; bottomH = (cyh - ty2) * 2; - awt_drawArc(env, xsdo->drawable, (GC) xgc, + awt_drawArc(env, xsdo->drawable, (GC) jlong_to_ptr(xgc), cx, cy, leftW, topH, 90, 90, JNI_TRUE); - awt_drawArc(env, xsdo->drawable, (GC) xgc, + awt_drawArc(env, xsdo->drawable, (GC) jlong_to_ptr(xgc), cxw - rightW, cy, rightW, topH, 0, 90, JNI_TRUE); - awt_drawArc(env, xsdo->drawable, (GC) xgc, + awt_drawArc(env, xsdo->drawable, (GC) jlong_to_ptr(xgc), cx, cyh - bottomH, leftW, bottomH, 180, 90, JNI_TRUE); - awt_drawArc(env, xsdo->drawable, (GC) xgc, + awt_drawArc(env, xsdo->drawable, (GC) jlong_to_ptr(xgc), cxw - rightW, cyh - bottomH, rightW, bottomH, 270, 90, JNI_TRUE); if (tx1 < tx2) { if (cy < ty1) { - XFillRectangle(awt_display, xsdo->drawable, (GC) xgc, + XFillRectangle(awt_display, xsdo->drawable, (GC) jlong_to_ptr(xgc), tx1, cy, tx2 - tx1, ty1 - cy); } if (ty2 < cyh) { - XFillRectangle(awt_display, xsdo->drawable, (GC) xgc, + XFillRectangle(awt_display, xsdo->drawable, (GC) jlong_to_ptr(xgc), tx1, ty2, tx2 - tx1, cyh - ty2); } } if (ty1 < ty2) { - XFillRectangle(awt_display, xsdo->drawable, (GC) xgc, + XFillRectangle(awt_display, xsdo->drawable, (GC) jlong_to_ptr(xgc), cx, ty1, cxw - cx, ty2 - ty1); } X11SD_DirectRenderNotify(env, xsdo); @@ -780,7 +780,7 @@ jint x, jint y, jint w, jint h) { #ifndef HEADLESS - X11SDOps *xsdo = (X11SDOps *) pXSData; + X11SDOps *xsdo = (X11SDOps *) jlong_to_ptr(pXSData); if (xsdo == NULL) { return; @@ -820,10 +820,10 @@ } #undef SQRT_3_4 if (w > 0 && h > 0) { - XFillRectangle(awt_display, xsdo->drawable, (GC) xgc, x, y, w, h); + XFillRectangle(awt_display, xsdo->drawable, (GC) jlong_to_ptr(xgc), x, y, w, h); } } else { - awt_drawArc(env, xsdo->drawable, (GC) xgc, + awt_drawArc(env, xsdo->drawable, (GC) jlong_to_ptr(xgc), x, y, w, h, 0, 360, JNI_TRUE); } X11SD_DirectRenderNotify(env, xsdo); @@ -842,13 +842,13 @@ jint angleStart, jint angleExtent) { #ifndef HEADLESS - X11SDOps *xsdo = (X11SDOps *) pXSData; + X11SDOps *xsdo = (X11SDOps *) jlong_to_ptr(pXSData); if (xsdo == NULL) { return; } - awt_drawArc(env, xsdo->drawable, (GC) xgc, + awt_drawArc(env, xsdo->drawable, (GC) jlong_to_ptr(xgc), x, y, w, h, angleStart, angleExtent, JNI_TRUE); X11SD_DirectRenderNotify(env, xsdo); #endif /* !HEADLESS */ @@ -867,7 +867,7 @@ { #ifndef HEADLESS XPoint pTmp[POLYTEMPSIZE], *points; - X11SDOps *xsdo = (X11SDOps *) pXSData; + X11SDOps *xsdo = (X11SDOps *) jlong_to_ptr(pXSData); if (xsdo == NULL) { return; @@ -892,7 +892,7 @@ pTmp, (int *)&npoints, JNI_FALSE); if (points != 0) { if (npoints > 2) { - XFillPolygon(awt_display, xsdo->drawable, (GC) xgc, + XFillPolygon(awt_display, xsdo->drawable, (GC) jlong_to_ptr(xgc), points, npoints, Complex, CoordModeOrigin); X11SD_DirectRenderNotify(env, xsdo); } @@ -919,7 +919,7 @@ void *srData; jint x, y, w, h; jint spanbox[4]; - X11SDOps *xsdo = (X11SDOps *) pXSData; + X11SDOps *xsdo = (X11SDOps *) jlong_to_ptr(pXSData); if (xsdo == NULL) { return; @@ -940,7 +940,7 @@ y = spanbox[1] + transy; w = spanbox[2] - spanbox[0]; h = spanbox[3] - spanbox[1]; - XFillRectangle(awt_display, xsdo->drawable, (GC) xgc, + XFillRectangle(awt_display, xsdo->drawable, (GC) jlong_to_ptr(xgc), CLAMP_TO_SHORT(x), CLAMP_TO_SHORT(y), CLAMP_TO_USHORT(w), CLAMP_TO_USHORT(h)); } @@ -971,7 +971,7 @@ return; } - xgc = (GC)gc; + xgc = (GC) jlong_to_ptr(gc); if (xgc == NULL) { return; } --- old/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.c 2017-10-16 13:03:48.389449959 -0700 +++ new/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.c 2017-10-16 13:03:48.241450397 -0700 @@ -1394,13 +1394,13 @@ J2dTraceLn(J2D_TRACE_INFO, "in X11SurfaceData_XCreateGC"); - xsdo = (X11SDOps *) pXSData; + xsdo = (X11SDOps *) jlong_to_ptr(pXSData); if (xsdo == NULL) { return 0L; } xsdo->javaGC = XCreateGC(awt_display, xsdo->drawable, 0, NULL); - ret = (jlong) xsdo->javaGC; + ret = ptr_to_jlong(xsdo->javaGC); #else /* !HEADLESS */ ret = 0L; #endif /* !HEADLESS */ @@ -1419,7 +1419,7 @@ { #ifndef HEADLESS J2dTraceLn(J2D_TRACE_INFO, "in X11SurfaceData_XResetClip"); - XSetClipMask(awt_display, (GC) xgc, None); + XSetClipMask(awt_display, (GC) jlong_to_ptr(xgc), None); #endif /* !HEADLESS */ } @@ -1445,7 +1445,7 @@ x1, y1, x2, y2, complexclip, &pRect, 256); - XSetClipRectangles(awt_display, (GC) xgc, 0, 0, pRect, numrects, YXBanded); + XSetClipRectangles(awt_display, (GC) jlong_to_ptr(xgc), 0, 0, pRect, numrects, YXBanded); if (pRect != rects) { free(pRect); @@ -1464,7 +1464,7 @@ { #ifndef HEADLESS J2dTraceLn(J2D_TRACE_INFO, "in X11SurfaceData_XSetCopyMode"); - XSetFunction(awt_display, (GC) xgc, GXcopy); + XSetFunction(awt_display, (GC) jlong_to_ptr(xgc), GXcopy); #endif /* !HEADLESS */ } @@ -1479,7 +1479,7 @@ { #ifndef HEADLESS J2dTraceLn(J2D_TRACE_INFO, "in X11SurfaceData_XSetXorMode"); - XSetFunction(awt_display, (GC) xgc, GXxor); + XSetFunction(awt_display, (GC) jlong_to_ptr(xgc), GXxor); #endif /* !HEADLESS */ } @@ -1494,7 +1494,7 @@ { #ifndef HEADLESS J2dTraceLn(J2D_TRACE_INFO, "in X11SurfaceData_XSetForeground"); - XSetForeground(awt_display, (GC) xgc, pixel); + XSetForeground(awt_display, (GC) jlong_to_ptr(xgc), pixel); #endif /* !HEADLESS */ } @@ -1509,6 +1509,6 @@ { #ifndef HEADLESS J2dTraceLn(J2D_TRACE_INFO, "in X11SurfaceData_XSetGraphicsExposures"); - XSetGraphicsExposures(awt_display, (GC) xgc, needExposures ? True : False); + XSetGraphicsExposures(awt_display, (GC) jlong_to_ptr(xgc), needExposures ? True : False); #endif /* !HEADLESS */ } --- old/src/java.desktop/unix/native/common/java2d/x11/X11TextRenderer_md.c 2017-10-16 13:03:48.797448753 -0700 +++ new/src/java.desktop/unix/native/common/java2d/x11/X11TextRenderer_md.c 2017-10-16 13:03:48.641449215 -0700 @@ -222,7 +222,7 @@ return; } - xgc = (GC)gc; + xgc = (GC) jlong_to_ptr(gc); if (xgc == NULL) { return; } --- old/src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c 2017-10-16 13:03:49.181447616 -0700 +++ new/src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c 2017-10-16 13:03:49.029448066 -0700 @@ -583,9 +583,9 @@ (JNIEnv *env, jclass clazz, jlong display, jlong which, jlong device_spec) { AWT_CHECK_HAVE_LOCK_RETURN(0); - return (jlong) XkbGetMap( (Display *) jlong_to_ptr(display), + return ptr_to_jlong(XkbGetMap( (Display *) jlong_to_ptr(display), (unsigned int) which, - (unsigned int) device_spec); + (unsigned int) device_spec)); } JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XkbGetUpdatedMap (JNIEnv *env, jclass clazz, jlong display, jlong which, jlong xkb) @@ -606,7 +606,7 @@ { AWT_CHECK_HAVE_LOCK_RETURN(JNI_FALSE); Bool b; - b = XkbTranslateKeyCode((XkbDescPtr)xkb, (unsigned int)keycode, (unsigned int)mods, + b = XkbTranslateKeyCode((XkbDescPtr)jlong_to_ptr(xkb), (unsigned int)keycode, (unsigned int)mods, (unsigned int *)jlong_to_ptr(mods_rtrn), (KeySym *)jlong_to_ptr(keysym_rtrn)); //printf("native, input: keycode:0x%0X; mods:0x%0X\n", keycode, mods); @@ -2221,10 +2221,10 @@ } } -JNIEXPORT jint JNICALL +JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XSynchronize(JNIEnv *env, jclass clazz, jlong display, jboolean onoff) { - return (jint) XSynchronize((Display*)jlong_to_ptr(display), (onoff == JNI_TRUE ? True : False)); + return ptr_to_jlong(XSynchronize((Display*)jlong_to_ptr(display), (onoff == JNI_TRUE ? True : False))); } JNIEXPORT jboolean JNICALL --- old/src/java.desktop/unix/classes/sun/awt/X11/XlibWrapper.java 2017-10-16 13:03:49.593446398 -0700 +++ new/src/java.desktop/unix/classes/sun/awt/X11/XlibWrapper.java 2017-10-16 13:03:49.437446860 -0700 @@ -529,7 +529,7 @@ display Specifies the connection to the X server. onoff Specifies a Boolean value that indicates whether to enable or disable synchronization. */ - static native int XSynchronize(long display, boolean onoff); + static native long XSynchronize(long display, boolean onoff); /** * Extracts an X event that can be processed in a secondary loop. --- old/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c 2017-10-16 13:03:49.989445228 -0700 +++ new/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c 2017-10-16 13:03:49.837445676 -0700 @@ -747,7 +747,7 @@ static void wakeUp() { static char wakeUp_char = 'p'; if (!isMainThread() && awt_pipe_inited) { - write ( AWT_WRITEPIPE, &wakeUp_char, 1 ); + int ret = write ( AWT_WRITEPIPE, &wakeUp_char, 1 ); } }